[PATCH 1/9] btrfs: Add support for reading a filesystem with a RAID 5 or RAID 6 profile.

2018-06-03 Thread Goffredo Baroncelli
Signed-off-by: Goffredo Baroncelli --- grub-core/fs/btrfs.c | 70 1 file changed, 70 insertions(+) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c index be195448d..4d418859b 100644 --- a/grub-core/fs/btrfs.c +++ b/grub-core/fs/btrfs.c @@ -119

[PATCH 2/9] btrfs: Add helper to check the btrfs header.

2018-06-03 Thread Goffredo Baroncelli
This helper will be used in a few places to help the debugging. As conservative approach, in case of error it is only logged. This is because I am not sure if this can change something in the error handling of the currently existing code. Signed-off-by: Goffredo Baroncelli --- grub-core/fs/btrfs

[PATCH 6/9] btrfs: Refactor the code that read from disk

2018-06-03 Thread Goffredo Baroncelli
Move the code in charge to read the data from disk in a separate function. This helps to separate the error handling logic (which depend by the different raid profiles) from the read from disk logic. Refactoring this code increases the general readability too. This is a preparatory patch, to help

[PATCH 3/9] btrfs: Move the error logging from find_device() to its caller.

2018-06-03 Thread Goffredo Baroncelli
This is a preparatory patch. The caller knows better if this error is fatal or not, i.e. another disk is available or not. Signed-off-by: Goffredo Baroncelli --- grub-core/fs/btrfs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/bt

[PATCH V5] Add support for BTRFS raid5/6 to GRUB

2018-06-03 Thread Goffredo Baroncelli
Hi All, the aim of this patches set is to provide support for a BTRFS raid5/6 filesystem in GRUB. The first patch, implements the basic support for raid5/6. I.e this works when all the disks are present. The next 5 patches, are preparatory ones. The 7th patch implements the raid5 recovery for

[PATCH 9/9] btrfs: Add RAID 6 recovery for a btrfs filesystem.

2018-06-03 Thread Goffredo Baroncelli
Add the RAID 6 recovery, in order to use a RAID 6 filesystem even if some disks (up to two) are missing. This code use the md RAID 6 code already present in grub. Signed-off-by: Goffredo Baroncelli --- grub-core/fs/btrfs.c | 50 ++-- 1 file changed, 44 ins

[PATCH 5/9] btrfs: Move logging code in grub_btrfs_read_logical()

2018-06-03 Thread Goffredo Baroncelli
A portion of the logging code is moved outside of internal for(;;). The part that is left inside is the one which depends by the internal for(;;) index. This is a preparatory patch: in the next one it will be possible to refactor the code inside the for(;;) in an another function. Signed-off-by: G

[PATCH 7/9] btrfs: Add support for recovery for a RAID 5 btrfs profiles.

2018-06-03 Thread Goffredo Baroncelli
Add support for recovery fo a RAID 5 btrfs profile. In addition it is added some code as preparatory work for RAID 6 recovery code. Signed-off-by: Goffredo Baroncelli --- grub-core/fs/btrfs.c | 180 +-- 1 file changed, 175 insertions(+), 5 deletions(-) di

[PATCH 8/9] btrfs: Make more generic the code for RAID 6 rebuilding

2018-06-03 Thread Goffredo Baroncelli
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