raid6 algorithms: xor_syndrome() for generic int

Started by unknown sender on Aug 10, 2014

Subsystems (2)

Maintainers (2)

DORMANTno replies

open the first message on its own page

Message details and related content
commit e5edae519638e6dd46989df3381856c0a3dfc207
Author: Markus Stockhausen [off-list ref]
Date:   Sun Aug 10 09:46:32 2014 +0000

    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.
diff --git a/lib/raid6/int.uc b/lib/raid6/int.uc
index 283a9a3..d7a70ac 100644
--- a/lib/raid6/int.uc
+++ b/lib/raid6/int.uc
@@ -110,7 +110,38 @@ 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)
 {
-	/* enable hasxor if implemented */
+	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$# = {
@@ -119,7 +150,7 @@ const struct raid6_calls raid6_intx$# = {
 	NULL,			/* always valid */
 	"int" NSTRING "x$#",
 	0,
-	0			/* XOR not yet implemented */
+	1
 };
 
 #endif
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help