mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 19:01:57 -04:00
Supports the special case of a single data disk for all parity levels.
This commit is contained in:
parent
3c7bf1a14b
commit
86f6309949
4 changed files with 65 additions and 12 deletions
64
raid.c
64
raid.c
|
|
@ -886,6 +886,14 @@ void raid_par3_ssse3(unsigned char** vbuf, unsigned data, unsigned size)
|
|||
q = vbuf[data+1];
|
||||
r = vbuf[data+2];
|
||||
|
||||
/* special case with only one data disk */
|
||||
if (l == 0) {
|
||||
for(i=0;i<3;++i)
|
||||
memcpy(vbuf[1+i], vbuf[0], size);
|
||||
return;
|
||||
}
|
||||
|
||||
/* generic case with at least two data disks */
|
||||
asm volatile("movdqa %0,%%xmm3" : : "m" (gfconst16.poly[0]));
|
||||
asm volatile("movdqa %0,%%xmm7" : : "m" (gfconst16.low4[0]));
|
||||
|
||||
|
|
@ -974,6 +982,14 @@ void raid_par3_ssse3ext(unsigned char** vbuf, unsigned data, unsigned size)
|
|||
q = vbuf[data+1];
|
||||
r = vbuf[data+2];
|
||||
|
||||
/* special case with only one data disk */
|
||||
if (l == 0) {
|
||||
for(i=0;i<3;++i)
|
||||
memcpy(vbuf[1+i], vbuf[0], size);
|
||||
return;
|
||||
}
|
||||
|
||||
/* generic case with at least two data disks */
|
||||
asm volatile("movdqa %0,%%xmm3" : : "m" (gfconst16.poly[0]));
|
||||
asm volatile("movdqa %0,%%xmm11" : : "m" (gfconst16.low4[0]));
|
||||
|
||||
|
|
@ -1155,6 +1171,14 @@ void raid_par4_ssse3(unsigned char** vbuf, unsigned data, unsigned size)
|
|||
r = vbuf[data+2];
|
||||
s = vbuf[data+3];
|
||||
|
||||
/* special case with only one data disk */
|
||||
if (l == 0) {
|
||||
for(i=0;i<4;++i)
|
||||
memcpy(vbuf[1+i], vbuf[0], size);
|
||||
return;
|
||||
}
|
||||
|
||||
/* generic case with at least two data disks */
|
||||
for(i=0;i<size;i+=16) {
|
||||
/* last disk without the by two multiplication */
|
||||
asm volatile("movdqa %0,%%xmm7" : : "m" (gfconst16.low4[0]));
|
||||
|
|
@ -1262,6 +1286,14 @@ void raid_par4_ssse3ext(unsigned char** vbuf, unsigned data, unsigned size)
|
|||
r = vbuf[data+2];
|
||||
s = vbuf[data+3];
|
||||
|
||||
/* special case with only one data disk */
|
||||
if (l == 0) {
|
||||
for(i=0;i<4;++i)
|
||||
memcpy(vbuf[1+i], vbuf[0], size);
|
||||
return;
|
||||
}
|
||||
|
||||
/* generic case with at least two data disks */
|
||||
for(i=0;i<size;i+=32) {
|
||||
/* last disk without the by two multiplication */
|
||||
asm volatile("movdqa %0,%%xmm15" : : "m" (gfconst16.low4[0]));
|
||||
|
|
@ -1486,6 +1518,14 @@ void raid_par5_ssse3(unsigned char** vbuf, unsigned data, unsigned size)
|
|||
s = vbuf[data+3];
|
||||
t = vbuf[data+4];
|
||||
|
||||
/* special case with only one data disk */
|
||||
if (l == 0) {
|
||||
for(i=0;i<5;++i)
|
||||
memcpy(vbuf[1+i], vbuf[0], size);
|
||||
return;
|
||||
}
|
||||
|
||||
/* generic case with at least two data disks */
|
||||
for(i=0;i<size;i+=16) {
|
||||
/* last disk without the by two multiplication */
|
||||
asm volatile("movdqa %0,%%xmm4" : : "m" (vbuf[l][i]));
|
||||
|
|
@ -1612,6 +1652,14 @@ void raid_par5_ssse3ext(unsigned char** vbuf, unsigned data, unsigned size)
|
|||
s = vbuf[data+3];
|
||||
t = vbuf[data+4];
|
||||
|
||||
/* special case with only one data disk */
|
||||
if (l == 0) {
|
||||
for(i=0;i<5;++i)
|
||||
memcpy(vbuf[1+i], vbuf[0], size);
|
||||
return;
|
||||
}
|
||||
|
||||
/* generic case with at least two data disks */
|
||||
asm volatile("movdqa %0,%%xmm14" : : "m" (gfconst16.poly[0]));
|
||||
asm volatile("movdqa %0,%%xmm15" : : "m" (gfconst16.low4[0]));
|
||||
|
||||
|
|
@ -1801,6 +1849,14 @@ void raid_par6_ssse3(unsigned char** vbuf, unsigned data, unsigned size)
|
|||
t = vbuf[data+4];
|
||||
u = vbuf[data+5];
|
||||
|
||||
/* special case with only one data disk */
|
||||
if (l == 0) {
|
||||
for(i=0;i<6;++i)
|
||||
memcpy(vbuf[1+i], vbuf[0], size);
|
||||
return;
|
||||
}
|
||||
|
||||
/* generic case with at least two data disks */
|
||||
for(i=0;i<size;i+=16) {
|
||||
/* last disk without the by two multiplication */
|
||||
asm volatile("movdqa %0,%%xmm4" : : "m" (vbuf[l][i]));
|
||||
|
|
@ -1948,6 +2004,14 @@ void raid_par6_ssse3ext(unsigned char** vbuf, unsigned data, unsigned size)
|
|||
t = vbuf[data+4];
|
||||
u = vbuf[data+5];
|
||||
|
||||
/* special case with only one data disk */
|
||||
if (l == 0) {
|
||||
for(i=0;i<6;++i)
|
||||
memcpy(vbuf[1+i], vbuf[0], size);
|
||||
return;
|
||||
}
|
||||
|
||||
/* generic case with at least two data disks */
|
||||
asm volatile("movdqa %0,%%xmm14" : : "m" (gfconst16.poly[0]));
|
||||
asm volatile("movdqa %0,%%xmm15" : : "m" (gfconst16.low4[0]));
|
||||
|
||||
|
|
|
|||
7
raid.h
7
raid.h
|
|
@ -56,13 +56,6 @@
|
|||
*/
|
||||
#define RAID_DATA_MAX 251
|
||||
|
||||
/**
|
||||
* Minimum number of data disks.
|
||||
* Some optimizations require at least two disks.
|
||||
* It's anyway allowed to have a single data disk with a sigle parity.
|
||||
*/
|
||||
#define RAID_DATA_MIN 2
|
||||
|
||||
/**
|
||||
* Initializes the RAID system.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -429,5 +429,6 @@ void selftest()
|
|||
recovtest(RAID_MODE_VANDERMONDE, 12, 256);
|
||||
gentest(RAID_MODE_CAUCHY, 32, 256);
|
||||
recovtest(RAID_MODE_CAUCHY, 12, 256);
|
||||
gentest(RAID_MODE_CAUCHY, 1, 256);
|
||||
}
|
||||
|
||||
|
|
|
|||
5
state.c
5
state.c
|
|
@ -895,11 +895,6 @@ static void state_map(struct snapraid_state* state)
|
|||
fprintf(stderr, "Too many data disks. No more than %u.\n", RAID_DATA_MAX);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
/* some raid functions assume at least two data disk */
|
||||
if (state->level > 1 && diskcount < RAID_DATA_MIN) {
|
||||
fprintf(stderr, "Too few data disks. You must define at least %u.\n", RAID_DATA_MIN);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* recommend number of parities */
|
||||
if (diskcount >= 36 && state->level < 6) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue