mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 02:49:02 -04:00
Fix raid_selftest() parity bounds and dispatch in Vandermonde mode
This commit is contained in:
parent
4c51acaf29
commit
ecb26a6aee
3 changed files with 42 additions and 7 deletions
|
|
@ -564,11 +564,18 @@ int raid_selftest(void)
|
|||
int ir[RAID_PARITY_MAX];
|
||||
int ip[RAID_PARITY_MAX];
|
||||
int i, np;
|
||||
int np_max;
|
||||
int ret = 0;
|
||||
|
||||
/* ensure to have enough space for data */
|
||||
BUG_ON(nd * size > 65536);
|
||||
|
||||
/* vandermonde mode only supports up to 3 parity rows */
|
||||
if (raid_mode_active == RAID_MODE_VANDERMONDE_RAID)
|
||||
np_max = 3;
|
||||
else
|
||||
np_max = RAID_PARITY_MAX;
|
||||
|
||||
v = raid_malloc_vector(nv, size, &v_alloc);
|
||||
if (!v) {
|
||||
/* LCOV_EXCL_START */
|
||||
|
|
@ -584,14 +591,14 @@ int raid_selftest(void)
|
|||
ref[i] = ((uint8_t *)raid_gfmul) + size * i;
|
||||
|
||||
/* setup reference parity */
|
||||
for (i = 0; i < RAID_PARITY_MAX; ++i)
|
||||
for (i = 0; i < np_max; ++i)
|
||||
ref[nd + i] = v[nd + RAID_PARITY_MAX + i];
|
||||
|
||||
/* compute reference parity */
|
||||
raid_gen_ref(nd, RAID_PARITY_MAX, size, ref);
|
||||
raid_gen_ref(nd, np_max, size, ref);
|
||||
|
||||
/* test for each parity level */
|
||||
for (np = 1; np <= RAID_PARITY_MAX; ++np) {
|
||||
for (np = 1; np <= np_max; ++np) {
|
||||
/* test parity generation */
|
||||
ret = raid_test_par(nd, np, size, v, ref);
|
||||
if (ret != 0) {
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ int main(void)
|
|||
goto bail;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
raid_mode(RAID_MODE_CAUCHY_RAID);
|
||||
if (raid_selftest() != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
goto bail;
|
||||
|
|
@ -41,12 +42,23 @@ int main(void)
|
|||
goto bail;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
raid_mode(RAID_MODE_CAUCHY_AES);
|
||||
if (raid_selftest() != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
goto bail;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
printf("Test Vandermonde RAID\n");
|
||||
raid_mode(RAID_MODE_VANDERMONDE_RAID);
|
||||
if (raid_selftest() != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
goto bail;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
raid_mode(RAID_MODE_CAUCHY_RAID);
|
||||
|
||||
printf("OK\n");
|
||||
return 0;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue