Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

md/raid6 algorithms: xor_syndrome() for generic int

Start the algorithms with the very basic one. It is left and right
optimized. That means we can avoid all calculations for unneeded pages
above the right stop offset. For pages below the left start offset we
still need the syndrome multiplication but without reading data pages.

Signed-off-by: Markus Stockhausen <stockhausen@collogia.de>
Signed-off-by: NeilBrown <neilb@suse.de>

authored by

Markus Stockhausen and committed by
NeilBrown
9a5ce91d 7e92e1d7

+39 -1
+39 -1
lib/raid6/int.uc
··· 107 107 } 108 108 } 109 109 110 + static void raid6_int$#_xor_syndrome(int disks, int start, int stop, 111 + size_t bytes, void **ptrs) 112 + { 113 + u8 **dptr = (u8 **)ptrs; 114 + u8 *p, *q; 115 + int d, z, z0; 116 + 117 + unative_t wd$$, wq$$, wp$$, w1$$, w2$$; 118 + 119 + z0 = stop; /* P/Q right side optimization */ 120 + p = dptr[disks-2]; /* XOR parity */ 121 + q = dptr[disks-1]; /* RS syndrome */ 122 + 123 + for ( d = 0 ; d < bytes ; d += NSIZE*$# ) { 124 + /* P/Q data pages */ 125 + wq$$ = wp$$ = *(unative_t *)&dptr[z0][d+$$*NSIZE]; 126 + for ( z = z0-1 ; z >= start ; z-- ) { 127 + wd$$ = *(unative_t *)&dptr[z][d+$$*NSIZE]; 128 + wp$$ ^= wd$$; 129 + w2$$ = MASK(wq$$); 130 + w1$$ = SHLBYTE(wq$$); 131 + w2$$ &= NBYTES(0x1d); 132 + w1$$ ^= w2$$; 133 + wq$$ = w1$$ ^ wd$$; 134 + } 135 + /* P/Q left side optimization */ 136 + for ( z = start-1 ; z >= 0 ; z-- ) { 137 + w2$$ = MASK(wq$$); 138 + w1$$ = SHLBYTE(wq$$); 139 + w2$$ &= NBYTES(0x1d); 140 + wq$$ = w1$$ ^ w2$$; 141 + } 142 + *(unative_t *)&p[d+NSIZE*$$] ^= wp$$; 143 + *(unative_t *)&q[d+NSIZE*$$] ^= wq$$; 144 + } 145 + 146 + } 147 + 110 148 const struct raid6_calls raid6_intx$# = { 111 149 raid6_int$#_gen_syndrome, 112 - NULL, /* XOR not yet implemented */ 150 + raid6_int$#_xor_syndrome, 113 151 NULL, /* always valid */ 114 152 "int" NSTRING "x$#", 115 153 0