mirror of
https://github.com/amadvance/snapraid.git
synced 2026-11-19 22:46:36 -05:00
Refactors again function calls.
This commit is contained in:
parent
cae803bdfb
commit
6b619906af
7 changed files with 67 additions and 63 deletions
72
raid/raid.h
72
raid/raid.h
|
|
@ -29,18 +29,18 @@
|
|||
* RAID mode supporting up to 3 parities,
|
||||
*
|
||||
* It has a fast triple parity implementation even without SSSE3, but it
|
||||
* cannot go beyond it.
|
||||
* cannot go beyond triple parity.
|
||||
* This is mostly intended for low end CPUs like ARM and AMD Athlon.
|
||||
*/
|
||||
#define RAID_MODE_VANDERMONDE 1
|
||||
|
||||
/**
|
||||
* Max level of parity supported in the default mode RAID_MODE_CAUCHY.
|
||||
* Max level of parity disks supported.
|
||||
*/
|
||||
#define RAID_PARITY_MAX 6
|
||||
|
||||
/**
|
||||
* Maximum number of data disks.
|
||||
* Maximum number of data disks supported.
|
||||
*/
|
||||
#define RAID_DATA_MAX 251
|
||||
|
||||
|
|
@ -84,67 +84,67 @@ void raid_waste(void *zero);
|
|||
/**
|
||||
* Computes the parity.
|
||||
*
|
||||
* \param nd Number of data disks.
|
||||
* \param np Number of parities to compute.
|
||||
* \param size Size of the blocks pointed by ::v. It must be a multipler of 64.
|
||||
* \param v Vector of pointers to the blocks for disks and parities.
|
||||
* It has (::nd + ::np) elements. The first elements are the blocks for
|
||||
* @nd Number of data blocks.
|
||||
* @np Number of parities blocks to compute.
|
||||
* @size Size of the blocks pointed by @v. It must be a multipler of 64.
|
||||
* @v Vector of pointers to the blocks of data and parity.
|
||||
* It has (@nd + @np) elements. The starting elements are the blocks for
|
||||
* data, following with the parity blocks.
|
||||
* Each blocks has ::size bytes.
|
||||
* Each blocks has @size bytes.
|
||||
*/
|
||||
void raid_par(int nd, int np, size_t size, void **v);
|
||||
|
||||
/**
|
||||
* Recovers failures of data and parity blocks.
|
||||
* Recovers failures in data and parity blocks.
|
||||
*
|
||||
* All the data and parity blocks marked as bad in the ::id and ::ip vector
|
||||
* All the data and parity blocks marked as bad in the @id and @ip vector
|
||||
* are recovered and recomputed.
|
||||
*
|
||||
* The parities blocks to use for recovering are automatically selected from
|
||||
* the ones NOT present in the ::ip vector.
|
||||
* the ones NOT present in the @ip vector.
|
||||
*
|
||||
* Ensure to have ::nrd + ::nrp <= ::np, otherwise recovering is not possible.
|
||||
* Ensure to have @nrd + @nrp <= @np, otherwise recovering is not possible.
|
||||
*
|
||||
* \param nrd Number of failed data disks to recover.
|
||||
* \param id[] Vector of ::nrd indexes of the data disks to recover.
|
||||
* @nrd Number of failed data blocks to recover.
|
||||
* @id[] Vector of @nrd indexes of the data blocks to recover.
|
||||
* The indexes start from 0. They must be in order.
|
||||
* \param nrp Number of failed parity disks to recover.
|
||||
* \param ip[] Vector of ::nrp indexes of the parity disks to recover.
|
||||
* @nrp Number of failed parity blocks to recover.
|
||||
* @ip[] Vector of @nrp indexes of the parity blocks to recover.
|
||||
* The indexes start from 0. They must be in order.
|
||||
* All the parities not specified here are assumed correct, and they are
|
||||
* not recomputed.
|
||||
* \param nd Number of data disks.
|
||||
* \param np Number of parity disks.
|
||||
* \param size Size of the blocks pointed by ::v. It must be a multipler of 64.
|
||||
* \param v Vector of pointers to the blocks for disks and parities.
|
||||
* It has (::nd + ::np) elements. The first elements are the blocks
|
||||
* @nd Number of data blocks.
|
||||
* @np Number of parity blocks.
|
||||
* @size Size of the blocks pointed by @v. It must be a multipler of 64.
|
||||
* @v Vector of pointers to the blocks of data and parity.
|
||||
* It has (@nd + @np) elements. The starting elements are the blocks
|
||||
* for data, following with the parity blocks.
|
||||
* Each blocks has ::size bytes.
|
||||
* Each blocks has @size bytes.
|
||||
*/
|
||||
void raid_rec(int nrd, const int *id, int nrp, int *ip, int nd, int np, size_t size, void **v);
|
||||
void raid_rec(int nrd, int *id, int nrp, int *ip, int nd, int np, size_t size, void **v);
|
||||
|
||||
/**
|
||||
* Recovers failures of data blocks using the specified parities.
|
||||
*
|
||||
* The data blocks marked as bad in the ::id vector are recovered.
|
||||
* The data blocks marked as bad in the @id vector are recovered.
|
||||
*
|
||||
* If you have provided an additional buffer with raid_waste(), the
|
||||
* parity blocks are not modified. Without this buffer, the content of
|
||||
* parities blocks not specified in the ::ip vector will be destroyed.
|
||||
* parities blocks not specified in the @ip vector will be destroyed.
|
||||
*
|
||||
* \param nr Number of failed data disks to recover.
|
||||
* \param id[] Vector of ::nr indexes of the data disks to recover.
|
||||
* @nr Number of failed data blocks to recover.
|
||||
* @id[] Vector of @nr indexes of the data blocksto recover.
|
||||
* The indexes start from 0. They must be in order.
|
||||
* \param ip[] Vector of ::nr indexes of the parity disks to use for recovering.
|
||||
* @ip[] Vector of @nr indexes of the parity blocks to use for recovering.
|
||||
* The indexes start from 0. They must be in order.
|
||||
* \param nd Number of data disks.
|
||||
* \param size Size of the blocks pointed by ::v. It must be a multipler of 64.
|
||||
* \param v Vector of pointers to the blocks for disks and parities.
|
||||
* It has (::nd + ::ip[::nr - 1] + 1) elements. The first elements are the
|
||||
* @nd Number of data blocks.
|
||||
* @size Size of the blocks pointed by @v. It must be a multipler of 64.
|
||||
* @v Vector of pointers to the blocks of data and parity.
|
||||
* It has (@nd + @ip[@nr - 1] + 1) elements. The starting elements are the
|
||||
* blocks for data, following with the parity blocks.
|
||||
* Each blocks has ::size bytes.
|
||||
* Each blocks has @size bytes.
|
||||
*/
|
||||
void raid_rec_dataonly(int nr, const int *id, const int *ip, int nd, size_t size, void **v);
|
||||
void raid_rec_dataonly(int nr, int *id, int *ip, int nd, size_t size, void **v);
|
||||
|
||||
/**
|
||||
* Sorts a small vector of integers.
|
||||
|
|
@ -152,7 +152,7 @@ void raid_rec_dataonly(int nr, const int *id, const int *ip, int nd, size_t size
|
|||
* If you have block indexes not in order, you can use this function to sort
|
||||
* them before callign raid_rec().
|
||||
*
|
||||
* \param n Number of integers. No more than RAID_PARITY_MAX.
|
||||
* @n Number of integers. No more than RAID_PARITY_MAX.
|
||||
* \paran v Vector of integers.
|
||||
*/
|
||||
void raid_sort(int n, int *v);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue