Commit a7854487 authored by Alexander Lyakas's avatar Alexander Lyakas Committed by NeilBrown

md: When RAID5 is dirty, force reconstruct-write instead of read-modify-write.

Signed-off-by: default avatarAlex Lyakas <alex@zadarastorage.com>
Suggested-by: default avatarYair Hershko <yair@zadarastorage.com>
Signed-off-by: default avatarNeilBrown <neilb@suse.de>
parent b97390ae
...@@ -2806,12 +2806,25 @@ static void handle_stripe_dirtying(struct r5conf *conf, ...@@ -2806,12 +2806,25 @@ static void handle_stripe_dirtying(struct r5conf *conf,
int disks) int disks)
{ {
int rmw = 0, rcw = 0, i; int rmw = 0, rcw = 0, i;
if (conf->max_degraded == 2) { sector_t recovery_cp = conf->mddev->recovery_cp;
/* RAID6 requires 'rcw' in current implementation
* Calculate the real rcw later - for now fake it /* RAID6 requires 'rcw' in current implementation.
* Otherwise, check whether resync is now happening or should start.
* If yes, then the array is dirty (after unclean shutdown or
* initial creation), so parity in some stripes might be inconsistent.
* In this case, we need to always do reconstruct-write, to ensure
* that in case of drive failure or read-error correction, we
* generate correct data from the parity.
*/
if (conf->max_degraded == 2 ||
(recovery_cp < MaxSector && sh->sector >= recovery_cp)) {
/* Calculate the real rcw later - for now make it
* look like rcw is cheaper * look like rcw is cheaper
*/ */
rcw = 1; rmw = 2; rcw = 1; rmw = 2;
pr_debug("force RCW max_degraded=%u, recovery_cp=%llu sh->sector=%llu\n",
conf->max_degraded, (unsigned long long)recovery_cp,
(unsigned long long)sh->sector);
} else for (i = disks; i--; ) { } else for (i = disks; i--; ) {
/* would I have to read this buffer for read_modify_write */ /* would I have to read this buffer for read_modify_write */
struct r5dev *dev = &sh->dev[i]; struct r5dev *dev = &sh->dev[i];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment