Skip to main content

Module raid

Module raid 

Source
Expand description

RAID parity: XOR (P-only) and P+Q (RAID-6) generation and checking — ISA-L’s raid module semantics with validated, panic-free APIs.

Q is the classic RAID-6 syndrome Q = Σ 2^j · D_j over GF(2^8)/0x11d, computed Horner-style exactly as ISA-L’s pq_gen_base (last source first, q = s ^ 2·q), using the same word-parallel multiply-by-2 (eight byte lanes per u64: shift, isolate bit-7 lanes, expand to a lane mask, fold the polynomial). Where ISA-L requires 32-byte-multiple lengths and silently ignores sub-word tails in its base code, this port handles ANY length — word blocks plus an exact byte tail — and is gated both ways against real ISA-L (their outputs on aligned lens; their byte-wise checkers accepting our outputs on odd lens).

Structs§

PqMismatch
A P/Q consistency failure: the first offending byte offset and which parity it disagreed with (ISA-L’s i | 1 / i | 2 return, made typed).

Enums§

PqParity
Which parity vector a pq_check mismatch was found in.

Functions§

pq_check
Check sources against P and Q — ISA-L pq_check. Ok(None) means consistent; Ok(Some(_)) names the first mismatch.
pq_gen
RAID-6 P+Q of ≥2 sources — ISA-L pq_gen, any length.
xor_check
True when the XOR of ALL vectors (parity included) is zero — ISA-L xor_check. Word-wide with per-block early exit.
xor_gen
XOR parity of ≥2 sources into parity — ISA-L xor_gen.