diff --git a/raid.c b/raid.c index df63498c..6432a11f 100644 --- a/raid.c +++ b/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;ilevel > 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) {