diff options
author | NeilBrown <neilb@suse.de> | 2006-10-03 04:15:46 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-03 11:04:17 -0400 |
commit | 850b2b420cd5b363ed4cf48a8816d656c8b5251b (patch) | |
tree | b63aa37b3fb7dfb7a0b674d5a2ebe9da13cc7405 /drivers/md/raid5.c | |
parent | 6814d5368d68341ec6b5e4ecd10ea5947130775a (diff) |
[PATCH] md: replace magic numbers in sb_dirty with well defined bit flags
Instead of magic numbers (0,1,2,3) in sb_dirty, we have
some flags instead:
MD_CHANGE_DEVS
Some device state has changed requiring superblock update
on all devices.
MD_CHANGE_CLEAN
The array has transitions from 'clean' to 'dirty' or back,
requiring a superblock update on active devices, but possibly
not on spares
MD_CHANGE_PENDING
A superblock update is underway.
We wait for an update to complete by waiting for all flags to be clear. A
flag can be set at any time, even during an update, without risk that the
change will be lost.
Stop exporting md_update_sb - isn't needed.
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/md/raid5.c')
-rw-r--r-- | drivers/md/raid5.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 450066007160..d5a06b258427 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -696,7 +696,7 @@ static void error(mddev_t *mddev, mdk_rdev_t *rdev) | |||
696 | PRINTK("raid5: error called\n"); | 696 | PRINTK("raid5: error called\n"); |
697 | 697 | ||
698 | if (!test_bit(Faulty, &rdev->flags)) { | 698 | if (!test_bit(Faulty, &rdev->flags)) { |
699 | mddev->sb_dirty = 1; | 699 | set_bit(MD_CHANGE_DEVS, &mddev->flags); |
700 | if (test_bit(In_sync, &rdev->flags)) { | 700 | if (test_bit(In_sync, &rdev->flags)) { |
701 | conf->working_disks--; | 701 | conf->working_disks--; |
702 | mddev->degraded++; | 702 | mddev->degraded++; |
@@ -2781,9 +2781,9 @@ static sector_t reshape_request(mddev_t *mddev, sector_t sector_nr, int *skipped | |||
2781 | wait_event(conf->wait_for_overlap, | 2781 | wait_event(conf->wait_for_overlap, |
2782 | atomic_read(&conf->reshape_stripes)==0); | 2782 | atomic_read(&conf->reshape_stripes)==0); |
2783 | mddev->reshape_position = conf->expand_progress; | 2783 | mddev->reshape_position = conf->expand_progress; |
2784 | mddev->sb_dirty = 1; | 2784 | set_bit(MD_CHANGE_DEVS, &mddev->flags); |
2785 | md_wakeup_thread(mddev->thread); | 2785 | md_wakeup_thread(mddev->thread); |
2786 | wait_event(mddev->sb_wait, mddev->sb_dirty == 0 || | 2786 | wait_event(mddev->sb_wait, mddev->flags == 0 || |
2787 | kthread_should_stop()); | 2787 | kthread_should_stop()); |
2788 | spin_lock_irq(&conf->device_lock); | 2788 | spin_lock_irq(&conf->device_lock); |
2789 | conf->expand_lo = mddev->reshape_position; | 2789 | conf->expand_lo = mddev->reshape_position; |
@@ -3605,7 +3605,7 @@ static int raid5_start_reshape(mddev_t *mddev) | |||
3605 | mddev->degraded = (conf->raid_disks - conf->previous_raid_disks) - added_devices; | 3605 | mddev->degraded = (conf->raid_disks - conf->previous_raid_disks) - added_devices; |
3606 | mddev->raid_disks = conf->raid_disks; | 3606 | mddev->raid_disks = conf->raid_disks; |
3607 | mddev->reshape_position = 0; | 3607 | mddev->reshape_position = 0; |
3608 | mddev->sb_dirty = 1; | 3608 | set_bit(MD_CHANGE_DEVS, &mddev->flags); |
3609 | 3609 | ||
3610 | clear_bit(MD_RECOVERY_SYNC, &mddev->recovery); | 3610 | clear_bit(MD_RECOVERY_SYNC, &mddev->recovery); |
3611 | clear_bit(MD_RECOVERY_CHECK, &mddev->recovery); | 3611 | clear_bit(MD_RECOVERY_CHECK, &mddev->recovery); |