aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2013-08-27 02:28:23 -0400
committerNeilBrown <neilb@suse.de>2013-08-27 02:28:23 -0400
commit7a0a5355cbc71efa430c3730ffbd67ae04abfe31 (patch)
tree3e45ce8d666145ead0b859f402aa6fbf1f73f567 /drivers/md
parentc9ad020fec895bf1e5fcc322d0ab9e67efd3e3a0 (diff)
md: Don't test all of mddev->flags at once.
mddev->flags is mostly used to record if an update of the metadata is needed. Sometimes the whole field is tested instead of just the important bits. This makes it difficult to introduce more state bits. So replace all bare tests of mddev->flags with tests for the bits that actually need testing. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/md.c6
-rw-r--r--drivers/md/md.h5
2 files changed, 6 insertions, 5 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index a2678d882151..084a6540a4bd 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -5144,7 +5144,7 @@ int md_run(struct mddev *mddev)
5144 5144
5145 set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); 5145 set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
5146 5146
5147 if (mddev->flags) 5147 if (mddev->flags & MD_UPDATE_SB_FLAGS)
5148 md_update_sb(mddev, 0); 5148 md_update_sb(mddev, 0);
5149 5149
5150 md_new_event(mddev); 5150 md_new_event(mddev);
@@ -5289,7 +5289,7 @@ static void __md_stop_writes(struct mddev *mddev)
5289 md_super_wait(mddev); 5289 md_super_wait(mddev);
5290 5290
5291 if (mddev->ro == 0 && 5291 if (mddev->ro == 0 &&
5292 (!mddev->in_sync || mddev->flags)) { 5292 (!mddev->in_sync || (mddev->flags & MD_UPDATE_SB_FLAGS))) {
5293 /* mark array as shutdown cleanly */ 5293 /* mark array as shutdown cleanly */
5294 mddev->in_sync = 1; 5294 mddev->in_sync = 1;
5295 md_update_sb(mddev, 1); 5295 md_update_sb(mddev, 1);
@@ -7814,7 +7814,7 @@ void md_check_recovery(struct mddev *mddev)
7814 sysfs_notify_dirent_safe(mddev->sysfs_state); 7814 sysfs_notify_dirent_safe(mddev->sysfs_state);
7815 } 7815 }
7816 7816
7817 if (mddev->flags) 7817 if (mddev->flags & MD_UPDATE_SB_FLAGS)
7818 md_update_sb(mddev, 0); 7818 md_update_sb(mddev, 0);
7819 7819
7820 if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) && 7820 if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) &&
diff --git a/drivers/md/md.h b/drivers/md/md.h
index 20f02c0b5f2d..53283beda21b 100644
--- a/drivers/md/md.h
+++ b/drivers/md/md.h
@@ -204,11 +204,12 @@ struct mddev {
204 struct md_personality *pers; 204 struct md_personality *pers;
205 dev_t unit; 205 dev_t unit;
206 int md_minor; 206 int md_minor;
207 struct list_head disks; 207 struct list_head disks;
208 unsigned long flags; 208 unsigned long flags;
209#define MD_CHANGE_DEVS 0 /* Some device status has changed */ 209#define MD_CHANGE_DEVS 0 /* Some device status has changed */
210#define MD_CHANGE_CLEAN 1 /* transition to or from 'clean' */ 210#define MD_CHANGE_CLEAN 1 /* transition to or from 'clean' */
211#define MD_CHANGE_PENDING 2 /* switch from 'clean' to 'active' in progress */ 211#define MD_CHANGE_PENDING 2 /* switch from 'clean' to 'active' in progress */
212#define MD_UPDATE_SB_FLAGS (1 | 2 | 4) /* If these are set, md_update_sb needed */
212#define MD_ARRAY_FIRST_USE 3 /* First use of array, needs initialization */ 213#define MD_ARRAY_FIRST_USE 3 /* First use of array, needs initialization */
213 214
214 int suspended; 215 int suspended;
@@ -218,7 +219,7 @@ struct mddev {
218 * are happening, so run/ 219 * are happening, so run/
219 * takeover/stop are not safe 220 * takeover/stop are not safe
220 */ 221 */
221 int ready; /* See when safe to pass 222 int ready; /* See when safe to pass
222 * IO requests down */ 223 * IO requests down */
223 struct gendisk *gendisk; 224 struct gendisk *gendisk;
224 225