From 305b52d32a9384e4425c6e9c9e1bcabd4660ae7a Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Sat, 28 Dec 2013 15:43:00 +0100 Subject: [PATCH] Reverses the order of np/nd in raid_par() for consistency with other funcs. --- check.c | 10 +++++----- raid/raid.c | 10 +++++----- raid/raid.h | 10 +++++----- scrub.c | 2 +- selftest.c | 4 ++-- sync.c | 2 +- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/check.c b/check.c index bf07adca..245a8dc5 100644 --- a/check.c +++ b/check.c @@ -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, diskmax, state->block_size, buffer); + raid_par(diskmax, state->level, 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, void** buffer, void** buffer_recov) { /* recompute parity, note that we don't need parity over i */ - raid_par(i + 1, diskmax, state->block_size, buffer); + raid_par(diskmax, i + 1, 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, diskmax, state->block_size, buffer); + raid_par(diskmax, state->level, 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, diskmax, state->block_size, buffer); + raid_par(diskmax, state->level, state->block_size, buffer); return 0; } @@ -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, diskmax, state->block_size, buffer); + raid_par(diskmax, state->level, state->block_size, buffer); return 0; } diff --git a/raid/raid.c b/raid/raid.c index a66f3031..b63aea7e 100644 --- a/raid/raid.c +++ b/raid/raid.c @@ -234,7 +234,7 @@ void (*raid_par_ptr[RAID_PARITY_MAX])(int nd, size_t size, void **vv); void (*raid_par3_ptr)(int nd, size_t size, void **vv); void (*raid_parz_ptr)(int nd, size_t size, void **vv); -void raid_par(int np, int nd, size_t size, void **v) +void raid_par(int nd, int np, size_t size, void **v) { BUG_ON(np < 1 || np > RAID_PARITY_MAX); BUG_ON(size % 64 != 0); @@ -315,7 +315,7 @@ void raid_delta_gen(int nr, const int *id, const int *ip, int nd, size_t size, v } /* recompute the minimal parity required */ - raid_par(ip[nr - 1] + 1, nd, size, v); + raid_par(nd, ip[nr - 1] + 1, size, v); for (i = 0; i < nr; ++i) { /* restore disk buffers as before */ @@ -354,7 +354,7 @@ void raid_rec1_par1(const int *id, int nd, size_t size, void **v) v[nd] = pa; /* compute */ - raid_par(1, nd, size, v); + raid_par(nd, 1, size, v); /* restore as before */ v[id[0]] = pa; @@ -424,7 +424,7 @@ 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(int nrd, const int *id, int nrp, int *ip, int np, int nd, size_t size, void **v) +void raid_rec(int nrd, const int *id, int nrp, int *ip, int nd, int np, size_t size, void **v) { BUG_ON(nrd > nd); BUG_ON(nrd + nrp > np); @@ -453,7 +453,7 @@ void raid_rec(int nrd, const int *id, int nrp, int *ip, int np, int nd, size_t s /* recompute all the parities up to the last bad one */ if (nrp != 0) - raid_par(ip[nrp - 1] + 1, nd, size, v); + 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) diff --git a/raid/raid.h b/raid/raid.h index 90293b9b..35ba9118 100644 --- a/raid/raid.h +++ b/raid/raid.h @@ -81,15 +81,15 @@ void raid_waste(void *zero); /** * Computes the parity. * - * \param np Number of parities to compute. * \param nd Number of data disks. + * \param np Number of parities to compute. * \param size Size of the blocks pointed by vv. It must be a multipler of 64. * \param vv Vector of pointers to the blocks for disks and parities. * It has (::nd + ::np) elements. The first elements are the blocks for * data, following with the parity blocks. * Each blocks has ::size bytes. */ -void raid_par(int np, int nd, size_t size, void **vv); +void raid_par(int nd, int np, size_t size, void **vv); /** * Recovers failures of data and parity blocks. @@ -97,7 +97,7 @@ void raid_par(int np, int nd, size_t size, void **vv); * 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 recoverign are automatically selected from + * The parities blocks to use for recovering are automatically selected from * the ones NOT present in the ::ip vector. * * Ensure to have ::nrd + ::nrp <= ::np, otherwise recovering is not possible. @@ -110,15 +110,15 @@ void raid_par(int np, int nd, size_t size, void **vv); * 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 np Number of parity disks. * \param nd Number of data disks. + * \param np Number of parity disks. * \param size Size of the blocks pointed by vv. It must be a multipler of 64. * \param vv Vector of pointers to the blocks for disks and parities. * It has (::nd + ::np) elements. The first elements are the blocks * for data, following with the parity blocks. * Each blocks has ::size bytes. */ -void raid_rec(int nrd, const int *id, int nrp, int *ip, int np, 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 **vv); /** * Recovers failures of data blocks using the specified parities. diff --git a/scrub.c b/scrub.c index b067d9a7..175fe6d9 100644 --- a/scrub.c +++ b/scrub.c @@ -321,7 +321,7 @@ static int state_scrub_process(struct snapraid_state* state, struct snapraid_par } /* compute the parity */ - raid_par(state->level, diskmax, state->block_size, buffer); + raid_par(diskmax, state->level, state->block_size, buffer); /* compare the parity */ for(l=0;llevel;++l) { diff --git a/selftest.c b/selftest.c index d509fd60..34f6d81f 100644 --- a/selftest.c +++ b/selftest.c @@ -157,7 +157,7 @@ static void recovtest(unsigned mode, unsigned nd, unsigned block_size) } /* compute the parity */ - raid_par(np, nd, block_size, buffer); + raid_par(nd, np, block_size, buffer); /* set all the parity to the waste buffer */ for(i=0;ilevel, diskmax, state->block_size, buffer); + raid_par(diskmax, state->level, state->block_size, buffer); /* write the parity */ for(l=0;llevel;++l) {