2015-12-30 10:31:32

by Sanidhya Solanki

[permalink] [raw]
Subject: [PATCH] BTRFS: Runs the xor function if a Block has failed

The patch adds the xor function after the P stripe
has failed, without bad data or the Q stripe.

Signed-off-by: Sanidhya Solanki <[email protected]>
---
fs/btrfs/raid56.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
index 1a33d3e..d33734a 100644
--- a/fs/btrfs/raid56.c
+++ b/fs/btrfs/raid56.c
@@ -1864,8 +1864,8 @@ static void __raid_recover_end_io(struct btrfs_raid_bio *rbio)
/*
* Just the P stripe has failed, without
* a bad data or Q stripe.
- * TODO, we should redo the xor here.
*/
+ run_xor(pointers, rbio->nr_data - 1, PAGE_CACHE_SIZE);
err = -EIO;
goto cleanup;
}
--
2.5.0


2015-12-30 17:20:47

by David Sterba

[permalink] [raw]
Subject: Re: [PATCH] BTRFS: Runs the xor function if a Block has failed

On Wed, Dec 30, 2015 at 01:28:36AM -0500, Sanidhya Solanki wrote:
> The patch adds the xor function after the P stripe
> has failed, without bad data or the Q stripe.

That's just the comment copied, the changelog does not explain why it's
ok to do just the run_xor there. It does not seem trivial to me. Please
describe that the end result after the code change is expected.

> @@ -1864,8 +1864,8 @@ static void __raid_recover_end_io(struct btrfs_raid_bio *rbio)
> /*
> * Just the P stripe has failed, without
> * a bad data or Q stripe.
> - * TODO, we should redo the xor here.
> */
> + run_xor(pointers, rbio->nr_data - 1, PAGE_CACHE_SIZE);
> err = -EIO;
> goto cleanup;

2015-12-31 06:17:45

by Sanidhya Solanki

[permalink] [raw]
Subject: Re: [PATCH] BTRFS: Runs the xor function if a Block has failed

On Wed, 30 Dec 2015 18:18:26 +0100
David Sterba <[email protected]> wrote:

> That's just the comment copied, the changelog does not explain why
> it's ok to do just the run_xor there. It does not seem trivial to me.
> Please describe that the end result after the code change is expected.

In the RAID 6 case after a failure, we discover that the failure
affected the entire P stripe, without any bad data occurring. Hence, we
xor the previously stored parity data to return the data that was lost
in the P stripe failure.

The xor-red data is from the parity blocks. Hence, we are left with
recovered data belonging to the P stripe.

If there is an error during the completion of the xor (provided by the
patch ), we got to the cleanup function.

Hope that is satisfactory.