Messages in this thread | | | Date | Tue, 7 Jan 2014 11:33:57 +1100 | From | NeilBrown <> | Subject | Re: [RFC] lib: raid: New RAID library supporting up to six parities |
| |
On Mon, 6 Jan 2014 10:45:23 +0100 Andrea Mazzoleni <amadvance@gmail.com> wrote:
> Hi Neil, > > Thanks for your feedback. In the meantime I went further in developing and > I've just sent version 2 of the patch, that contains a preliminary btrfs > modification to use the new interface. > > Please use this one for any kind of review because it contains a modification > of the interface to match better the btrfs use. > I'll now try to do something similar to the async_tx layer and to improve the > code documentation as you recommended.
Thanks.
> > Anyway, a good entry point to understand the code is to start from the > include/linux/raid/raid.h file. It contains the functions that external > modules should call with a complete description of them. > > There is raid_par() used to compute parity, and raid_rec() to recover damaged > blocks. These two functions replace all the old xor_blocks and raid6 calls. > > And there is the raid_sort() you mention. It's an helper function that can be > used to ensure that the blocks indexes are passed at the raid interface in > proper order. In existing code I saw that the indexes are often sorted before > calling raid6, with something like: > > if (faila > failb) { > int tmp = failb; > failb = faila; > faila = tmp; > } > > To do the same with up to six failures, it's now required some kind of sort > function.
I'm not totally convinced by this, but then I haven't played with the code so maybe I'm wrong. I don't see the above as "sorting" faila and failb, but rather determining which one is first. Once you know which one is first, the remainder follow in order. So I would probably just make sure we always process the block is the "right" order. Then sorting would be irrelevant. But as I say, I haven't fiddled with the code, so maybe that would end up being more complex.
Thanks, NeilBrown
[unhandled content-type:application/pgp-signature] | |