[PATCH 4/9] btrfs: avoiding a rescan for a device which was already not founded.

2018-05-16 Thread Goffredo Baroncelli
If a device is not found, record this failure storing NULL in data->devices_attached[]. This avoid un-necessary devices rescan, speeding the reading in case of a degraded array. Signed-off-by: Goffredo Baroncelli <kreik...@inwind.it> --- grub-core/fs/btrfs.c | 19 +-

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

2018-05-16 Thread Goffredo Baroncelli
This is a preparatory patch. The callee knows better if this error is fatal or not, i.e. another available disk. Signed-off-by: Goffredo Baroncelli <kreij...@inwind.it> --- grub-core/fs/btrfs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/grub-core/fs/btrfs.c

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

2018-05-16 Thread Goffredo Baroncelli
-by: Goffredo Baroncelli <kreij...@inwind.it> --- grub-core/fs/btrfs.c | 85 +--- 1 file changed, 49 insertions(+), 36 deletions(-) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c index 51f300829..63651928b 100644 --- a/grub-core/fs/btrfs.c

Re: [PATCH 7/8] Make more generic the code for raid6 rebuilding

2018-05-15 Thread Goffredo Baroncelli
On 05/14/2018 09:07 PM, Daniel Kiper wrote: > On Mon, May 14, 2018 at 08:57:10PM +0200, Daniel Kiper wrote: >> On Fri, May 11, 2018 at 09:24:45PM +0200, Goffredo Baroncelli wrote: [...] >>> static grub_err_t >>> -grub_raid6_recover (struct grub_diskfilter_segment *ar

Re: [PATCH 7/8] Make more generic the code for raid6 rebuilding

2018-05-14 Thread Goffredo Baroncelli
On 05/14/2018 08:57 PM, Daniel Kiper wrote: > On Fri, May 11, 2018 at 09:24:45PM +0200, Goffredo Baroncelli wrote: [...] > >> +char *buf, grub_uint64_t sector, grub_size_t size, >> +raid_recover_read_t read_func, int layout

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

2018-05-11 Thread Goffredo Baroncelli
I was wrong this is the V3 patches set ; the subject is wrong. Sorry for the inconvenient. On 05/11/2018 09:24 PM, Goffredo Baroncelli wrote: > Hi All, > > the aim of this patches set is to provide support for a BTRFS raid5/6 > filesystem in GRUB. > > The first patch, im

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

2018-05-11 Thread Goffredo Baroncelli
I was wrong this is the V3 patches set ; the subject is wrong. Sorry for the inconvenient. On 05/11/2018 09:24 PM, Goffredo Baroncelli wrote: > Hi All, > > the aim of this patches set is to provide support for a BTRFS raid5/6 > filesystem in GRUB. > > The first patch, im

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

2018-05-11 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 4 patches, are preparatory ones. The 6th patch implements the raid5 recovery

[PATCH 7/8] Make more generic the code for raid6 rebuilding

2018-05-11 Thread Goffredo Baroncelli
native grub_raid6_recover() code, it is modified to not call grub_diskfilter_read_node directly, but to call an handler passed as argument. Signed-off-by: Goffredo Baroncelli <kreij...@inwind.it> --- grub-core/disk/raid6_recover.c | 52 ++ include/grub/diskfilter

[PATCH 6/8] Add support for recovery for a raid5 btrfs profiles.

2018-05-11 Thread Goffredo Baroncelli
Signed-off-by: Goffredo Baroncelli <kreij...@inwind.it> --- grub-core/fs/btrfs.c | 178 +-- 1 file changed, 173 insertions(+), 5 deletions(-) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c index fc4198e39..8d72607d1 100644 --- a/grub-c

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

2018-05-11 Thread Goffredo Baroncelli
This helper was used in few places to help the debugging. As conservative approach, in case of error it is only logged. This because I was unaware if this could change something the error handling of the previous code. Signed-off-by: Goffredo Baroncelli <kreij...@inwind.it> --- grub-c

[PATCH 1/8] Add support for reading a filesystem with a raid5 or raid6 profile.

2018-05-11 Thread Goffredo Baroncelli
Signed-off-by: Goffredo Baroncelli <kreij...@inwind.it> --- grub-core/fs/btrfs.c | 61 1 file changed, 61 insertions(+) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c index be195448d..7e287d0ec 100644 --- a/grub-core/fs/btrfs.c +++

[PATCH 8/8] Add raid6 recovery for a btrfs filesystem.

2018-05-11 Thread Goffredo Baroncelli
Add the raid6 recovery, in order to use a raid6 filesystem even if some disks (up to two) are missing. This code use the old md raid6 code already present in grub. Signed-off-by: Goffredo Baroncelli <kreij...@inwind.it> --- grub-core/fs/btrfs.c | 43 +++-

[PATCH 5/8] Refactor the code that read from disk

2018-05-11 Thread Goffredo Baroncelli
-by: Goffredo Baroncelli <kreij...@inwind.it> --- grub-core/fs/btrfs.c | 106 +-- 1 file changed, 61 insertions(+), 45 deletions(-) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c index 32c4382e5..fc4198e39 100644 --- a/grub-core/fs/btrfs.c +++

[PATCH 3/8] Move the error logging logic from find_device() to the callee.

2018-05-11 Thread Goffredo Baroncelli
This is a preparatory patch. The callee knows better if this error is fatal, or if it exists another available disk. Signed-off-by: Goffredo Baroncelli <kreij...@inwind.it> --- grub-core/fs/btrfs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/grub-core/fs/btr

Re: [PATCH 4/7] Avoiding scanning for an already not found device.

2018-05-09 Thread Goffredo Baroncelli
On 05/09/2018 04:07 PM, Daniel Kiper wrote: > On Tue, Apr 24, 2018 at 09:13:13PM +0200, Goffredo Baroncelli wrote: >> If a device is missing, create the entry in data->devices_attached[] array. > > What kind of entry? Invalid one? Please clarify this. > >> This avoid

Re: [PATCH 5/7] Refactor the code of read from disk

2018-05-09 Thread Goffredo Baroncelli
On 05/09/2018 04:26 PM, Daniel Kiper wrote: > On Tue, Apr 24, 2018 at 09:13:14PM +0200, Goffredo Baroncelli wrote: >> This is a preparatory patch, to help the adding of the raid5/6 recovery code > > OK, but please tell us why this patch is needed? I will put this commit messa

Re: [PATCH 7/7] Add raid6 recovery.

2018-05-09 Thread Goffredo Baroncelli
On 05/09/2018 06:58 PM, Daniel Kiper wrote: > On Tue, Apr 24, 2018 at 09:13:16PM +0200, Goffredo Baroncelli wrote: >> The code origins from "raid6_recovery.c". The code was changed because the >> original one assumed that both the disk address and size are multiple of

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

2018-05-09 Thread Goffredo Baroncelli
On 05/09/2018 03:52 PM, Daniel Kiper wrote: > On Tue, Apr 24, 2018 at 09:13:11PM +0200, Goffredo Baroncelli wrote: >> This helper was used in few places to help the debugging. As conservative >> approach, in case of error it is only logged. > > Could you explain in the

Re: [PATCH 3/7] Move from the find_device the error logging logic to the callee.

2018-05-09 Thread Goffredo Baroncelli
On 05/09/2018 04:00 PM, Daniel Kiper wrote: > On Tue, Apr 24, 2018 at 09:13:12PM +0200, Goffredo Baroncelli wrote: >> Signed-off-by: Goffredo Baroncelli <kreij...@inwind.it> >> --- >> grub-core/fs/btrfs.c | 6 +++--- >> 1 file changed, 3 insertions(+), 3 deletion

Re: [PATCH 1/7] Add support for reading a filesystem with a raid5 or raid6 profile.

2018-05-09 Thread Goffredo Baroncelli
On 05/09/2018 03:46 PM, Daniel Kiper wrote: > On Tue, Apr 24, 2018 at 09:13:10PM +0200, Goffredo Baroncelli wrote: >> Signed-off-by: Goffredo Baroncelli <kreij...@inwind.it> >> --- >> grub-core/fs/btrfs.c | 32 >> 1 file changed,

Re: [PATCH 6/7] Add support for recovery for a raid5 btrfs profiles.

2018-05-09 Thread Goffredo Baroncelli
On 05/09/2018 06:46 PM, Daniel Kiper wrote: > On Tue, Apr 24, 2018 at 09:13:15PM +0200, Goffredo Baroncelli wrote: >> Signed-off-by: Goffredo Baroncelli <kreij...@inwind.it> >> --- >> grub-core/fs/btrfs.c | 206 +-- >> 1 f

Re: [PATCH V2] Add support for BTRFS raid5/6 to GRUB

2018-05-09 Thread Goffredo Baroncelli
On 05/09/2018 07:00 PM, Daniel Kiper wrote: > On Tue, Apr 24, 2018 at 09:13:09PM +0200, Goffredo Baroncelli wrote: >> >> Hi All, >> >> the aim of this patches set is to provide support for a BTRFS raid5/6 >> filesystem in GRUB. >> >> The first patch,

[PATCH 7/7] Add raid6 recovery.

2018-04-24 Thread Goffredo Baroncelli
data from the memory or disk. Signed-off-by: Goffredo Baroncelli <kreij...@inwind.it> --- grub-core/fs/btrfs.c | 211 +-- 1 file changed, 204 insertions(+), 7 deletions(-) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c index 5c76a68f3..

[PATCH 4/7] Avoiding scanning for an already not found device.

2018-04-24 Thread Goffredo Baroncelli
If a device is missing, create the entry in data->devices_attached[] array. This avoid un-necessary devices rescan. Signed-off-by: Goffredo Baroncelli <kreik...@inwind.it> --- grub-core/fs/btrfs.c | 19 +-- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/

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

2018-04-24 Thread Goffredo Baroncelli
This helper was used in few places to help the debugging. As conservative approach, in case of error it is only logged. Signed-off-by: Goffredo Baroncelli <kreij...@inwind.it> --- grub-core/fs/btrfs.c | 22 +- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git

[PATCH 5/7] Refactor the code of read from disk

2018-04-24 Thread Goffredo Baroncelli
This is a preparatory patch, to help the adding of the raid5/6 recovery code Signed-off-by: Goffredo Baroncelli <kreij...@inwind.it> --- grub-core/fs/btrfs.c | 111 --- 1 file changed, 62 insertions(+), 49 deletions(-) diff --git a/grub-core/fs/btr

[PATCH 6/7] Add support for recovery for a raid5 btrfs profiles.

2018-04-24 Thread Goffredo Baroncelli
Signed-off-by: Goffredo Baroncelli <kreij...@inwind.it> --- grub-core/fs/btrfs.c | 206 +-- 1 file changed, 199 insertions(+), 7 deletions(-) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c index 697322125..5c76a68f3 100644 --- a/grub-c

[PATCH 3/7] Move from the find_device the error logging logic to the callee.

2018-04-24 Thread Goffredo Baroncelli
Signed-off-by: Goffredo Baroncelli <kreij...@inwind.it> --- 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/btrfs.c index 01a1fc7a1..745bb854e 100644 --- a/grub-core/fs/btrfs.c +++ b/grub-core/fs/btrfs.c @@

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

2018-04-24 Thread Goffredo Baroncelli
some feedback. I tested the code in grub-emu, and it works (for me) both with all the disks, and with some disks missing. I checked the sh1sums calculated from grub and from linux and these matched. Comments are welcome. BR G.Baroncelli -- gpg @keyserver.linux.it: Goffredo Baroncelli Key

[PATCH 1/7] Add support for reading a filesystem with a raid5 or raid6 profile.

2018-04-24 Thread Goffredo Baroncelli
Signed-off-by: Goffredo Baroncelli <kreij...@inwind.it> --- grub-core/fs/btrfs.c | 32 1 file changed, 32 insertions(+) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c index be195448d..b0032ea46 100644 --- a/grub-core/fs/btrfs.c +++ b/grub-c

Re: [RFC] Add support for BTRFS raid5/6 to GRUB

2018-04-23 Thread Goffredo Baroncelli
On 04/23/2018 01:50 PM, Daniel Kiper wrote: > On Tue, Apr 17, 2018 at 09:57:40PM +0200, Goffredo Baroncelli wrote: >> Hi All, >> >> Below you can find a patch to add support for accessing files from >> grub in a RAID5/6 btrfs filesystem. This is a RFC because i

[RFC] Add support for BTRFS raid5/6 to GRUB

2018-04-17 Thread Goffredo Baroncelli
. Comments are welcome. BR G.Baroncelli --- commit 8c80a1b7c913faf50f95c5c76b4666ed17685666 Author: Goffredo Baroncelli <kreij...@inwind.it> Date: Tue Apr 17 21:40:31 2018 +0200 Add initial support for btrfs raid5/6 chunk diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c index be1

<    1   2