diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/raid6/int.uc | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/lib/raid6/int.uc b/lib/raid6/int.uc index 5ca60bee1388..558aeac9342a 100644 --- a/lib/raid6/int.uc +++ b/lib/raid6/int.uc | |||
@@ -107,9 +107,47 @@ static void raid6_int$#_gen_syndrome(int disks, size_t bytes, void **ptrs) | |||
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 | const struct raid6_calls raid6_intx$# = { | 148 | const struct raid6_calls raid6_intx$# = { |
111 | raid6_int$#_gen_syndrome, | 149 | raid6_int$#_gen_syndrome, |
112 | NULL, /* XOR not yet implemented */ | 150 | raid6_int$#_xor_syndrome, |
113 | NULL, /* always valid */ | 151 | NULL, /* always valid */ |
114 | "int" NSTRING "x$#", | 152 | "int" NSTRING "x$#", |
115 | 0 | 153 | 0 |