diff options
author | NeilBrown <neilb@suse.de> | 2010-06-01 05:37:27 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2010-07-25 22:52:27 -0400 |
commit | 390ee602a142a93f2c7eb7bffee8e277058b8e0a (patch) | |
tree | 33a23748dd5ff4ea76b34ed3e458c6da91185376 /drivers/md | |
parent | e8bb9a839a26f076379e9cb9f46a879d210156f1 (diff) |
md: export various start/stop interfaces
export entry points for starting and stopping md arrays.
This will be used by a module to make md/raid5 work under
dm.
Also stop calling md_stop_writes from md_stop, as that won't
work well with dm - it will want to call the two separately.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/md.c | 21 | ||||
-rw-r--r-- | drivers/md/md.h | 7 |
2 files changed, 20 insertions, 8 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index 3de623aceed0..012482a900fc 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -261,7 +261,7 @@ static int md_make_request(struct request_queue *q, struct bio *bio) | |||
261 | * Once ->stop is called and completes, the module will be completely | 261 | * Once ->stop is called and completes, the module will be completely |
262 | * unused. | 262 | * unused. |
263 | */ | 263 | */ |
264 | static void mddev_suspend(mddev_t *mddev) | 264 | void mddev_suspend(mddev_t *mddev) |
265 | { | 265 | { |
266 | BUG_ON(mddev->suspended); | 266 | BUG_ON(mddev->suspended); |
267 | mddev->suspended = 1; | 267 | mddev->suspended = 1; |
@@ -269,13 +269,15 @@ static void mddev_suspend(mddev_t *mddev) | |||
269 | wait_event(mddev->sb_wait, atomic_read(&mddev->active_io) == 0); | 269 | wait_event(mddev->sb_wait, atomic_read(&mddev->active_io) == 0); |
270 | mddev->pers->quiesce(mddev, 1); | 270 | mddev->pers->quiesce(mddev, 1); |
271 | } | 271 | } |
272 | EXPORT_SYMBOL_GPL(mddev_suspend); | ||
272 | 273 | ||
273 | static void mddev_resume(mddev_t *mddev) | 274 | void mddev_resume(mddev_t *mddev) |
274 | { | 275 | { |
275 | mddev->suspended = 0; | 276 | mddev->suspended = 0; |
276 | wake_up(&mddev->sb_wait); | 277 | wake_up(&mddev->sb_wait); |
277 | mddev->pers->quiesce(mddev, 0); | 278 | mddev->pers->quiesce(mddev, 0); |
278 | } | 279 | } |
280 | EXPORT_SYMBOL_GPL(mddev_resume); | ||
279 | 281 | ||
280 | int mddev_congested(mddev_t *mddev, int bits) | 282 | int mddev_congested(mddev_t *mddev, int bits) |
281 | { | 283 | { |
@@ -416,7 +418,7 @@ static void mddev_put(mddev_t *mddev) | |||
416 | spin_unlock(&all_mddevs_lock); | 418 | spin_unlock(&all_mddevs_lock); |
417 | } | 419 | } |
418 | 420 | ||
419 | static void mddev_init(mddev_t *mddev) | 421 | void mddev_init(mddev_t *mddev) |
420 | { | 422 | { |
421 | mutex_init(&mddev->open_mutex); | 423 | mutex_init(&mddev->open_mutex); |
422 | mutex_init(&mddev->reconfig_mutex); | 424 | mutex_init(&mddev->reconfig_mutex); |
@@ -436,6 +438,7 @@ static void mddev_init(mddev_t *mddev) | |||
436 | mddev->resync_max = MaxSector; | 438 | mddev->resync_max = MaxSector; |
437 | mddev->level = LEVEL_NONE; | 439 | mddev->level = LEVEL_NONE; |
438 | } | 440 | } |
441 | EXPORT_SYMBOL_GPL(mddev_init); | ||
439 | 442 | ||
440 | static mddev_t * mddev_find(dev_t unit) | 443 | static mddev_t * mddev_find(dev_t unit) |
441 | { | 444 | { |
@@ -4333,7 +4336,7 @@ static void md_safemode_timeout(unsigned long data) | |||
4333 | 4336 | ||
4334 | static int start_dirty_degraded; | 4337 | static int start_dirty_degraded; |
4335 | 4338 | ||
4336 | static int md_run(mddev_t *mddev) | 4339 | int md_run(mddev_t *mddev) |
4337 | { | 4340 | { |
4338 | int err; | 4341 | int err; |
4339 | mdk_rdev_t *rdev; | 4342 | mdk_rdev_t *rdev; |
@@ -4537,6 +4540,7 @@ static int md_run(mddev_t *mddev) | |||
4537 | sysfs_notify(&mddev->kobj, NULL, "degraded"); | 4540 | sysfs_notify(&mddev->kobj, NULL, "degraded"); |
4538 | return 0; | 4541 | return 0; |
4539 | } | 4542 | } |
4543 | EXPORT_SYMBOL_GPL(md_run); | ||
4540 | 4544 | ||
4541 | static int do_md_run(mddev_t *mddev) | 4545 | static int do_md_run(mddev_t *mddev) |
4542 | { | 4546 | { |
@@ -4646,7 +4650,7 @@ static void md_clean(mddev_t *mddev) | |||
4646 | mddev->bitmap_info.max_write_behind = 0; | 4650 | mddev->bitmap_info.max_write_behind = 0; |
4647 | } | 4651 | } |
4648 | 4652 | ||
4649 | static void md_stop_writes(mddev_t *mddev) | 4653 | void md_stop_writes(mddev_t *mddev) |
4650 | { | 4654 | { |
4651 | if (mddev->sync_thread) { | 4655 | if (mddev->sync_thread) { |
4652 | set_bit(MD_RECOVERY_FROZEN, &mddev->recovery); | 4656 | set_bit(MD_RECOVERY_FROZEN, &mddev->recovery); |
@@ -4666,11 +4670,10 @@ static void md_stop_writes(mddev_t *mddev) | |||
4666 | md_update_sb(mddev, 1); | 4670 | md_update_sb(mddev, 1); |
4667 | } | 4671 | } |
4668 | } | 4672 | } |
4673 | EXPORT_SYMBOL_GPL(md_stop_writes); | ||
4669 | 4674 | ||
4670 | static void md_stop(mddev_t *mddev) | 4675 | void md_stop(mddev_t *mddev) |
4671 | { | 4676 | { |
4672 | md_stop_writes(mddev); | ||
4673 | |||
4674 | mddev->pers->stop(mddev); | 4677 | mddev->pers->stop(mddev); |
4675 | if (mddev->pers->sync_request && mddev->to_remove == NULL) | 4678 | if (mddev->pers->sync_request && mddev->to_remove == NULL) |
4676 | mddev->to_remove = &md_redundancy_group; | 4679 | mddev->to_remove = &md_redundancy_group; |
@@ -4678,6 +4681,7 @@ static void md_stop(mddev_t *mddev) | |||
4678 | mddev->pers = NULL; | 4681 | mddev->pers = NULL; |
4679 | clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); | 4682 | clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); |
4680 | } | 4683 | } |
4684 | EXPORT_SYMBOL_GPL(md_stop); | ||
4681 | 4685 | ||
4682 | static int md_set_readonly(mddev_t *mddev, int is_open) | 4686 | static int md_set_readonly(mddev_t *mddev, int is_open) |
4683 | { | 4687 | { |
@@ -4724,6 +4728,7 @@ static int do_md_stop(mddev_t * mddev, int mode, int is_open) | |||
4724 | if (mddev->ro) | 4728 | if (mddev->ro) |
4725 | set_disk_ro(disk, 0); | 4729 | set_disk_ro(disk, 0); |
4726 | 4730 | ||
4731 | md_stop_writes(mddev); | ||
4727 | md_stop(mddev); | 4732 | md_stop(mddev); |
4728 | mddev->queue->merge_bvec_fn = NULL; | 4733 | mddev->queue->merge_bvec_fn = NULL; |
4729 | mddev->queue->unplug_fn = NULL; | 4734 | mddev->queue->unplug_fn = NULL; |
diff --git a/drivers/md/md.h b/drivers/md/md.h index cc8030543e82..6e7e3495f6e4 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h | |||
@@ -487,5 +487,12 @@ extern void md_integrity_add_rdev(mdk_rdev_t *rdev, mddev_t *mddev); | |||
487 | extern int strict_strtoul_scaled(const char *cp, unsigned long *res, int scale); | 487 | extern int strict_strtoul_scaled(const char *cp, unsigned long *res, int scale); |
488 | extern void restore_bitmap_write_access(struct file *file); | 488 | extern void restore_bitmap_write_access(struct file *file); |
489 | 489 | ||
490 | extern void mddev_init(mddev_t *mddev); | ||
491 | extern int md_run(mddev_t *mddev); | ||
492 | extern void md_stop(mddev_t *mddev); | ||
493 | extern void md_stop_writes(mddev_t *mddev); | ||
490 | extern void md_rdev_init(mdk_rdev_t *rdev); | 494 | extern void md_rdev_init(mdk_rdev_t *rdev); |
495 | |||
496 | extern void mddev_suspend(mddev_t *mddev); | ||
497 | extern void mddev_resume(mddev_t *mddev); | ||
491 | #endif /* _MD_MD_H */ | 498 | #endif /* _MD_MD_H */ |