consistancy check/correct

It would be good to ask an array to check if it is in-sync, and optionally to correct any errors.

This requires a good interface and an efficient implementation.

Interface

It would seem that an IOCTL would be the most straight-forward way to manage consistancy checking, despite the fact that they are frowned on these days. The alternates would be a new filesystem which seems a bit heavy handed, or something in sysfs which I would rather avoid for now.

A single IOCTL could be used that can combine the functionality of waiting for any current check to complete, and then starting a new check. It could return the number of errors found or fixed in the previous pass.

The arg could contain bits indicating:

The return value, if not an error, is the number of errors found in the last pass that finished. If we waited, then the pass we waited for is the last one.

Implementation

The implementation for raid5 is quite trivial as the resync pass already does a check-and-repair.

Raid6 is more complicated as CHECK_PARITY is not implemented. It might be sufficient to allocate an extra page or two to calculate the missing block in and then do a memcmp. When to allocate and where to store is the tricky bit.

Raid1 definately requires more memory to be allocated. We need to read all the pages in parallel and do a memcmp. In r1buf_pool_alloc we can simply allocate more pages and store them in all bios instead of just the first. We would want a different read-complete path than the current one.

A tricky issue is what to do to correct an error. Hopefully any error should be in a part of the device that the filesystem doesn't care about. But we cannot be sure and we have to fix it, so choosing any block to over-write the others would do. If there is more than two copies and at least two have the same value, then the more common value should be used.


Home
Contact
Up



[æ]