summaryrefslogtreecommitdiffstats
path: root/drivers/md/md.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2010-06-01 19:37:29 +1000
committerNeilBrown <neilb@suse.de>2010-07-26 12:53:08 +1000
commit252ac5221a71be72b7e7c7b7482af91e9c962e8c (patch)
treecb9542b1391dabc136ce0052eb28948e77a6e2e5 /drivers/md/md.c
parent2ac8740151b082f045e58010eb92560c3a23a0e9 (diff)
downloadlinux-252ac5221a71be72b7e7c7b7482af91e9c962e8c.tar.gz
linux-252ac5221a71be72b7e7c7b7482af91e9c962e8c.tar.bz2
linux-252ac5221a71be72b7e7c7b7482af91e9c962e8c.zip
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.c15
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)
mddev->bitmap_info.chunksize = 0;
mddev->bitmap_info.daemon_sleep = 0;
mddev->bitmap_info.max_write_behind = 0;
+ mddev->plug = NULL;
}
void md_stop_writes(mddev_t *mddev)
@@ -6626,6 +6627,14 @@ int md_allow_write(mddev_t *mddev)
}
EXPORT_SYMBOL_GPL(md_allow_write);
+static void md_unplug(mddev_t *mddev)
+{
+ if (mddev->queue)
+ blk_unplug(mddev->queue);
+ if (mddev->plug)
+ mddev->plug->unplug_fn(mddev->plug);
+}
+
#define SYNC_MARKS 10
#define SYNC_MARK_STEP (3*HZ)
void md_do_sync(mddev_t *mddev)
@@ -6804,7 +6813,7 @@ void md_do_sync(mddev_t *mddev)
>= mddev->resync_max - mddev->curr_resync_completed
)) {
/* time to update curr_resync_completed */
- blk_unplug(mddev->queue);
+ md_unplug(mddev);
wait_event(mddev->recovery_wait,
atomic_read(&mddev->recovery_active) == 0);
mddev->curr_resync_completed =
@@ -6882,7 +6891,7 @@ void md_do_sync(mddev_t *mddev)
* about not overloading the IO subsystem. (things like an
* e2fsck being done on the RAID array should execute fast)
*/
- blk_unplug(mddev->queue);
+ md_unplug(mddev);
cond_resched();
currspeed = ((unsigned long)(io_sectors-mddev->resync_mark_cnt))/2
@@ -6901,7 +6910,7 @@ void md_do_sync(mddev_t *mddev)
* this also signals 'finished resyncing' to md_stop
*/
out:
- blk_unplug(mddev->queue);
+ md_unplug(mddev);
wait_event(mddev->recovery_wait, !atomic_read(&mddev->recovery_active));