diff options
author | Shaohua Li <shli@fb.com> | 2017-01-04 19:10:19 -0500 |
---|---|---|
committer | Shaohua Li <shli@fb.com> | 2017-01-05 14:45:18 -0500 |
commit | 394ed8e4743b0cfc5496fe49059fbfc2bc8eae35 (patch) | |
tree | 65412c7b017be0fc1a2316f4a0778328421a0f4c /drivers/md/raid0.c | |
parent | 99f17890f04cff0262de7393c60a2f6d9c9c7e71 (diff) |
md: cleanup mddev flag clear for takeover
Commit 6995f0b (md: takeover should clear unrelated bits) clear
unrelated bits, but it's quite fragile. To avoid error in the future,
define a macro for unsupported mddev flags for each raid type and use it
to clear unsupported mddev flags. This should be less error-prone.
Suggested-by: NeilBrown <neilb@suse.com>
Signed-off-by: Shaohua Li <shli@fb.com>
Diffstat (limited to 'drivers/md/raid0.c')
-rw-r--r-- | drivers/md/raid0.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index a162fedeb51a..848365d474f3 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c | |||
@@ -26,6 +26,11 @@ | |||
26 | #include "raid0.h" | 26 | #include "raid0.h" |
27 | #include "raid5.h" | 27 | #include "raid5.h" |
28 | 28 | ||
29 | #define UNSUPPORTED_MDDEV_FLAGS \ | ||
30 | ((1L << MD_HAS_JOURNAL) | \ | ||
31 | (1L << MD_JOURNAL_CLEAN) | \ | ||
32 | (1L << MD_FAILFAST_SUPPORTED)) | ||
33 | |||
29 | static int raid0_congested(struct mddev *mddev, int bits) | 34 | static int raid0_congested(struct mddev *mddev, int bits) |
30 | { | 35 | { |
31 | struct r0conf *conf = mddev->private; | 36 | struct r0conf *conf = mddev->private; |
@@ -539,8 +544,7 @@ static void *raid0_takeover_raid45(struct mddev *mddev) | |||
539 | mddev->delta_disks = -1; | 544 | mddev->delta_disks = -1; |
540 | /* make sure it will be not marked as dirty */ | 545 | /* make sure it will be not marked as dirty */ |
541 | mddev->recovery_cp = MaxSector; | 546 | mddev->recovery_cp = MaxSector; |
542 | clear_bit(MD_HAS_JOURNAL, &mddev->flags); | 547 | mddev_clear_unsupported_flags(mddev, UNSUPPORTED_MDDEV_FLAGS); |
543 | clear_bit(MD_JOURNAL_CLEAN, &mddev->flags); | ||
544 | 548 | ||
545 | create_strip_zones(mddev, &priv_conf); | 549 | create_strip_zones(mddev, &priv_conf); |
546 | 550 | ||
@@ -583,7 +587,7 @@ static void *raid0_takeover_raid10(struct mddev *mddev) | |||
583 | mddev->degraded = 0; | 587 | mddev->degraded = 0; |
584 | /* make sure it will be not marked as dirty */ | 588 | /* make sure it will be not marked as dirty */ |
585 | mddev->recovery_cp = MaxSector; | 589 | mddev->recovery_cp = MaxSector; |
586 | clear_bit(MD_FAILFAST_SUPPORTED, &mddev->flags); | 590 | mddev_clear_unsupported_flags(mddev, UNSUPPORTED_MDDEV_FLAGS); |
587 | 591 | ||
588 | create_strip_zones(mddev, &priv_conf); | 592 | create_strip_zones(mddev, &priv_conf); |
589 | return priv_conf; | 593 | return priv_conf; |
@@ -626,7 +630,7 @@ static void *raid0_takeover_raid1(struct mddev *mddev) | |||
626 | mddev->raid_disks = 1; | 630 | mddev->raid_disks = 1; |
627 | /* make sure it will be not marked as dirty */ | 631 | /* make sure it will be not marked as dirty */ |
628 | mddev->recovery_cp = MaxSector; | 632 | mddev->recovery_cp = MaxSector; |
629 | clear_bit(MD_FAILFAST_SUPPORTED, &mddev->flags); | 633 | mddev_clear_unsupported_flags(mddev, UNSUPPORTED_MDDEV_FLAGS); |
630 | 634 | ||
631 | create_strip_zones(mddev, &priv_conf); | 635 | create_strip_zones(mddev, &priv_conf); |
632 | return priv_conf; | 636 | return priv_conf; |