Changes configuration to use numbers to specify the parity level instead than letters.

This commit is contained in:
Andrea Mazzoleni 2013-11-17 14:12:57 +01:00
parent f789fbaba2
commit 22b3ca77b3
14 changed files with 114 additions and 106 deletions

View file

@ -469,9 +469,9 @@ endif
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(PAR1) check -l test.log
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(PAR1) fix -l test.log
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(CONF) check
echo --- Delete the parity and the q-parity, fix and check with PAR2
echo --- Delete the parity and the 2-parity, fix and check with PAR2
rm test/parity
rm test/q-parity
rm test/2-parity
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(PAR2) fix -l test.log
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(CONF) check
echo --- Delete the parity and a disk, fix and check with PAR2
@ -480,8 +480,8 @@ endif
rm -r test/disk2/_b
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(PAR2) fix -l test.log
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(CONF) check
echo --- Delete the q-parity and a disk, fix and check with PAR2
rm test/q-parity
echo --- Delete the 2-parity and a disk, fix and check with PAR2
rm test/2-parity
rm -r test/disk3/_a
rm -r test/disk3/_b
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(PAR2) fix -l test.log
@ -492,9 +492,9 @@ endif
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(PAR1) -a check
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(PAR1) fix -l test.log
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(CONF) check
echo --- Corrupt the parity and the q-parity, fix and check with PAR2
echo --- Corrupt the parity and the 2-parity, fix and check with PAR2
$(TESTENV) ./mktest$(EXEEXT) damage 2 100 10000 test/parity
$(TESTENV) ./mktest$(EXEEXT) damage 2 100 10000 test/q-parity
$(TESTENV) ./mktest$(EXEEXT) damage 2 100 10000 test/2-parity
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) --test-expect-recoverable -c $(PAR2) check -l test.log
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(CONF) -a check
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(PAR2) fix -l test.log
@ -546,8 +546,8 @@ endif
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) --test-expect-recoverable -c $(PAR2) check -l test.log
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(PAR2) fix -l test.log
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(CONF) check
echo --- Corrupt the q-parity and some files, fix and check with PAR2
$(TESTENV) ./mktest$(EXEEXT) damage 7 100 10000 test/q-parity
echo --- Corrupt the 2-parity and some files, fix and check with PAR2
$(TESTENV) ./mktest$(EXEEXT) damage 7 100 10000 test/2-parity
$(TESTENV) ./mktest$(EXEEXT) damage 7 1 500 test/disk1/_a/_a/*
$(TESTENV) ./mktest$(EXEEXT) damage 7 1 500 test/disk1/_a/_b/*
$(TESTENV) ./mktest$(EXEEXT) append 7 500 test/disk1/_b/_a/*

View file

@ -832,7 +832,7 @@ static int state_check_process(struct snapraid_state* state, int check, int fix,
++unrecoverable_error;
}
/* now check parity and q-parity, but only if all the blocks have it computed */
/* now check parities, but only if all the blocks have it computed */
/* if you check/fix after a partial sync, it's OK to have parity errors on the blocks with invalid parity */
/* and doesn't make sense to try to fix it */
if (valid_parity) {

View file

@ -788,21 +788,21 @@ Leaving the parity disk reserved for only this file ensures that
it doesn\(cqt get fragmented, improving the performance.
.PP
This option is mandatory and it can be used only one time.
.SS [q,r,s,t,u]\-parity FILE
.SS [q,2,3,4,5,6]\-parity FILE
Defines the files to use to store extra parity information.
For each parity file specified, one additional level of protection
is enabled:
.PD 0
.IP \(bu
q\-parity enables RAID6 double parity
q\-parity/2\-parity enables RAID6 double parity
.IP \(bu
r\-parity enables triple parity
3\-parity enables triple parity
.IP \(bu
s\-parity enables quad parity
4\-parity enables quad parity
.IP \(bu
t\-parity enables penta (five) parity
5\-parity enables penta (five) parity
.IP \(bu
u\-parity enables hexa (six) parity
6\-parity enables hexa (six) parity
.PD
.PP
Each parity level requires also all the files of the previous levels.
@ -816,7 +816,7 @@ These options are optional and they can be used only one time.
.SS z\-parity FILE
Defines an alternate file and format to store the triple parity.
.PP
This option is an alternative at \(cqr\-parity\(cq mainly intended for
This option is an alternative at \(cq3\-parity\(cq mainly intended for
low end CPUs like ARM or AMD Phenom, Athlon and Opteron that don\(cqt
support the SSSE3 instructions set, and in such case it may provide
a better performance.
@ -824,11 +824,11 @@ a better performance.
This format is similar at the one used by the Linux Kernel RAID6 and
ZFS RAIDZ3, but it doesn\(cqt work beyond triple parity.
.PP
When using \(cqr\-parity\(cq you will be warned if it\(cqs recommended to use
When using \(cq3\-parity\(cq you will be warned if it\(cqs recommended to use
the \(cqz\-parity\(cq format for a performance improvment.
.PP
It\(cqs possible to convert from one format to another, adjusting
the configuraton file with the wanted z\-parity or r\-parity file,
the configuraton file with the wanted z\-parity or 3\-parity file,
and using \(cqfix\(cq to recreate it.
.SS content FILE
Defines the file to use to store the list and checksums of all the

View file

@ -9,14 +9,14 @@ parity /mnt/diskp/parity
# If specified, they enable the multiple failures protection
# from two to six level of parity.
# To enable, uncomment one parity file for each level of extra
# protection required. Start from q-parity, and follow in order.
# protection required. Start from 2-parity, and follow in order.
# It must NOT be in a data disk
# Format: "X-parity FILE_PATH"
#q-parity /mnt/diskq/q-parity
#r-parity /mnt/diskr/r-parity
#s-parity /mnt/disks/s-parity
#t-parity /mnt/diskt/t-parity
#u-parity /mnt/disku/u-parity
#2-parity /mnt/diskq/2-parity
#3-parity /mnt/diskr/3-parity
#4-parity /mnt/disks/4-parity
#5-parity /mnt/diskt/5-parity
#6-parity /mnt/disku/6-parity
# Defines the files to use as content list
# You can use multiple specification to store more copies

View file

@ -9,14 +9,14 @@ parity E:\parity.par
# If specified, they enable the multiple failures protection
# from two to six level of parity.
# To enable, uncomment one parity file for each level of extra
# protection required. Start from q-parity, and follow in order.
# protection required. Start from 2-parity, and follow in order.
# It must NOT be in a data disk
# Format: "X-parity FILE_PATH"
#q-parity F:\q-parity.par
#r-parity G:\r-parity.par
#s-parity H:\s-parity.par
#t-parity I:\t-parity.par
#u-parity J:\u-parity.par
#2-parity F:\2-parity.par
#3-parity G:\3-parity.par
#4-parity H:\4-parity.par
#5-parity I:\5-parity.par
#6-parity J:\6-parity.par
# Defines the files to use as content list
# You can use multiple specification to store more copies

View file

@ -586,16 +586,16 @@ Configuration
This option is mandatory and it can be used only one time.
[q,r,s,t,u]-parity FILE
[2,3,4,5,6]-parity FILE
Defines the files to use to store extra parity information.
For each parity file specified, one additional level of protection
is enabled:
* q-parity enables RAID6 double parity
* r-parity enables triple parity
* s-parity enables quad parity
* t-parity enables penta (five) parity
* u-parity enables hexa (six) parity
* 2-parity enables RAID6 double parity.
* 3-parity enables triple parity
* 4-parity enables quad parity
* 5-parity enables penta (five) parity
* 6-parity enables hexa (six) parity
Each parity level requires also all the files of the previous levels.
@ -609,7 +609,7 @@ Configuration
z-parity FILE
Defines an alternate file and format to store the triple parity.
This option is an alternative at 'r-parity' mainly intended for
This option is an alternative at '3-parity' mainly intended for
low end CPUs like ARM or AMD Phenom, Athlon and Opteron that don't
support the SSSE3 instructions set, and in such case it may provide
a better performance.
@ -617,11 +617,11 @@ Configuration
This format is similar at the one used by the Linux Kernel RAID6 and
ZFS RAIDZ3, but it doesn't work beyond triple parity.
When using 'r-parity' you will be warned if it's recommended to use
When using '3-parity' you will be warned if it's recommended to use
the 'z-parity' format for a performance improvment.
It's possible to convert from one format to another, adjusting
the configuraton file with the wanted z-parity or r-parity file,
the configuraton file with the wanted z-parity or 3-parity file,
and using 'fix' to recreate it.
content FILE

48
state.c
View file

@ -29,11 +29,11 @@ const char* lev_name(unsigned l)
{
switch (l) {
case 0 : return "Parity";
case 1 : return "Q-Parity";
case 2 : return "R-Parity";
case 3 : return "S-Parity";
case 4 : return "T-Parity";
case 5 : return "U-Parity";
case 1 : return "2-Parity";
case 2 : return "3-Parity";
case 3 : return "4-Parity";
case 4 : return "5-Parity";
case 5 : return "6-Parity";
}
return 0;
@ -43,11 +43,11 @@ const char* lev_config_name(unsigned l)
{
switch (l) {
case 0 : return "parity";
case 1 : return "q-parity";
case 2 : return "r-parity";
case 3 : return "s-parity";
case 4 : return "t-parity";
case 5 : return "u-parity";
case 1 : return "2-parity";
case 2 : return "3-parity";
case 3 : return "4-parity";
case 4 : return "5-parity";
case 5 : return "6-parity";
}
return 0;
@ -286,7 +286,7 @@ static void state_config_check(struct snapraid_state* state, const char* path, t
if (state->raid_mode == RAID_MODE_CAUCHY) {
if (state->level == 3) {
fprintf(stderr, "WARNING! Your CPU doesn't have a fast implementation for triple parity.\n");
fprintf(stderr, "WARNING! It's recommended to switch to 'z-parity' instead than 'r-parity'.\n");
fprintf(stderr, "WARNING! It's recommended to switch to 'z-parity' instead than '3-parity'.\n");
} else if (state->level > 3) {
fprintf(stderr, "WARNING! Your CPU doesn't have a fast implementation beyond triple parity.\n");
fprintf(stderr, "WARNING! It's recommended to reduce the parity levels to triple parity.\n");
@ -386,9 +386,12 @@ void state_config(struct snapraid_state* state, const char* path, const char* co
} else if (strcmp(tag, "parity") == 0
|| strcmp(tag, "q-parity") == 0
|| strcmp(tag, "r-parity") == 0
|| strcmp(tag, "s-parity") == 0
|| strcmp(tag, "t-parity") == 0
|| strcmp(tag, "u-parity") == 0
|| strcmp(tag, "1-parity") == 0
|| strcmp(tag, "2-parity") == 0
|| strcmp(tag, "3-parity") == 0
|| strcmp(tag, "4-parity") == 0
|| strcmp(tag, "5-parity") == 0
|| strcmp(tag, "6-parity") == 0
|| strcmp(tag, "z-parity") == 0
) {
char device[PATH_MAX];
@ -400,9 +403,12 @@ void state_config(struct snapraid_state* state, const char* path, const char* co
case 'p' : l = 0; break;
case 'q' : l = 1; break;
case 'r' : l = 2; break;
case 's' : l = 3; break;
case 't' : l = 4; break;
case 'u' : l = 5; break;
case '1' : l = 0; break;
case '2' : l = 1; break;
case '3' : l = 2; break;
case '4' : l = 3; break;
case '5' : l = 4; break;
case '6' : l = 5; break;
case 'z' :
l = 2;
state->raid_mode = RAID_MODE_VANDERMONDE;
@ -868,13 +874,13 @@ static void state_map(struct snapraid_state* state)
}
/* recommend number of parities */
if (diskcount >= 34 && state->level < 6) {
if (diskcount >= 36 && state->level < 6) {
fprintf(stderr, "WARNING! With %u disks it's recommended to use six parity levels.\n", diskcount);
} else if (diskcount >= 27 && state->level < 5) {
} else if (diskcount >= 29 && state->level < 5) {
fprintf(stderr, "WARNING! With %u disks it's recommended to use five parity levels.\n", diskcount);
} else if (diskcount >= 20 && state->level < 4) {
} else if (diskcount >= 22 && state->level < 4) {
fprintf(stderr, "WARNING! With %u disks it's recommended to use four parity levels.\n", diskcount);
} else if (diskcount >= 13 && state->level < 3) {
} else if (diskcount >= 15 && state->level < 3) {
fprintf(stderr, "WARNING! With %u disks it's recommended to use three parity levels.\n", diskcount);
} else if (diskcount >= 5 && state->level < 2) {
fprintf(stderr, "WARNING! With %u disks it's recommended to use two parity levels.\n", diskcount);

View file

@ -29,12 +29,12 @@
#define LEV_MAX 6
/**
* Returns the parity name: Parity, Q-Parity, R-Parity, S-Parity, T-Parity, U-Parity.
* Returns the parity name: Parity, 2-Parity, 3-Parity, 4-Parity, 5-Parity, 6-Parity.
*/
const char* lev_name(unsigned level);
/**
* Returns the parity name used in the config file: parity, q-parity, r-parity, s-parity, t-parity, u-parity.
* Returns the parity name used in the config file: parity, 2-parity, 3-parity, 4-parity, 5-parity, 6-parity.
*/
const char* lev_config_name(unsigned level);

View file

@ -1,9 +1,9 @@
block_size 1
parity test/parity
q-parity test/q-parity
2-parity test/2-parity
content test/content
content test/p-content
content test/q-content
content test/1-content
content test/2-content
disk disk1 test/disk1/
disk disk2 test/disk2/
disk disk3 test/disk3/

View file

@ -1,11 +1,11 @@
block_size 1
parity test/parity
q-parity test/q-parity
r-parity test/r-parity
2-parity test/2-parity
3-parity test/3-parity
content test/content
content test/p-content
content test/q-content
content test/r-content
content test/1-content
content test/2-content
content test/3-content
disk disk1 test/disk1/
disk disk2 test/disk2/
disk disk3 test/disk3/

View file

@ -1,13 +1,13 @@
block_size 1
parity test/parity
q-parity test/q-parity
r-parity test/r-parity
s-parity test/s-parity
2-parity test/2-parity
3-parity test/3-parity
4-parity test/4-parity
content test/content
content test/p-content
content test/q-content
content test/r-content
content test/s-content
content test/1-content
content test/2-content
content test/3-content
content test/4-content
disk disk1 test/disk1/
disk disk2 test/disk2/
disk disk3 test/disk3/

View file

@ -1,14 +1,15 @@
block_size 1
parity test/parity
q-parity test/q-parity
r-parity test/r-parity
s-parity test/s-parity
t-parity test/t-parity
2-parity test/2-parity
3-parity test/3-parity
4-parity test/4-parity
5-parity test/5-parity
content test/content
content test/p-content
content test/q-content
content test/r-content
content test/t-content
content test/1-content
content test/2-content
content test/3-content
content test/4-content
content test/5-content
disk disk1 test/disk1/
disk disk2 test/disk2/
disk disk3 test/disk3/

View file

@ -1,17 +1,17 @@
block_size 1
parity test/parity
q-parity test/q-parity
r-parity test/r-parity
s-parity test/s-parity
t-parity test/t-parity
u-parity test/u-parity
2-parity test/2-parity
3-parity test/3-parity
4-parity test/4-parity
5-parity test/5-parity
6-parity test/6-parity
content test/content
content test/p-content
content test/q-content
content test/r-content
content test/s-content
content test/t-content
content test/u-content
content test/1-content
content test/2-content
content test/3-content
content test/4-content
content test/5-content
content test/6-content
disk disk1 test/disk1/
disk disk3 test/disk3/
disk disk4 test/disk4/

View file

@ -1,16 +1,17 @@
block_size 1
parity test/parity
q-parity test/q-parity
r-parity test/r-parity
s-parity test/s-parity
t-parity test/t-parity
u-parity test/u-parity
2-parity test/2-parity
3-parity test/3-parity
4-parity test/4-parity
5-parity test/5-parity
6-parity test/6-parity
content test/content
content test/p-content
content test/q-content
content test/r-content
content test/t-content
content test/u-content
content test/1-content
content test/2-content
content test/3-content
content test/4-content
content test/5-content
content test/6-content
disk disk1 test/disk1/
disk disk2 test/disk2/
disk disk3 test/disk3/