All of lore.kernel.org
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Heinz Mauelshagen <heinzm@redhat.com>,
	Alasdair G Kergon <agk@redhat.com>
Cc: linux-raid@vger.kernel.org, dm-devel@redhat.com
Subject: [PATCH 12/24] md/plug: optionally use plugger to unplug an array during resync/recovery.
Date: Tue, 01 Jun 2010 19:56:19 +1000	[thread overview]
Message-ID: <20100601095619.565.35245.stgit@notabene.brown> (raw)
In-Reply-To: <20100601094414.565.3638.stgit@notabene.brown>

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 us it to unplug the array if needed.

Signed-off-by: NeilBrown <neilb@suse.de>
---
 drivers/md/md.c    |   15 ++++++++++++---
 drivers/md/md.h    |    2 ++
 drivers/md/raid5.c |    1 +
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index e44b9c6..ea6577b 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -4665,6 +4665,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)
@@ -6597,6 +6598,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)
@@ -6775,7 +6784,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 =
@@ -6853,7 +6862,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
@@ -6872,7 +6881,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));
 
diff --git a/drivers/md/md.h b/drivers/md/md.h
index f210482..0bf8c18 100644
--- a/drivers/md/md.h
+++ b/drivers/md/md.h
@@ -325,6 +325,8 @@ struct mddev_s
 	struct list_head		all_mddevs;
 
 	struct attribute_group		*to_remove;
+	struct plug_handle		*plug; /* if used by personality */
+
 	/* Generic barrier handling.
 	 * If there is a pending barrier request, all other
 	 * writes are blocked while the devices are flushed.
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 6b1802c..74bc7a6 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -5100,6 +5100,7 @@ static int run(mddev_t *mddev)
 	md_set_array_sectors(mddev, raid5_size(mddev, 0, 0));
 
 	plugger_init(&conf->plug, raid5_unplug);
+	mddev->plug = &conf->plug;
 	if (mddev->queue) {
 		/* read-ahead size must cover two whole stripes, which
 		 * is 2 * (datadisks) * chunksize where 'n' is the



  parent reply	other threads:[~2010-06-01  9:56 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-01  9:56 [PATCH 00/24] dm-raid456 support using md/raid5.c, now with dirty-log NeilBrown
2010-06-01  9:56 ` [PATCH 01/24] md: reduce dependence on sysfs NeilBrown
2010-06-01  9:56 ` [PATCH 02/24] md/raid5: factor out code for changing size of stripe cache NeilBrown
2010-06-01  9:56 ` [PATCH 03/24] md/raid5: ensure we create a unique name for kmem_cache when mddev has no gendisk NeilBrown
2010-06-01  9:56 ` [PATCH 13/24] dm-raid456: support unplug NeilBrown
2010-06-01  9:56 ` [PATCH 04/24] md: be more careful setting MD_CHANGE_CLEAN NeilBrown
2010-06-01  9:56 ` [PATCH 10/24] dm-raid456: add congestion checking NeilBrown
2010-06-01  9:56 ` [PATCH 08/24] dm-raid456: add support for raising events to userspace NeilBrown
2010-06-01  9:56 ` [PATCH 11/24] md/raid5: add simple plugging infrastructure NeilBrown
2010-06-01  9:56 ` NeilBrown [this message]
2010-06-01  9:56 ` [PATCH 05/24] md: split out md_rdev_init NeilBrown
2010-06-01  9:56 ` [PATCH 07/24] md/dm: create dm-raid456 module using md/raid5 NeilBrown
2010-06-01  9:56 ` [PATCH 14/24] dm-raid456: add support for setting IO hints NeilBrown
2010-06-01  9:56 ` [PATCH 06/24] md: export various start/stop interfaces NeilBrown
2010-06-01  9:56 ` [PATCH 09/24] raid5: Don't set read-ahead when there is no queue NeilBrown
2010-06-01  9:56 ` [PATCH 22/24] md/bitmap: prepare for storing write-intent-bitmap via dm-dirty-log NeilBrown
2010-06-01  9:56 ` [PATCH 19/24] md/bitmap: clean up plugging calls NeilBrown
2010-06-01  9:56 ` [PATCH 16/24] dm-raid456: add message handler NeilBrown
2010-06-01  9:56 ` [PATCH 17/24] md/bitmap: white space clean up and similar NeilBrown
2010-06-01  9:56 ` [PATCH 20/24] md/bitmap: optimise scanning of empty bitmaps NeilBrown
2010-06-01  9:56 ` [PATCH 24/24] dm-raid456: switch to use dm_dirty_log for tracking dirty regions NeilBrown
2010-06-01  9:56 ` [PATCH 15/24] dm-raid456: add suspend/resume method NeilBrown
2010-06-01  9:56 ` [PATCH 21/24] dm-dirty-log: allow log size to be different from target size NeilBrown
2010-06-02 14:57   ` Heinz Mauelshagen
2010-06-03  0:10     ` [dm-devel] " Neil Brown
2010-06-03  0:53       ` Heinz Mauelshagen
2010-06-01  9:56 ` [PATCH 18/24] md/bitmap: reduce dependence on sysfs NeilBrown
2010-06-01  9:56 ` [PATCH 23/24] md/bitmap: separate out loading a bitmap from initialising the structures NeilBrown
2010-06-15 13:23 ` [PATCH 00/24] dm-raid456 support using md/raid5.c, now with dirty-log Heinz Mauelshagen
2010-06-15 23:45   ` Neil Brown
2010-06-16 11:26     ` Heinz Mauelshagen
2010-06-17  5:41       ` Neil Brown
2010-06-17 10:47         ` Heinz Mauelshagen
2010-06-18  3:52           ` Neil Brown
2010-06-18 10:42             ` Heinz Mauelshagen
2010-06-21 23:09               ` Neil Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100601095619.565.35245.stgit@notabene.brown \
    --to=neilb@suse.de \
    --cc=agk@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=heinzm@redhat.com \
    --cc=linux-raid@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.