diff options
author | NeilBrown <neilb@suse.de> | 2010-06-01 05:37:29 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2010-07-25 22:53:08 -0400 |
commit | 252ac5221a71be72b7e7c7b7482af91e9c962e8c (patch) | |
tree | cb9542b1391dabc136ce0052eb28948e77a6e2e5 /drivers/md/md.c | |
parent | 2ac8740151b082f045e58010eb92560c3a23a0e9 (diff) |
md/plug: optionally use plugger to unplug an array during resync/recovery.
If an array doesn't have a 'queue' then md_do_sync cannot
unplug it.
In that case it will have a 'plugger', so make that available
to the mddev, and use it to unplug the array if needed.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r-- | drivers/md/md.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index eec75f130708..03c64e9735fb 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -4693,6 +4693,7 @@ static void md_clean(mddev_t *mddev) | |||
4693 | mddev->bitmap_info.chunksize = 0; | 4693 | mddev->bitmap_info.chunksize = 0; |
4694 | mddev->bitmap_info.daemon_sleep = 0; | 4694 | mddev->bitmap_info.daemon_sleep = 0; |
4695 | mddev->bitmap_info.max_write_behind = 0; | 4695 | mddev->bitmap_info.max_write_behind = 0; |
4696 | mddev->plug = NULL; | ||
4696 | } | 4697 | } |
4697 | 4698 | ||
4698 | void md_stop_writes(mddev_t *mddev) | 4699 | void md_stop_writes(mddev_t *mddev) |
@@ -6626,6 +6627,14 @@ int md_allow_write(mddev_t *mddev) | |||
6626 | } | 6627 | } |
6627 | EXPORT_SYMBOL_GPL(md_allow_write); | 6628 | EXPORT_SYMBOL_GPL(md_allow_write); |
6628 | 6629 | ||
6630 | static void md_unplug(mddev_t *mddev) | ||
6631 | { | ||
6632 | if (mddev->queue) | ||
6633 | blk_unplug(mddev->queue); | ||
6634 | if (mddev->plug) | ||
6635 | mddev->plug->unplug_fn(mddev->plug); | ||
6636 | } | ||
6637 | |||
6629 | #define SYNC_MARKS 10 | 6638 | #define SYNC_MARKS 10 |
6630 | #define SYNC_MARK_STEP (3*HZ) | 6639 | #define SYNC_MARK_STEP (3*HZ) |
6631 | void md_do_sync(mddev_t *mddev) | 6640 | void md_do_sync(mddev_t *mddev) |
@@ -6804,7 +6813,7 @@ void md_do_sync(mddev_t *mddev) | |||
6804 | >= mddev->resync_max - mddev->curr_resync_completed | 6813 | >= mddev->resync_max - mddev->curr_resync_completed |
6805 | )) { | 6814 | )) { |
6806 | /* time to update curr_resync_completed */ | 6815 | /* time to update curr_resync_completed */ |
6807 | blk_unplug(mddev->queue); | 6816 | md_unplug(mddev); |
6808 | wait_event(mddev->recovery_wait, | 6817 | wait_event(mddev->recovery_wait, |
6809 | atomic_read(&mddev->recovery_active) == 0); | 6818 | atomic_read(&mddev->recovery_active) == 0); |
6810 | mddev->curr_resync_completed = | 6819 | mddev->curr_resync_completed = |
@@ -6882,7 +6891,7 @@ void md_do_sync(mddev_t *mddev) | |||
6882 | * about not overloading the IO subsystem. (things like an | 6891 | * about not overloading the IO subsystem. (things like an |
6883 | * e2fsck being done on the RAID array should execute fast) | 6892 | * e2fsck being done on the RAID array should execute fast) |
6884 | */ | 6893 | */ |
6885 | blk_unplug(mddev->queue); | 6894 | md_unplug(mddev); |
6886 | cond_resched(); | 6895 | cond_resched(); |
6887 | 6896 | ||
6888 | currspeed = ((unsigned long)(io_sectors-mddev->resync_mark_cnt))/2 | 6897 | currspeed = ((unsigned long)(io_sectors-mddev->resync_mark_cnt))/2 |
@@ -6901,7 +6910,7 @@ void md_do_sync(mddev_t *mddev) | |||
6901 | * this also signals 'finished resyncing' to md_stop | 6910 | * this also signals 'finished resyncing' to md_stop |
6902 | */ | 6911 | */ |
6903 | out: | 6912 | out: |
6904 | blk_unplug(mddev->queue); | 6913 | md_unplug(mddev); |
6905 | 6914 | ||
6906 | wait_event(mddev->recovery_wait, !atomic_read(&mddev->recovery_active)); | 6915 | wait_event(mddev->recovery_wait, !atomic_read(&mddev->recovery_active)); |
6907 | 6916 | ||