btrfs: Make more generic the code for RAID 6 rebuilding

The original code which handles the recovery of a RAID 6 disks array
assumes that all reads are multiple of 1 << GRUB_DISK_SECTOR_BITS and it
assumes that all the I/O is done via the struct grub_diskfilter_segment.
This is not true for the btrfs code. In order to reuse the native
grub_raid6_recover() code, it is modified to not call
grub_diskfilter_read_node() directly, but to call an handler passed
as an argument.

Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
Goffredo Baroncelli 2018-10-22 19:29:38 +02:00 committed by Vincent Batts
parent 979c4ced63
commit 72a2af67ff
2 changed files with 43 additions and 18 deletions

View file

@ -189,6 +189,15 @@ typedef grub_err_t (*grub_raid6_recover_func_t) (struct grub_diskfilter_segment
extern grub_raid5_recover_func_t grub_raid5_recover_func;
extern grub_raid6_recover_func_t grub_raid6_recover_func;
typedef grub_err_t (* raid_recover_read_t)(void *data, int disk_nr,
grub_uint64_t addr, void *dest,
grub_size_t size);
extern grub_err_t
grub_raid6_recover_gen (void *data, grub_uint64_t nstripes, int disknr, int p,
char *buf, grub_uint64_t sector, grub_size_t size,
int layout, raid_recover_read_t read_func);
grub_err_t grub_diskfilter_vg_register (struct grub_diskfilter_vg *vg);
grub_err_t