summaryrefslogtreecommitdiffstats
path: root/lib/raid6/int.uc
diff options
context:
space:
mode:
authorMarkus Stockhausen <stockhausen@collogia.de>2014-12-15 12:57:04 +1100
committerNeilBrown <neilb@suse.de>2015-04-22 08:00:42 +1000
commit9a5ce91d053961b7cc8fa56bd083819a9fc92734 (patch)
tree1c2883a6282bfcf31e0aa4adbdaeff1b9bf1872b /lib/raid6/int.uc
parent7e92e1d7629b00578cef22b1f4c6ada726663701 (diff)
downloadlinux-9a5ce91d053961b7cc8fa56bd083819a9fc92734.tar.gz
linux-9a5ce91d053961b7cc8fa56bd083819a9fc92734.tar.bz2
linux-9a5ce91d053961b7cc8fa56bd083819a9fc92734.zip
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>
Diffstat (limited to 'lib/raid6/int.uc')
-rw-r--r--lib/raid6/int.uc40
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)
}
}
+static void raid6_int$#_xor_syndrome(int disks, int start, int stop,
+ size_t bytes, void **ptrs)
+{
+ u8 **dptr = (u8 **)ptrs;
+ u8 *p, *q;
+ int d, z, z0;
+
+ unative_t wd$$, wq$$, wp$$, w1$$, w2$$;
+
+ z0 = stop; /* P/Q right side optimization */
+ p = dptr[disks-2]; /* XOR parity */
+ q = dptr[disks-1]; /* RS syndrome */
+
+ for ( d = 0 ; d < bytes ; d += NSIZE*$# ) {
+ /* P/Q data pages */
+ wq$$ = wp$$ = *(unative_t *)&dptr[z0][d+$$*NSIZE];
+ for ( z = z0-1 ; z >= start ; z-- ) {
+ wd$$ = *(unative_t *)&dptr[z][d+$$*NSIZE];
+ wp$$ ^= wd$$;
+ w2$$ = MASK(wq$$);
+ w1$$ = SHLBYTE(wq$$);
+ w2$$ &= NBYTES(0x1d);
+ w1$$ ^= w2$$;
+ wq$$ = w1$$ ^ wd$$;
+ }
+ /* P/Q left side optimization */
+ for ( z = start-1 ; z >= 0 ; z-- ) {
+ w2$$ = MASK(wq$$);
+ w1$$ = SHLBYTE(wq$$);
+ w2$$ &= NBYTES(0x1d);
+ wq$$ = w1$$ ^ w2$$;
+ }
+ *(unative_t *)&p[d+NSIZE*$$] ^= wp$$;
+ *(unative_t *)&q[d+NSIZE*$$] ^= wq$$;
+ }
+
+}
+
const struct raid6_calls raid6_intx$# = {
raid6_int$#_gen_syndrome,
- NULL, /* XOR not yet implemented */
+ raid6_int$#_xor_syndrome,
NULL, /* always valid */
"int" NSTRING "x$#",
0