Refactors again function calls.

This commit is contained in:
Andrea Mazzoleni 2014-01-03 10:36:21 +01:00
parent cae803bdfb
commit 6b619906af
7 changed files with 67 additions and 63 deletions

View file

@ -383,7 +383,7 @@ void raid_par6_int8(int nd, size_t size, void **vv)
*
* Dx = A[ip[0],id[0]]^-1 * Pd
*/
void raid_rec1_int8(int nr, const int *id, const int *ip, int nd, size_t size, void **vv)
void raid_rec1_int8(int nr, int *id, int *ip, int nd, size_t size, void **vv)
{
uint8_t **v = (uint8_t **)vv;
uint8_t *p;
@ -436,7 +436,7 @@ void raid_rec1_int8(int nr, const int *id, const int *ip, int nd, size_t size, v
*
* we solve inverting the coefficients matrix.
*/
void raid_rec2_int8(int nr, const int *id, const int *ip, int nd, size_t size, void **vv)
void raid_rec2_int8(int nr, int *id, int *ip, int nd, size_t size, void **vv)
{
uint8_t **v = (uint8_t **)vv;
uint8_t *p;
@ -504,7 +504,7 @@ void raid_rec2_int8(int nr, const int *id, const int *ip, int nd, size_t size, v
* PD[0] = Pd, PD[1] = Qd, PD[2] = Rd, ...
* D[0] = Dx, D[1] = Dy, D[2] = Dz, ...
*/
void raid_recX_int8(int nr, const int *id, const int *ip, int nd, size_t size, void **vv)
void raid_recX_int8(int nr, int *id, int *ip, int nd, size_t size, void **vv)
{
uint8_t **v = (uint8_t **)vv;
uint8_t *p[RAID_PARITY_MAX];

View file

@ -34,9 +34,9 @@
int raid_selftest(void);
void raid_par_ref(int nd, int np, size_t size, void **vv);
void raid_invert(uint8_t *M, uint8_t *V, int n);
void raid_delta_gen(int nr, const int *id, const int *ip, int nd, size_t size, void **v);
void raid_rec1_par1(const int *id, int nd, size_t size, void **v);
void raid_rec2_par2(const int *id, const int *ip, int nd, size_t size, void **vv);
void raid_delta_gen(int nr, int *id, int *ip, int nd, size_t size, void **v);
void raid_rec1_par1(int *id, int nd, size_t size, void **v);
void raid_rec2_par2(int *id, int *ip, int nd, size_t size, void **vv);
void raid_par1_int32(int nd, size_t size, void **vv);
void raid_par1_int64(int nd, size_t size, void **vv);
void raid_par1_sse2(int nd, size_t size, void **vv);
@ -60,12 +60,12 @@ void raid_par5_ssse3ext(int nd, size_t size, void **vv);
void raid_par6_int8(int nd, size_t size, void **vv);
void raid_par6_ssse3(int nd, size_t size, void **vv);
void raid_par6_ssse3ext(int nd, size_t size, void **vv);
void raid_rec1_int8(int nr, const int *id, const int *ip, int nd, size_t size, void **vv);
void raid_rec2_int8(int nr, const int *id, const int *ip, int nd, size_t size, void **vv);
void raid_recX_int8(int nr, const int *id, const int *ip, int nd, size_t size, void **vv);
void raid_rec1_ssse3(int nr, const int *id, const int *ip, int nd, size_t size, void **vv);
void raid_rec2_ssse3(int nr, const int *id, const int *ip, int nd, size_t size, void **vv);
void raid_recX_ssse3(int nr, const int *id, const int *ip, int nd, size_t size, void **vv);
void raid_rec1_int8(int nr, int *id, int *ip, int nd, size_t size, void **vv);
void raid_rec2_int8(int nr, int *id, int *ip, int nd, size_t size, void **vv);
void raid_recX_int8(int nr, int *id, int *ip, int nd, size_t size, void **vv);
void raid_rec1_ssse3(int nr, int *id, int *ip, int nd, size_t size, void **vv);
void raid_rec2_ssse3(int nr, int *id, int *ip, int nd, size_t size, void **vv);
void raid_recX_ssse3(int nr, int *id, int *ip, int nd, size_t size, void **vv);
/*
* Internal naming.
@ -86,10 +86,12 @@ const char *raid_recX_tag(void);
/*
* Internal forwarders.
*/
extern void (*raid_par_ptr[RAID_PARITY_MAX])(int nd, size_t size, void **vv);
extern void (*raid_par3_ptr)(int nd, size_t size, void **vv);
extern void (*raid_parz_ptr)(int nd, size_t size, void **vv);
extern void (*raid_rec_ptr[RAID_PARITY_MAX])(int nr, const int *id, const int *ip, int nd, size_t size, void **vv);
extern void (*raid_par_ptr[RAID_PARITY_MAX])(
int nd, size_t size, void **vv);
extern void (*raid_rec_ptr[RAID_PARITY_MAX])(
int nr, int *id, int *ip, int nd, size_t size, void **vv);
/*
* Tables.

View file

@ -59,9 +59,9 @@ void *raid_malloc_align(size_t size, void **freeptr);
/**
* Aligned vector allocation.
* Returns a vector of ::n pointers, each one pointing to a block of
* the specified ::size.
* The first ::nd elements are reversed in order.
* Returns a vector of @n pointers, each one pointing to a block of
* the specified @size.
* The first @nd elements are reversed in order.
*/
void **raid_malloc_vector(int nd, int n, size_t size, void **freeptr);

View file

@ -269,7 +269,7 @@ void raid_invert(uint8_t *M, uint8_t *V, int n)
* Note that all the other parities not in the ip[] vector
* are destroyed.
*/
void raid_delta_gen(int nr, const int *id, const int *ip, int nd, size_t size, void **v)
void raid_delta_gen(int nr, int *id, int *ip, int nd, size_t size, void **v)
{
void *p[RAID_PARITY_MAX];
void *pa[RAID_PARITY_MAX];
@ -312,7 +312,7 @@ void raid_delta_gen(int nr, const int *id, const int *ip, int nd, size_t size, v
*
* Dx = Pd
*/
void raid_rec1_par1(const int *id, int nd, size_t size, void **v)
void raid_rec1_par1(int *id, int nd, size_t size, void **v)
{
void *p;
void *pa;
@ -359,7 +359,7 @@ void raid_rec1_par1(const int *id, int nd, size_t size, void **v)
*
* That are always satisfied for any 0<=id[0]<id[1]<255.
*/
void raid_rec2_par2(const int *id, const int *ip, int nd, size_t size, void **vv)
void raid_rec2_par2(int *id, int *ip, int nd, size_t size, void **vv)
{
uint8_t **v = (uint8_t **)vv;
size_t i;
@ -397,9 +397,10 @@ void raid_rec2_par2(const int *id, const int *ip, int nd, size_t size, void **vv
}
/* internal forwarder */
void (*raid_rec_ptr[RAID_PARITY_MAX])(int nr, const int *id, const int *ip, int nd, size_t size, void **vv);
void (*raid_rec_ptr[RAID_PARITY_MAX])(
int nr, int *id, int *ip, int nd, size_t size, void **vv);
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)
{
BUG_ON(nrd > nd);
BUG_ON(nrd + nrp > np);
@ -431,7 +432,7 @@ void raid_rec(int nrd, const int *id, int nrp, int *ip, int nd, int np, size_t s
raid_par(nd, ip[nrp - 1] + 1, size, v);
}
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)
{
BUG_ON(nr > nd);
BUG_ON(size % 64 != 0);

View file

@ -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);

View file

@ -119,7 +119,8 @@ int raid_test_rec(int mode, int nd, size_t size)
int i;
int j;
int nr;
void (*f[RAID_PARITY_MAX][4])(int nr, const int *id, const int *ip, int nd, size_t size, void **vbuf);
void (*f[RAID_PARITY_MAX][4])(
int nr, int *id, int *ip, int nd, size_t size, void **vbuf);
int nf[RAID_PARITY_MAX];
int np;

View file

@ -1322,7 +1322,7 @@ void raid_par6_ssse3ext(int nd, size_t size, void **vv)
/*
* RAID recovering for one disk SSSE3 implementation
*/
void raid_rec1_ssse3(int nr, const int *id, const int *ip, int nd, size_t size, void **vv)
void raid_rec1_ssse3(int nr, int *id, int *ip, int nd, size_t size, void **vv)
{
uint8_t **v = (uint8_t **)vv;
uint8_t *p;
@ -1381,7 +1381,7 @@ void raid_rec1_ssse3(int nr, const int *id, const int *ip, int nd, size_t size,
/*
* RAID recovering for two disks SSSE3 implementation
*/
void raid_rec2_ssse3(int nr, const int *id, const int *ip, int nd, size_t size, void **vv)
void raid_rec2_ssse3(int nr, int *id, int *ip, int nd, size_t size, void **vv)
{
uint8_t **v = (uint8_t **)vv;
const int N = 2;
@ -1487,7 +1487,7 @@ void raid_rec2_ssse3(int nr, const int *id, const int *ip, int nd, size_t size,
/*
* RAID recovering SSSE3 implementation
*/
void raid_recX_ssse3(int nr, const int *id, const int *ip, int nd, size_t size, void **vv)
void raid_recX_ssse3(int nr, int *id, int *ip, int nd, size_t size, void **vv)
{
uint8_t **v = (uint8_t **)vv;
int N = nr;