Move the vbuf argument as last one. No functional change.

This commit is contained in:
Andrea Mazzoleni 2013-12-26 09:28:00 +01:00
parent dd6d73374a
commit 9fa97f04fd
7 changed files with 177 additions and 177 deletions

14
check.c
View file

@ -112,7 +112,7 @@ static int is_hash_matching(struct snapraid_state* state, int rehash, unsigned d
/* if we checked something, and no block failed the check */
if (hash_checked && j==failed_count) {
/* recompute all the redundancy information */
raid_par(state->level, buffer, diskmax, state->block_size);
raid_par(state->level, diskmax, state->block_size, buffer);
return 1;
}
@ -125,12 +125,12 @@ static int is_hash_matching(struct snapraid_state* state, int rehash, unsigned d
static int is_parity_matching(struct snapraid_state* state, unsigned diskmax, unsigned i, unsigned char** buffer, unsigned char** buffer_recov)
{
/* recompute parity, note that we don't need parity over i */
raid_par(i + 1, buffer, diskmax, state->block_size);
raid_par(i + 1, diskmax, state->block_size, buffer);
/* if the recovered parity block matches */
if (memcmp(buffer[diskmax+i], buffer_recov[i], state->block_size) == 0) {
/* recompute all the redundancy information */
raid_par(state->level, buffer, diskmax, state->block_size);
raid_par(state->level, diskmax, state->block_size, buffer);
return 1;
}
@ -153,7 +153,7 @@ static int repair_step(struct snapraid_state* state, int rehash, unsigned pos, u
/* no fix required */
if (failed_count == 0) {
/* recompute only the parity */
raid_par(state->level, buffer, diskmax, state->block_size);
raid_par(state->level, diskmax, state->block_size, buffer);
return 0;
}
@ -199,7 +199,7 @@ static int repair_step(struct snapraid_state* state, int rehash, unsigned pos, u
memcpy(buffer[diskmax+p[i]], buffer_recov[p[i]], state->block_size);
/* recover using one less parity, the p[r-1] one */
raid_rec(r-1, d, p, buffer, diskmax, buffer_zero, state->block_size);
raid_rec(r-1, d, p, diskmax, state->block_size, buffer, buffer_zero);
/* use the remaining p[r-1] parity to check the result */
if (is_parity_matching(state, diskmax, p[r-1], buffer, buffer_recov))
@ -239,7 +239,7 @@ static int repair_step(struct snapraid_state* state, int rehash, unsigned pos, u
memcpy(buffer[diskmax+p[i]], buffer_recov[p[i]], state->block_size);
/* recover */
raid_rec(r, d, p, buffer, diskmax, buffer_zero, state->block_size);
raid_rec(r, d, p, diskmax, state->block_size, buffer, buffer_zero);
/* use the hash to check the result */
if (is_hash_matching(state, rehash, diskmax, failed, failed_map, failed_count, buffer, buffer_zero))
@ -324,7 +324,7 @@ static int repair(struct snapraid_state* state, int rehash, unsigned pos, unsign
/* if nothing to fix */
if (!something_to_recover) {
/* recompute only the parity */
raid_par(state->level, buffer, diskmax, state->block_size);
raid_par(state->level, diskmax, state->block_size, buffer);
return 0;
}

132
raid.c
View file

@ -217,7 +217,7 @@
/*
* PAR1 (RAID5 with xor) 32bit C implementation
*/
void raid_par1_int32(unsigned char** vbuf, unsigned ndata, unsigned size)
void raid_par1_int32(unsigned ndata, unsigned size, unsigned char** vbuf)
{
unsigned char* p;
int d, l;
@ -246,7 +246,7 @@ void raid_par1_int32(unsigned char** vbuf, unsigned ndata, unsigned size)
/*
* PAR1 (RAID5 with xor) 64bit C implementation
*/
void raid_par1_int64(unsigned char** vbuf, unsigned ndata, unsigned size)
void raid_par1_int64(unsigned ndata, unsigned size, unsigned char** vbuf)
{
unsigned char* p;
int d, l;
@ -281,7 +281,7 @@ void raid_par1_int64(unsigned char** vbuf, unsigned ndata, unsigned size)
* the typical cache block, and processing 128 bytes doesn't increase
* performance.
*/
void raid_par1_sse2(unsigned char** vbuf, unsigned ndata, unsigned size)
void raid_par1_sse2(unsigned ndata, unsigned size, unsigned char** vbuf)
{
unsigned char* p;
int d, l;
@ -372,7 +372,7 @@ static inline uint64_t d2_64(uint64_t v)
/*
* PAR2 (RAID6 with powers of 2) 32bit C implementation
*/
void raid_par2_int32(unsigned char** vbuf, unsigned ndata, unsigned size)
void raid_par2_int32(unsigned ndata, unsigned size, unsigned char** vbuf)
{
unsigned char* p;
unsigned char* q;
@ -412,7 +412,7 @@ void raid_par2_int32(unsigned char** vbuf, unsigned ndata, unsigned size)
/*
* PAR2 (RAID6 with powers of 2) 64bit C implementation
*/
void raid_par2_int64(unsigned char** vbuf, unsigned ndata, unsigned size)
void raid_par2_int64(unsigned ndata, unsigned size, unsigned char** vbuf)
{
unsigned char* p;
unsigned char* q;
@ -465,7 +465,7 @@ static const struct gfconst16 {
/*
* PAR2 (RAID6 with powers of 2) SSE2 implementation
*/
void raid_par2_sse2(unsigned char** vbuf, unsigned ndata, unsigned size)
void raid_par2_sse2(unsigned ndata, unsigned size, unsigned char** vbuf)
{
unsigned char* p;
unsigned char* q;
@ -518,7 +518,7 @@ void raid_par2_sse2(unsigned char** vbuf, unsigned ndata, unsigned size)
*
* Note that it uses 16 registers, meaning that x64 is required.
*/
void raid_par2_sse2ext(unsigned char** vbuf, unsigned ndata, unsigned size)
void raid_par2_sse2ext(unsigned ndata, unsigned size, unsigned char** vbuf)
{
unsigned char* p;
unsigned char* q;
@ -592,7 +592,7 @@ void raid_par2_sse2ext(unsigned char** vbuf, unsigned ndata, unsigned size)
/*
* PARz (triple parity with powers of 2^-1) 32bit C implementation
*/
void raid_parz_int32(unsigned char** vbuf, unsigned ndata, unsigned size)
void raid_parz_int32(unsigned ndata, unsigned size, unsigned char** vbuf)
{
unsigned char* p;
unsigned char* q;
@ -642,7 +642,7 @@ void raid_parz_int32(unsigned char** vbuf, unsigned ndata, unsigned size)
/*
* PARz (triple parity with powers of 2^-1) 64bit C implementation
*/
void raid_parz_int64(unsigned char** vbuf, unsigned ndata, unsigned size)
void raid_parz_int64(unsigned ndata, unsigned size, unsigned char** vbuf)
{
unsigned char* p;
unsigned char* q;
@ -693,7 +693,7 @@ void raid_parz_int64(unsigned char** vbuf, unsigned ndata, unsigned size)
/*
* PARz (triple parity with powers of 2^-1) SSE2 implementation
*/
void raid_parz_sse2(unsigned char** vbuf, unsigned ndata, unsigned size)
void raid_parz_sse2(unsigned ndata, unsigned size, unsigned char** vbuf)
{
unsigned char* p;
unsigned char* q;
@ -750,7 +750,7 @@ void raid_parz_sse2(unsigned char** vbuf, unsigned ndata, unsigned size)
*
* Note that it uses 16 registers, meaning that x64 is required.
*/
void raid_parz_sse2ext(unsigned char** vbuf, unsigned ndata, unsigned size)
void raid_parz_sse2ext(unsigned ndata, unsigned size, unsigned char** vbuf)
{
unsigned char* p;
unsigned char* q;
@ -831,7 +831,7 @@ void raid_parz_sse2ext(unsigned char** vbuf, unsigned ndata, unsigned size)
* But this is only a kind of reference function, and we are not really
* interested in speed.
*/
void raid_par3_int8(unsigned char** vbuf, unsigned ndata, unsigned size)
void raid_par3_int8(unsigned ndata, unsigned size, unsigned char** vbuf)
{
unsigned char* p;
unsigned char* q;
@ -873,7 +873,7 @@ void raid_par3_int8(unsigned char** vbuf, unsigned ndata, unsigned size)
/*
* PAR3 (triple parity with Cauchy matrix) SSSE3 implementation
*/
void raid_par3_ssse3(unsigned char** vbuf, unsigned ndata, unsigned size)
void raid_par3_ssse3(unsigned ndata, unsigned size, unsigned char** vbuf)
{
unsigned char* p;
unsigned char* q;
@ -969,7 +969,7 @@ void raid_par3_ssse3(unsigned char** vbuf, unsigned ndata, unsigned size)
*
* Note that it uses 16 registers, meaning that x64 is required.
*/
void raid_par3_ssse3ext(unsigned char** vbuf, unsigned ndata, unsigned size)
void raid_par3_ssse3ext(unsigned ndata, unsigned size, unsigned char** vbuf)
{
unsigned char* p;
unsigned char* q;
@ -1109,7 +1109,7 @@ void raid_par3_ssse3ext(unsigned char** vbuf, unsigned ndata, unsigned size)
* But this is only a kind of reference function, and we are not really
* interested in speed.
*/
void raid_par4_int8(unsigned char** vbuf, unsigned ndata, unsigned size)
void raid_par4_int8(unsigned ndata, unsigned size, unsigned char** vbuf)
{
unsigned char* p;
unsigned char* q;
@ -1156,7 +1156,7 @@ void raid_par4_int8(unsigned char** vbuf, unsigned ndata, unsigned size)
/*
* PAR4 (quad parity with Cauchy matrix) SSSE3 implementation
*/
void raid_par4_ssse3(unsigned char** vbuf, unsigned ndata, unsigned size)
void raid_par4_ssse3(unsigned ndata, unsigned size, unsigned char** vbuf)
{
unsigned char* p;
unsigned char* q;
@ -1271,7 +1271,7 @@ void raid_par4_ssse3(unsigned char** vbuf, unsigned ndata, unsigned size)
*
* Note that it uses 16 registers, meaning that x64 is required.
*/
void raid_par4_ssse3ext(unsigned char** vbuf, unsigned ndata, unsigned size)
void raid_par4_ssse3ext(unsigned ndata, unsigned size, unsigned char** vbuf)
{
unsigned char* p;
unsigned char* q;
@ -1443,7 +1443,7 @@ void raid_par4_ssse3ext(unsigned char** vbuf, unsigned ndata, unsigned size)
* But this is only a kind of reference function, and we are not really
* interested in speed.
*/
void raid_par5_int8(unsigned char** vbuf, unsigned ndata, unsigned size)
void raid_par5_int8(unsigned ndata, unsigned size, unsigned char** vbuf)
{
unsigned char* p;
unsigned char* q;
@ -1499,7 +1499,7 @@ void raid_par5_int8(unsigned char** vbuf, unsigned ndata, unsigned size)
/* ensures that stack is aligned at 16 bytes because we allocate SSE registers in it */
__attribute__((force_align_arg_pointer))
#endif
void raid_par5_ssse3(unsigned char** vbuf, unsigned ndata, unsigned size)
void raid_par5_ssse3(unsigned ndata, unsigned size, unsigned char** vbuf)
/* ensures that stack is aligned at 16 bytes because we allocate SSE registers in it */
{
unsigned char* p;
@ -1635,7 +1635,7 @@ void raid_par5_ssse3(unsigned char** vbuf, unsigned ndata, unsigned size)
*
* Note that it uses 16 registers, meaning that x64 is required.
*/
void raid_par5_ssse3ext(unsigned char** vbuf, unsigned ndata, unsigned size)
void raid_par5_ssse3ext(unsigned ndata, unsigned size, unsigned char** vbuf)
{
unsigned char* p;
unsigned char* q;
@ -1767,7 +1767,7 @@ void raid_par5_ssse3ext(unsigned char** vbuf, unsigned ndata, unsigned size)
* But this is only a kind of reference function, and we are not really
* interested in speed.
*/
void raid_par6_int8(unsigned char** vbuf, unsigned ndata, unsigned size)
void raid_par6_int8(unsigned ndata, unsigned size, unsigned char** vbuf)
{
unsigned char* p;
unsigned char* q;
@ -1828,7 +1828,7 @@ void raid_par6_int8(unsigned char** vbuf, unsigned ndata, unsigned size)
/* ensures that stack is aligned at 16 bytes because we allocate SSE registers in it */
__attribute__((force_align_arg_pointer))
#endif
void raid_par6_ssse3(unsigned char** vbuf, unsigned ndata, unsigned size)
void raid_par6_ssse3(unsigned ndata, unsigned size, unsigned char** vbuf)
{
unsigned char* p;
unsigned char* q;
@ -1985,7 +1985,7 @@ void raid_par6_ssse3(unsigned char** vbuf, unsigned ndata, unsigned size)
*
* Note that it uses 16 registers, meaning that x64 is required.
*/
void raid_par6_ssse3ext(unsigned char** vbuf, unsigned ndata, unsigned size)
void raid_par6_ssse3ext(unsigned ndata, unsigned size, unsigned char** vbuf)
{
unsigned char* p;
unsigned char* q;
@ -2140,28 +2140,28 @@ void raid_set(unsigned mode)
/* parity generation */
/* internal forwarder */
static void (*raid_par1_ptr)(unsigned char** vbuf, unsigned ndata, unsigned size);
static void (*raid_par2_ptr)(unsigned char** vbuf, unsigned ndata, unsigned size);
static void (*raid_parz_ptr)(unsigned char** vbuf, unsigned ndata, unsigned size);
static void (*raid_par3_ptr)(unsigned char** vbuf, unsigned ndata, unsigned size);
static void (*raid_par4_ptr)(unsigned char** vbuf, unsigned ndata, unsigned size);
static void (*raid_par5_ptr)(unsigned char** vbuf, unsigned ndata, unsigned size);
static void (*raid_par6_ptr)(unsigned char** vbuf, unsigned ndata, unsigned size);
static void (*raid_par1_ptr)(unsigned ndata, unsigned size, unsigned char** vbuf);
static void (*raid_par2_ptr)(unsigned ndata, unsigned size, unsigned char** vbuf);
static void (*raid_parz_ptr)(unsigned ndata, unsigned size, unsigned char** vbuf);
static void (*raid_par3_ptr)(unsigned ndata, unsigned size, unsigned char** vbuf);
static void (*raid_par4_ptr)(unsigned ndata, unsigned size, unsigned char** vbuf);
static void (*raid_par5_ptr)(unsigned ndata, unsigned size, unsigned char** vbuf);
static void (*raid_par6_ptr)(unsigned ndata, unsigned size, unsigned char** vbuf);
void raid_par(unsigned npar, unsigned char** vbuf, unsigned ndata, unsigned size)
void raid_par(unsigned npar, unsigned ndata, unsigned size, unsigned char** vbuf)
{
switch (npar) {
case 1 : raid_par1_ptr(vbuf, ndata, size); break;
case 2 : raid_par2_ptr(vbuf, ndata, size); break;
case 1 : raid_par1_ptr(ndata, size, vbuf); break;
case 2 : raid_par2_ptr(ndata, size, vbuf); break;
case 3 :
if (raid_mode == RAID_MODE_CAUCHY)
raid_par3_ptr(vbuf, ndata, size);
raid_par3_ptr(ndata, size, vbuf);
else
raid_parz_ptr(vbuf, ndata, size);
raid_parz_ptr(ndata, size, vbuf);
break;
case 4 : raid_par4_ptr(vbuf, ndata, size); break;
case 5 : raid_par5_ptr(vbuf, ndata, size); break;
case 6 : raid_par6_ptr(vbuf, ndata, size); break;
case 4 : raid_par4_ptr(ndata, size, vbuf); break;
case 5 : raid_par5_ptr(ndata, size, vbuf); break;
case 6 : raid_par6_ptr(ndata, size, vbuf); break;
default:
fprintf(stderr, "Invalid raid gen level\n");
exit(EXIT_FAILURE);
@ -2228,7 +2228,7 @@ static inline const unsigned char* table(unsigned char v)
* Note that all the other parities not in the c[] vector
* are destroyed.
*/
static inline void raid_delta_gen(unsigned nrec, const int* d, const int* c, unsigned char** vbuf, unsigned ndata, unsigned char* zero, unsigned size)
static inline void raid_delta_gen(unsigned nrec, const int* d, const int* c, unsigned ndata, unsigned size, unsigned char** vbuf, unsigned char* zero)
{
unsigned char* p[RAID_PARITY_CAUCHY_MAX];
unsigned char* pa[RAID_PARITY_CAUCHY_MAX];
@ -2251,7 +2251,7 @@ static inline void raid_delta_gen(unsigned nrec, const int* d, const int* c, uns
}
/* compute only for the nrec we really need */
raid_par(c[nrec - 1] + 1, vbuf, ndata, size);
raid_par(c[nrec - 1] + 1, ndata, size, vbuf);
for(i=0;i<nrec;++i) {
/* restore disk buffers as before */
@ -2276,7 +2276,7 @@ static inline void raid_delta_gen(unsigned nrec, const int* d, const int* c, uns
*
* Dx = Pd
*/
static void raid_rec1_par1(const int* d, unsigned char** vbuf, unsigned ndata, unsigned size)
static void raid_rec1_par1(const int* d, unsigned ndata, unsigned size, unsigned char** vbuf)
{
unsigned char* p;
unsigned char* pa;
@ -2293,7 +2293,7 @@ static void raid_rec1_par1(const int* d, unsigned char** vbuf, unsigned ndata, u
vbuf[ndata] = pa;
/* compute */
raid_par1_ptr(vbuf, ndata, size);
raid_par1_ptr(ndata, size, vbuf);
/* restore as before */
vbuf[d[0]] = pa;
@ -2323,7 +2323,7 @@ static void raid_rec1_par1(const int* d, unsigned char** vbuf, unsigned ndata, u
*
* That are always satisfied for any 0<=d[0]<d[1]<255.
*/
static void raid_rec2_par2(const int* d, const int* c, unsigned char** vbuf, unsigned ndata, unsigned char* zero, unsigned size)
static void raid_rec2_par2(const int* d, const int* c, unsigned ndata, unsigned size, unsigned char** vbuf, unsigned char* zero)
{
unsigned i;
unsigned char* p;
@ -2337,7 +2337,7 @@ static void raid_rec2_par2(const int* d, const int* c, unsigned char** vbuf, uns
T[1] = table( inv(pow2(d[0]) ^ pow2(d[1])) );
/* compute delta parity */
raid_delta_gen(2, d, c, vbuf, ndata, zero, size);
raid_delta_gen(2, d, c, ndata, size, vbuf, zero);
p = vbuf[ndata];
q = vbuf[ndata+1];
@ -2444,7 +2444,7 @@ static inline void invert(unsigned char* M, unsigned char* V, unsigned n)
*
* Dx = A[c[0],d[0]]^-1 * Pd
*/
void raid_rec1_int8(unsigned nrec, const int* d, const int* c, unsigned char** vbuf, unsigned ndata, unsigned char* zero, unsigned size)
void raid_rec1_int8(unsigned nrec, const int* d, const int* c, unsigned ndata, unsigned size, unsigned char** vbuf, unsigned char* zero)
{
unsigned i;
unsigned char* p;
@ -2457,7 +2457,7 @@ void raid_rec1_int8(unsigned nrec, const int* d, const int* c, unsigned char** v
/* if it's PAR1 uses the dedicated and fastest function */
if (c[0] == 0) {
raid_rec1_par1(d, vbuf, ndata, size);
raid_rec1_par1(d, ndata, size, vbuf);
return;
}
@ -2471,7 +2471,7 @@ void raid_rec1_int8(unsigned nrec, const int* d, const int* c, unsigned char** v
T = table(V);
/* compute delta parity */
raid_delta_gen(1, d, c, vbuf, ndata, zero, size);
raid_delta_gen(1, d, c, ndata, size, vbuf, zero);
p = vbuf[ndata+c[0]];
pa = vbuf[d[0]];
@ -2495,7 +2495,7 @@ void raid_rec1_int8(unsigned nrec, const int* d, const int* c, unsigned char** v
*
* we solve inverting the coefficients matrix.
*/
void raid_rec2_int8(unsigned nrec, const int* d, const int* c, unsigned char** vbuf, unsigned ndata, unsigned char* zero, unsigned size)
void raid_rec2_int8(unsigned nrec, const int* d, const int* c, unsigned ndata, unsigned size, unsigned char** vbuf, unsigned char* zero)
{
unsigned char* p;
unsigned char* pa;
@ -2511,7 +2511,7 @@ void raid_rec2_int8(unsigned nrec, const int* d, const int* c, unsigned char** v
/* if it's PAR2 uses the dedicated and fastest function */
if (c[0] == 0 && c[1] == 1) {
raid_rec2_par2(d, c, vbuf, ndata, zero, size);
raid_rec2_par2(d, c, ndata, size, vbuf, zero);
return;
}
@ -2533,7 +2533,7 @@ void raid_rec2_int8(unsigned nrec, const int* d, const int* c, unsigned char** v
}
/* compute delta parity */
raid_delta_gen(2, d, c, vbuf, ndata, zero, size);
raid_delta_gen(2, d, c, ndata, size, vbuf, zero);
p = vbuf[ndata+c[0]];
q = vbuf[ndata+c[1]];
@ -2564,7 +2564,7 @@ void raid_rec2_int8(unsigned nrec, const int* d, const int* c, unsigned char** v
* PD[0] = Pd, PD[1] = Qd, PD[2] = Rd, ...
* D[0] = Dx, D[1] = Dy, D[2] = Dz, ...
*/
void raid_recX_int8(unsigned nrec, const int* d, const int* c, unsigned char** vbuf, unsigned ndata, unsigned char* zero, unsigned size)
void raid_recX_int8(unsigned nrec, const int* d, const int* c, unsigned ndata, unsigned size, unsigned char** vbuf, unsigned char* zero)
{
unsigned char* p[RAID_PARITY_CAUCHY_MAX];
unsigned char* pa[RAID_PARITY_CAUCHY_MAX];
@ -2591,7 +2591,7 @@ void raid_recX_int8(unsigned nrec, const int* d, const int* c, unsigned char** v
}
/* compute delta parity */
raid_delta_gen(nrec, d, c, vbuf, ndata, zero, size);
raid_delta_gen(nrec, d, c, ndata, size, vbuf, zero);
for(i=0;i<nrec;++i) {
p[i] = vbuf[ndata+c[i]];
@ -2619,7 +2619,7 @@ void raid_recX_int8(unsigned nrec, const int* d, const int* c, unsigned char** v
/*
* RAID recovering for one disk SSSE3 implementation
*/
void raid_rec1_ssse3(unsigned nrec, const int* d, const int* c, unsigned char** vbuf, unsigned ndata, unsigned char* zero, unsigned size)
void raid_rec1_ssse3(unsigned nrec, const int* d, const int* c, unsigned ndata, unsigned size, unsigned char** vbuf, unsigned char* zero)
{
unsigned char* p;
unsigned char* pa;
@ -2631,7 +2631,7 @@ void raid_rec1_ssse3(unsigned nrec, const int* d, const int* c, unsigned char**
/* if it's PAR1 uses the dedicated and fastest function */
if (c[0] == 0) {
raid_rec1_par1(d, vbuf, ndata, size);
raid_rec1_par1(d, ndata, size, vbuf);
return;
}
@ -2642,7 +2642,7 @@ void raid_rec1_ssse3(unsigned nrec, const int* d, const int* c, unsigned char**
V = inv(G);
/* compute delta parity */
raid_delta_gen(1, d, c, vbuf, ndata, zero, size);
raid_delta_gen(1, d, c, ndata, size, vbuf, zero);
p = vbuf[ndata+c[0]];
pa = vbuf[d[0]];
@ -2675,7 +2675,7 @@ void raid_rec1_ssse3(unsigned nrec, const int* d, const int* c, unsigned char**
/*
* RAID recovering for two disks SSSE3 implementation
*/
void raid_rec2_ssse3(unsigned nrec, const int* d, const int* c, unsigned char** vbuf, unsigned ndata, unsigned char* zero, unsigned size)
void raid_rec2_ssse3(unsigned nrec, const int* d, const int* c, unsigned ndata, unsigned size, unsigned char** vbuf, unsigned char* zero)
{
const unsigned N = 2;
unsigned char* p[N];
@ -2697,7 +2697,7 @@ void raid_rec2_ssse3(unsigned nrec, const int* d, const int* c, unsigned char**
invert(G, V, N);
/* compute delta parity */
raid_delta_gen(N, d, c, vbuf, ndata, zero, size);
raid_delta_gen(N, d, c, ndata, size, vbuf, zero);
for(i=0;i<N;++i) {
p[i] = vbuf[ndata+c[i]];
@ -2779,7 +2779,7 @@ void raid_rec2_ssse3(unsigned nrec, const int* d, const int* c, unsigned char**
/*
* RAID recovering SSSE3 implementation
*/
void raid_recX_ssse3(unsigned nrec, const int* d, const int* c, unsigned char** vbuf, unsigned ndata, unsigned char* zero, unsigned size)
void raid_recX_ssse3(unsigned nrec, const int* d, const int* c, unsigned ndata, unsigned size, unsigned char** vbuf, unsigned char* zero)
{
unsigned N = nrec;
unsigned char* p[RAID_PARITY_CAUCHY_MAX];
@ -2799,7 +2799,7 @@ void raid_recX_ssse3(unsigned nrec, const int* d, const int* c, unsigned char**
invert(G, V, N);
/* compute delta parity */
raid_delta_gen(N, d, c, vbuf, ndata, zero, size);
raid_delta_gen(N, d, c, ndata, size, vbuf, zero);
for(i=0;i<N;++i) {
p[i] = vbuf[ndata+c[i]];
@ -2851,24 +2851,24 @@ void raid_recX_ssse3(unsigned nrec, const int* d, const int* c, unsigned char**
#endif
/* internal forwarder */
static void (*raid_rec1_ptr)(unsigned nrec, const int* d, const int* c, unsigned char** vbuf, unsigned ndata, unsigned char* zero, unsigned size);
static void (*raid_rec2_ptr)(unsigned nrec, const int* d, const int* c, unsigned char** vbuf, unsigned ndata, unsigned char* zero, unsigned size);
static void (*raid_recX_ptr)(unsigned nrec, const int* d, const int* c, unsigned char** vbuf, unsigned ndata, unsigned char* zero, unsigned size);
static void (*raid_rec1_ptr)(unsigned nrec, const int* d, const int* c, unsigned ndata, unsigned size, unsigned char** vbuf, unsigned char* zero);
static void (*raid_rec2_ptr)(unsigned nrec, const int* d, const int* c, unsigned ndata, unsigned size, unsigned char** vbuf, unsigned char* zero);
static void (*raid_recX_ptr)(unsigned nrec, const int* d, const int* c, unsigned ndata, unsigned size, unsigned char** vbuf, unsigned char* zero);
void raid_rec(unsigned nrec, const int* d, const int* c, unsigned char** vbuf, unsigned ndata, unsigned char* zero, unsigned size)
void raid_rec(unsigned nrec, const int* d, const int* c, unsigned ndata, unsigned size, unsigned char** vbuf, unsigned char* zero)
{
switch (nrec) {
case 1 :
raid_rec1_ptr(nrec, d, c, vbuf, ndata, zero, size);
raid_rec1_ptr(nrec, d, c, ndata, size, vbuf, zero);
break;
case 2 :
raid_rec2_ptr(nrec, d, c, vbuf, ndata, zero, size);
raid_rec2_ptr(nrec, d, c, ndata, size, vbuf, zero);
break;
case 3 :
case 4 :
case 5 :
case 6 :
raid_recX_ptr(nrec, d, c, vbuf, ndata, zero, size);
raid_recX_ptr(nrec, d, c, ndata, size, vbuf, zero);
break;
default:
fprintf(stderr, "Invalid raid recov level\n");

72
raid.h
View file

@ -74,12 +74,12 @@ void raid_set(unsigned mode);
* Computes the parity.
*
* \param npar Number of parities to compute.
* \param vbuf Vector of pointers to the blocks for disks and parities.
* It has (::ndata + ::npar) elements. Each element points to a buffer of ::size bytes.
* \param ndata Number of data disks.
* \param size Size of the blocks pointed by vbuf. It must be a power of 2, and at least 64.
* \param vbuf Vector of pointers to the blocks for disks and parities.
* It has (::ndata + ::npar) elements. Each element points to a buffer of ::size bytes.
*/
void raid_par(unsigned npar, unsigned char** vbuf, unsigned ndata, unsigned size);
void raid_par(unsigned npar, unsigned ndata, unsigned size, unsigned char** vbuf);
/**
* Recovers failures of data disks using the specified parities.
@ -88,13 +88,13 @@ void raid_par(unsigned npar, unsigned char** vbuf, unsigned ndata, unsigned size
* \param nrec Number of failed disks to recover.
* \param d[] Vector of indexes of the data disks to recover. Starting from 0.
* \param c[] Vector of indexes of the checksum/parity to use for the recovering. Starting from 0.
* \param ndata Number of data disks.
* \param size Size of the blocks pointed by vbuf. It must be a power of 2, and at least 64.
* \param vbuf Vector of pointers to the blocks for disks and parities.
* It has (::ndata + max(::c[] + 1)) elements. Each element points to a buffer of ::size bytes.
* \param ndata Number of data disks.
* \param zero Buffer filled with 0 of ::size bytes. This buffer is not modified.
* \param size Size of the blocks pointed by vbuf. It must be a power of 2, and at least 64.
* \param zero Buffer filled with 0 of ::size bytes. This buffer is not modified.
*/
void raid_rec(unsigned nrec, const int* d, const int* c, unsigned char** vbuf, unsigned ndata, unsigned char* zero, unsigned size);
void raid_rec(unsigned nrec, const int* d, const int* c, unsigned ndata, unsigned size, unsigned char** vbuf, unsigned char* zero);
/**
* Gets the name of the selected function to compute the parity.
@ -115,34 +115,34 @@ const char* raid_recX_tag(void);
* Specialized parity computation.
* Only for testing.
*/
void raid_par1_int32(unsigned char** vbuf, unsigned ndata, unsigned size);
void raid_par1_int64(unsigned char** vbuf, unsigned ndata, unsigned size);
void raid_par1_sse2(unsigned char** vbuf, unsigned ndata, unsigned size);
void raid_par2_int32(unsigned char** vbuf, unsigned ndata, unsigned size);
void raid_par2_int64(unsigned char** vbuf, unsigned ndata, unsigned size);
void raid_par2_sse2(unsigned char** vbuf, unsigned ndata, unsigned size);
void raid_par2_sse2ext(unsigned char** vbuf, unsigned ndata, unsigned size);
void raid_parz_int32(unsigned char** vbuf, unsigned ndata, unsigned size);
void raid_parz_int64(unsigned char** vbuf, unsigned ndata, unsigned size);
void raid_parz_sse2(unsigned char** vbuf, unsigned ndata, unsigned size);
void raid_parz_sse2ext(unsigned char** vbuf, unsigned ndata, unsigned size);
void raid_par3_int8(unsigned char** vbuf, unsigned ndata, unsigned size);
void raid_par3_ssse3(unsigned char** vbuf, unsigned ndata, unsigned size);
void raid_par3_ssse3ext(unsigned char** vbuf, unsigned ndata, unsigned size);
void raid_par4_int8(unsigned char** vbuf, unsigned ndata, unsigned size);
void raid_par4_ssse3(unsigned char** vbuf, unsigned ndata, unsigned size);
void raid_par4_ssse3ext(unsigned char** vbuf, unsigned ndata, unsigned size);
void raid_par5_int8(unsigned char** vbuf, unsigned ndata, unsigned size);
void raid_par5_ssse3(unsigned char** vbuf, unsigned ndata, unsigned size);
void raid_par5_ssse3ext(unsigned char** vbuf, unsigned ndata, unsigned size);
void raid_par6_int8(unsigned char** vbuf, unsigned ndata, unsigned size);
void raid_par6_ssse3(unsigned char** vbuf, unsigned ndata, unsigned size);
void raid_par6_ssse3ext(unsigned char** vbuf, unsigned ndata, unsigned size);
void raid_rec1_int8(unsigned nrec, const int* d, const int* c, unsigned char** vbuf, unsigned ndata, unsigned char* zero, unsigned size);
void raid_rec2_int8(unsigned nrec, const int* d, const int* c, unsigned char** vbuf, unsigned ndata, unsigned char* zero, unsigned size);
void raid_recX_int8(unsigned nrec, const int* d, const int* c, unsigned char** vbuf, unsigned ndata, unsigned char* zero, unsigned size);
void raid_rec1_ssse3(unsigned nrec, const int* d, const int* c, unsigned char** vbuf, unsigned ndata, unsigned char* zero, unsigned size);
void raid_rec2_ssse3(unsigned nrec, const int* d, const int* c, unsigned char** vbuf, unsigned ndata, unsigned char* zero, unsigned size);
void raid_recX_ssse3(unsigned nrec, const int* d, const int* c, unsigned char** vbuf, unsigned ndata, unsigned char* zero, unsigned size);
void raid_par1_int32(unsigned ndata, unsigned size, unsigned char** vbuf);
void raid_par1_int64(unsigned ndata, unsigned size, unsigned char** vbuf);
void raid_par1_sse2(unsigned ndata, unsigned size, unsigned char** vbuf);
void raid_par2_int32(unsigned ndata, unsigned size, unsigned char** vbuf);
void raid_par2_int64(unsigned ndata, unsigned size, unsigned char** vbuf);
void raid_par2_sse2(unsigned ndata, unsigned size, unsigned char** vbuf);
void raid_par2_sse2ext(unsigned ndata, unsigned size, unsigned char** vbuf);
void raid_parz_int32(unsigned ndata, unsigned size, unsigned char** vbuf);
void raid_parz_int64(unsigned ndata, unsigned size, unsigned char** vbuf);
void raid_parz_sse2(unsigned ndata, unsigned size, unsigned char** vbuf);
void raid_parz_sse2ext(unsigned ndata, unsigned size, unsigned char** vbuf);
void raid_par3_int8(unsigned ndata, unsigned size, unsigned char** vbuf);
void raid_par3_ssse3(unsigned ndata, unsigned size, unsigned char** vbuf);
void raid_par3_ssse3ext(unsigned ndata, unsigned size, unsigned char** vbuf);
void raid_par4_int8(unsigned ndata, unsigned size, unsigned char** vbuf);
void raid_par4_ssse3(unsigned ndata, unsigned size, unsigned char** vbuf);
void raid_par4_ssse3ext(unsigned ndata, unsigned size, unsigned char** vbuf);
void raid_par5_int8(unsigned ndata, unsigned size, unsigned char** vbuf);
void raid_par5_ssse3(unsigned ndata, unsigned size, unsigned char** vbuf);
void raid_par5_ssse3ext(unsigned ndata, unsigned size, unsigned char** vbuf);
void raid_par6_int8(unsigned ndata, unsigned size, unsigned char** vbuf);
void raid_par6_ssse3(unsigned ndata, unsigned size, unsigned char** vbuf);
void raid_par6_ssse3ext(unsigned ndata, unsigned size, unsigned char** vbuf);
void raid_rec1_int8(unsigned nrec, const int* d, const int* c, unsigned ndata, unsigned size, unsigned char** vbuf, unsigned char* zero);
void raid_rec2_int8(unsigned nrec, const int* d, const int* c, unsigned ndata, unsigned size, unsigned char** vbuf, unsigned char* zero);
void raid_recX_int8(unsigned nrec, const int* d, const int* c, unsigned ndata, unsigned size, unsigned char** vbuf, unsigned char* zero);
void raid_rec1_ssse3(unsigned nrec, const int* d, const int* c, unsigned ndata, unsigned size, unsigned char** vbuf, unsigned char* zero);
void raid_rec2_ssse3(unsigned nrec, const int* d, const int* c, unsigned ndata, unsigned size, unsigned char** vbuf, unsigned char* zero);
void raid_recX_ssse3(unsigned nrec, const int* d, const int* c, unsigned ndata, unsigned size, unsigned char** vbuf, unsigned char* zero);
#endif

View file

@ -321,7 +321,7 @@ static int state_scrub_process(struct snapraid_state* state, struct snapraid_par
}
/* compute the parity */
raid_par(state->level, buffer, diskmax, state->block_size);
raid_par(state->level, diskmax, state->block_size, buffer);
/* compare the parity */
for(l=0;l<state->level;++l) {

View file

@ -93,30 +93,30 @@ static void recovtest(unsigned mode, unsigned ndata, unsigned block_size)
unsigned char* waste;
unsigned buffermax;
int d[LEV_MAX];
int p[LEV_MAX];
int c[LEV_MAX];
unsigned i;
unsigned j;
unsigned r;
void (*map[LEV_MAX][4])(unsigned level, const int* d, const int* c, unsigned char** vbuf, unsigned data, unsigned char* zero, unsigned size);
unsigned mac[LEV_MAX];
unsigned nrec;
void (*map[LEV_MAX][4])(unsigned nrec, const int* d, const int* c, unsigned ndata, unsigned size, unsigned char** vbuf, unsigned char* zero);
unsigned mac[LEV_MAX];
unsigned npar;
raid_set(mode);
if (mode == RAID_MODE_CAUCHY)
nrec = RAID_PARITY_CAUCHY_MAX;
npar = RAID_PARITY_CAUCHY_MAX;
else
nrec = RAID_PARITY_VANDERMONDE_MAX;
npar = RAID_PARITY_VANDERMONDE_MAX;
buffermax = ndata + nrec * 2 + 2;
buffermax = ndata + npar * 2 + 2;
buffer = malloc_nofail_vector_align(ndata, buffermax, block_size, &buffer_alloc);
mtest_vector(buffer, buffermax, block_size);
data = buffer;
parity = buffer + ndata;
test = buffer + ndata + nrec;
test = buffer + ndata + npar;
for(i=0;i<nrec;++i)
for(i=0;i<npar;++i)
parity_save[i] = parity[i];
zero = buffer[buffermax-2];
@ -131,7 +131,7 @@ static void recovtest(unsigned mode, unsigned ndata, unsigned block_size)
}
/* setup recov functions */
for(i=0;i<nrec;++i) {
for(i=0;i<npar;++i) {
mac[i] = 0;
if (i == 0) {
map[i][mac[i]++] = raid_rec1_int8;
@ -158,36 +158,36 @@ static void recovtest(unsigned mode, unsigned ndata, unsigned block_size)
}
/* compute the parity */
raid_par(nrec, buffer, ndata, block_size);
raid_par(npar, ndata, block_size, buffer);
/* set all the parity to the waste buffer */
for(i=0;i<nrec;++i)
for(i=0;i<npar;++i)
parity[i] = waste;
/* all parity levels */
for(r=1;r<=nrec;++r) {
/* all combinations (r of ndata) disks */
combination_first(r, ndata, d);
for(nrec=1;nrec<=npar;++nrec) {
/* all combinations (nrec of ndata) disks */
combination_first(nrec, ndata, d);
do {
/* all combinations (r of nrec) parities */
combination_first(r, nrec, p);
/* all combinations (nrec of npar) parities */
combination_first(nrec, npar, c);
do {
/* for each recover function */
for(j=0;j<mac[r-1];++j) {
for(j=0;j<mac[nrec-1];++j) {
/* set */
for(i=0;i<r;++i) {
for(i=0;i<nrec;++i) {
/* remove the missing data */
data_save[i] = data[d[i]];
data[d[i]] = test[i];
/* set the parity to use */
parity[p[i]] = parity_save[p[i]];
parity[c[i]] = parity_save[c[i]];
}
/* recover */
map[r-1][0](r, d, p, buffer, ndata, zero, block_size);
map[nrec-1][0](nrec, d, c, ndata, block_size, buffer, zero);
/* check */
for(i=0;i<r;++i) {
for(i=0;i<nrec;++i) {
if (memcmp(test[i], data_save[i], block_size) != 0) {
fprintf(stderr, "Failed RECOV test\n");
exit(EXIT_FAILURE);
@ -195,15 +195,15 @@ static void recovtest(unsigned mode, unsigned ndata, unsigned block_size)
}
/* restore */
for(i=0;i<r;++i) {
for(i=0;i<nrec;++i) {
/* restore the data */
data[d[i]] = data_save[i];
/* restore the parity */
parity[p[i]] = waste;
parity[c[i]] = waste;
}
}
} while (combination_next(r, nrec, p));
} while (combination_next(r, ndata, d));
} while (combination_next(nrec, npar, c));
} while (combination_next(nrec, ndata, d));
}
free(buffer_alloc);
@ -216,7 +216,7 @@ static void gentest(unsigned mode, unsigned ndata, unsigned block_size)
unsigned char** buffer;
unsigned buffermax;
unsigned i, j;
void (*map[64])(unsigned char** buffer, unsigned ndata, unsigned size);
void (*map[64])(unsigned ndata, unsigned size, unsigned char** vbuf);
unsigned mac;
unsigned npar;
@ -238,7 +238,7 @@ static void gentest(unsigned mode, unsigned ndata, unsigned block_size)
}
/* compute the parity */
raid_par(npar, buffer, ndata, block_size);
raid_par(npar, ndata, block_size, buffer);
/* copy in back buffers */
for(i=0;i<npar;++i)
@ -296,7 +296,7 @@ static void gentest(unsigned mode, unsigned ndata, unsigned block_size)
/* check all the functions */
for(j=0;j<mac;++j) {
/* compute parity */
map[j](buffer, ndata, block_size);
map[j](ndata, block_size, buffer);
/* check it */
for(i=0;i<npar;++i) {

74
speed.c
View file

@ -60,7 +60,7 @@ void speed(void)
unsigned char digest[HASH_SIZE];
unsigned char seed[HASH_SIZE];
int d[LEV_MAX];
int e[LEV_MAX];
int c[LEV_MAX];
unsigned count;
unsigned delta = 10;
unsigned block_size = 256 * 1024;
@ -93,7 +93,7 @@ void speed(void)
/* basic disks and parity mapping */
for(i=0;i<LEV_MAX;++i) {
d[i] = i;
e[i] = i;
c[i] = i;
}
printf(PACKAGE " v" VERSION " by Andrea Mazzoleni, " PACKAGE_URL "\n");
@ -261,14 +261,14 @@ void speed(void)
printf("%8s", "");
SPEED_START {
raid_par1_int32(buffer, ndata, block_size);
raid_par1_int32(ndata, block_size, buffer);
} SPEED_STOP
printf("%8"PRIu64, ds / dt);
fflush(stdout);
SPEED_START {
raid_par1_int64(buffer, ndata, block_size);
raid_par1_int64(ndata, block_size, buffer);
} SPEED_STOP
printf("%8"PRIu64, ds / dt);
@ -277,7 +277,7 @@ void speed(void)
#if defined(__i386__) || defined(__x86_64__)
if (cpu_has_sse2()) {
SPEED_START {
raid_par1_sse2(buffer, ndata, block_size);
raid_par1_sse2(ndata, block_size, buffer);
} SPEED_STOP
printf("%8"PRIu64, ds / dt);
@ -294,14 +294,14 @@ void speed(void)
printf("%8s", "");
SPEED_START {
raid_par2_int32(buffer, ndata, block_size);
raid_par2_int32(ndata, block_size, buffer);
} SPEED_STOP
printf("%8"PRIu64, ds / dt);
fflush(stdout);
SPEED_START {
raid_par2_int64(buffer, ndata, block_size);
raid_par2_int64(ndata, block_size, buffer);
} SPEED_STOP
printf("%8"PRIu64, ds / dt);
@ -310,7 +310,7 @@ void speed(void)
#if defined(__i386__) || defined(__x86_64__)
if (cpu_has_sse2()) {
SPEED_START {
raid_par2_sse2(buffer, ndata, block_size);
raid_par2_sse2(ndata, block_size, buffer);
} SPEED_STOP
printf("%8"PRIu64, ds / dt);
@ -318,7 +318,7 @@ void speed(void)
#if defined(__x86_64__)
SPEED_START {
raid_par2_sse2ext(buffer, ndata, block_size);
raid_par2_sse2ext(ndata, block_size, buffer);
} SPEED_STOP
printf("%8"PRIu64, ds / dt);
@ -336,14 +336,14 @@ void speed(void)
printf("%8s", "");
SPEED_START {
raid_parz_int32(buffer, ndata, block_size);
raid_parz_int32(ndata, block_size, buffer);
} SPEED_STOP
printf("%8"PRIu64, ds / dt);
fflush(stdout);
SPEED_START {
raid_parz_int64(buffer, ndata, block_size);
raid_parz_int64(ndata, block_size, buffer);
} SPEED_STOP
printf("%8"PRIu64, ds / dt);
@ -352,7 +352,7 @@ void speed(void)
#if defined(__i386__) || defined(__x86_64__)
if (cpu_has_sse2()) {
SPEED_START {
raid_parz_sse2(buffer, ndata, block_size);
raid_parz_sse2(ndata, block_size, buffer);
} SPEED_STOP
printf("%8"PRIu64, ds / dt);
@ -360,7 +360,7 @@ void speed(void)
#if defined(__x86_64__)
SPEED_START {
raid_parz_sse2ext(buffer, ndata, block_size);
raid_parz_sse2ext(ndata, block_size, buffer);
} SPEED_STOP
printf("%8"PRIu64, ds / dt);
@ -376,7 +376,7 @@ void speed(void)
fflush(stdout);
SPEED_START {
raid_par3_int8(buffer, ndata, block_size);
raid_par3_int8(ndata, block_size, buffer);
} SPEED_STOP
printf("%8"PRIu64, ds / dt);
@ -396,7 +396,7 @@ void speed(void)
#if defined(__i386__) || defined(__x86_64__)
if (cpu_has_ssse3()) {
SPEED_START {
raid_par3_ssse3(buffer, ndata, block_size);
raid_par3_ssse3(ndata, block_size, buffer);
} SPEED_STOP
printf("%8"PRIu64, ds / dt);
@ -404,7 +404,7 @@ void speed(void)
#if defined(__x86_64__)
SPEED_START {
raid_par3_ssse3ext(buffer, ndata, block_size);
raid_par3_ssse3ext(ndata, block_size, buffer);
} SPEED_STOP
printf("%8"PRIu64, ds / dt);
@ -420,7 +420,7 @@ void speed(void)
fflush(stdout);
SPEED_START {
raid_par4_int8(buffer, ndata, block_size);
raid_par4_int8(ndata, block_size, buffer);
} SPEED_STOP
printf("%8"PRIu64, ds / dt);
@ -440,7 +440,7 @@ void speed(void)
#if defined(__i386__) || defined(__x86_64__)
if (cpu_has_ssse3()) {
SPEED_START {
raid_par4_ssse3(buffer, ndata, block_size);
raid_par4_ssse3(ndata, block_size, buffer);
} SPEED_STOP
printf("%8"PRIu64, ds / dt);
@ -448,7 +448,7 @@ void speed(void)
#if defined(__x86_64__)
SPEED_START {
raid_par4_ssse3ext(buffer, ndata, block_size);
raid_par4_ssse3ext(ndata, block_size, buffer);
} SPEED_STOP
printf("%8"PRIu64, ds / dt);
@ -464,7 +464,7 @@ void speed(void)
fflush(stdout);
SPEED_START {
raid_par5_int8(buffer, ndata, block_size);
raid_par5_int8(ndata, block_size, buffer);
} SPEED_STOP
printf("%8"PRIu64, ds / dt);
@ -484,7 +484,7 @@ void speed(void)
#if defined(__i386__) || defined(__x86_64__)
if (cpu_has_ssse3()) {
SPEED_START {
raid_par5_ssse3(buffer, ndata, block_size);
raid_par5_ssse3(ndata, block_size, buffer);
} SPEED_STOP
printf("%8"PRIu64, ds / dt);
@ -492,7 +492,7 @@ void speed(void)
#if defined(__x86_64__)
SPEED_START {
raid_par5_ssse3ext(buffer, ndata, block_size);
raid_par5_ssse3ext(ndata, block_size, buffer);
} SPEED_STOP
printf("%8"PRIu64, ds / dt);
@ -508,7 +508,7 @@ void speed(void)
fflush(stdout);
SPEED_START {
raid_par6_int8(buffer, ndata, block_size);
raid_par6_int8(ndata, block_size, buffer);
} SPEED_STOP
printf("%8"PRIu64, ds / dt);
@ -528,7 +528,7 @@ void speed(void)
#if defined(__i386__) || defined(__x86_64__)
if (cpu_has_ssse3()) {
SPEED_START {
raid_par6_ssse3(buffer, ndata, block_size);
raid_par6_ssse3(ndata, block_size, buffer);
} SPEED_STOP
printf("%8"PRIu64, ds / dt);
@ -536,7 +536,7 @@ void speed(void)
#if defined(__x86_64__)
SPEED_START {
raid_par6_ssse3ext(buffer, ndata, block_size);
raid_par6_ssse3ext(ndata, block_size, buffer);
} SPEED_STOP
printf("%8"PRIu64, ds / dt);
@ -562,7 +562,7 @@ void speed(void)
SPEED_START {
for(j=0;j<ndata;++j) {
/* +1 to avoid PAR1 optimized case */
raid_rec1_int8(1, d, e + 1, buffer, ndata, zero, block_size);
raid_rec1_int8(1, d, c + 1, ndata, block_size, buffer, zero);
}
} SPEED_STOP
@ -574,7 +574,7 @@ void speed(void)
SPEED_START {
for(j=0;j<ndata;++j) {
/* +1 to avoid PAR1 optimized case */
raid_rec1_ssse3(1, d, e + 1, buffer, ndata, zero, block_size);
raid_rec1_ssse3(1, d, c + 1, ndata, block_size, buffer, zero);
}
} SPEED_STOP
@ -590,7 +590,7 @@ void speed(void)
SPEED_START {
for(j=0;j<ndata;++j) {
/* +1 to avoid PAR2 optimized case */
raid_rec2_int8(2, d, e + 1, buffer, ndata, zero, block_size);
raid_rec2_int8(2, d, c + 1, ndata, block_size, buffer, zero);
}
} SPEED_STOP
@ -602,7 +602,7 @@ void speed(void)
SPEED_START {
for(j=0;j<ndata;++j) {
/* +1 to avoid PAR2 optimized case */
raid_rec2_ssse3(2, d, e + 1, buffer, ndata, zero, block_size);
raid_rec2_ssse3(2, d, c + 1, ndata, block_size, buffer, zero);
}
} SPEED_STOP
@ -617,7 +617,7 @@ void speed(void)
SPEED_START {
for(j=0;j<ndata;++j) {
raid_recX_int8(3, d, e, buffer, ndata, zero, block_size);
raid_recX_int8(3, d, c, ndata, block_size, buffer, zero);
}
} SPEED_STOP
@ -628,7 +628,7 @@ void speed(void)
if (cpu_has_ssse3()) {
SPEED_START {
for(j=0;j<ndata;++j) {
raid_recX_ssse3(3, d, e, buffer, ndata, zero, block_size);
raid_recX_ssse3(3, d, c, ndata, block_size, buffer, zero);
}
} SPEED_STOP
@ -643,7 +643,7 @@ void speed(void)
SPEED_START {
for(j=0;j<ndata;++j) {
raid_recX_int8(4, d, e, buffer, ndata, zero, block_size);
raid_recX_int8(4, d, c, ndata, block_size, buffer, zero);
}
} SPEED_STOP
@ -654,7 +654,7 @@ void speed(void)
if (cpu_has_ssse3()) {
SPEED_START {
for(j=0;j<ndata;++j) {
raid_recX_ssse3(4, d, e, buffer, ndata, zero, block_size);
raid_recX_ssse3(4, d, c, ndata, block_size, buffer, zero);
}
} SPEED_STOP
@ -669,7 +669,7 @@ void speed(void)
SPEED_START {
for(j=0;j<ndata;++j) {
raid_recX_int8(5, d, e, buffer, ndata, zero, block_size);
raid_recX_int8(5, d, c, ndata, block_size, buffer, zero);
}
} SPEED_STOP
@ -680,7 +680,7 @@ void speed(void)
if (cpu_has_ssse3()) {
SPEED_START {
for(j=0;j<ndata;++j) {
raid_recX_ssse3(5, d, e, buffer, ndata, zero, block_size);
raid_recX_ssse3(5, d, c, ndata, block_size, buffer, zero);
}
} SPEED_STOP
@ -695,7 +695,7 @@ void speed(void)
SPEED_START {
for(j=0;j<ndata;++j) {
raid_recX_int8(6, d, e, buffer, ndata, zero, block_size);
raid_recX_int8(6, d, c, ndata, block_size, buffer, zero);
}
} SPEED_STOP
@ -706,7 +706,7 @@ void speed(void)
if (cpu_has_ssse3()) {
SPEED_START {
for(j=0;j<ndata;++j) {
raid_recX_ssse3(6, d, e, buffer, ndata, zero, block_size);
raid_recX_ssse3(6, d, c, ndata, block_size, buffer, zero);
}
} SPEED_STOP

2
sync.c
View file

@ -386,7 +386,7 @@ static int state_sync_process(struct snapraid_state* state, struct snapraid_pari
/* updates the parity only if really needed */
if (parity_needs_to_be_updated) {
/* compute the parity */
raid_par(state->level, buffer, diskmax, state->block_size);
raid_par(state->level, diskmax, state->block_size, buffer);
/* write the parity */
for(l=0;l<state->level;++l) {