On 25/10/2021 13:01, Marek wrote:
Hi all,
I'm looking for the piece of code inside mdadm source code that
calculates parity can someone please point me to the part of source
code which implements parity creation?
Also is it just a simple XOR as described everywhere:
eg double word disk1 XOR double word disk2 XOR double word disk3 =
double word disk 4
or is something more complex going on.
thanks
Parity? Which parity? Yes something more complex is going on ...
I believe you are right with regards to raid-5, but with raid-6 that
approach doesn't work, it has to be much more complex.
Also, if you're looking in mdadm, you're looking in the wrong place.
There may be some code to do with parity there, but mdadm basically
manages WHAT IS SUPPOSED TO HAPPEN.
The actual "make it happen" code is in the md-raid drivers in the kernel
(not to be confused with the dm-raid code drivers, or the btrfs-raid
drivers, etc etc).
If you go to the linux-raid website it will hopefully give you more
information along the lines of what you want. Iirc there is a fairly
detailed explanation of raid-6 linked to from there ...
https://raid.wiki.kernel.org/index.php/Linux_Raid
Cheers,
Wol