diff options
author | Alexander Lyakas <alex.bolshoy@gmail.com> | 2012-10-10 22:50:12 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2012-10-10 22:50:12 -0400 |
commit | a7854487cd7128a30a7f4f5259de9f67d5efb95f (patch) | |
tree | 8eaa70d6fec12a94c75ee023cbf4170789665d5f /drivers | |
parent | b97390aec4756373168ad2976e1f117b610513ea (diff) |
md: When RAID5 is dirty, force reconstruct-write instead of read-modify-write.
Signed-off-by: Alex Lyakas <alex@zadarastorage.com>
Suggested-by: Yair Hershko <yair@zadarastorage.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/md/raid5.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index d11012604e28..9de8221f64ec 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -2806,12 +2806,25 @@ static void handle_stripe_dirtying(struct r5conf *conf, | |||
2806 | int disks) | 2806 | int disks) |
2807 | { | 2807 | { |
2808 | int rmw = 0, rcw = 0, i; | 2808 | int rmw = 0, rcw = 0, i; |
2809 | if (conf->max_degraded == 2) { | 2809 | sector_t recovery_cp = conf->mddev->recovery_cp; |
2810 | /* RAID6 requires 'rcw' in current implementation | 2810 | |
2811 | * Calculate the real rcw later - for now fake it | 2811 | /* RAID6 requires 'rcw' in current implementation. |
2812 | * Otherwise, check whether resync is now happening or should start. | ||
2813 | * If yes, then the array is dirty (after unclean shutdown or | ||
2814 | * initial creation), so parity in some stripes might be inconsistent. | ||
2815 | * In this case, we need to always do reconstruct-write, to ensure | ||
2816 | * that in case of drive failure or read-error correction, we | ||
2817 | * generate correct data from the parity. | ||
2818 | */ | ||
2819 | if (conf->max_degraded == 2 || | ||
2820 | (recovery_cp < MaxSector && sh->sector >= recovery_cp)) { | ||
2821 | /* Calculate the real rcw later - for now make it | ||
2812 | * look like rcw is cheaper | 2822 | * look like rcw is cheaper |
2813 | */ | 2823 | */ |
2814 | rcw = 1; rmw = 2; | 2824 | rcw = 1; rmw = 2; |
2825 | pr_debug("force RCW max_degraded=%u, recovery_cp=%llu sh->sector=%llu\n", | ||
2826 | conf->max_degraded, (unsigned long long)recovery_cp, | ||
2827 | (unsigned long long)sh->sector); | ||
2815 | } else for (i = disks; i--; ) { | 2828 | } else for (i = disks; i--; ) { |
2816 | /* would I have to read this buffer for read_modify_write */ | 2829 | /* would I have to read this buffer for read_modify_write */ |
2817 | struct r5dev *dev = &sh->dev[i]; | 2830 | struct r5dev *dev = &sh->dev[i]; |