[dm-devel] [PATCH] dm-mpath: Only reprocess queued IO after pg initialization finished

Bart Van Assche bart.vanassche at sandisk.com
Fri Sep 30 15:59:06 UTC 2016


At least with dm-mq this patch reduces the number of multipath_busy()
calls while scsi_dh_activate() is in progress from a few million to
a few thousand.

Signed-off-by: Bart Van Assche <bart.vanassche at sandisk.com>
Cc: Hannes Reinecke <hare at suse.de>
Cc: Jun'ichi Nomura <j-nomura at ce.jp.nec.com>
Cc: <stable at vger.kernel.org>
---
 drivers/md/dm-mpath.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
index dd80af2..dd66653 100644
--- a/drivers/md/dm-mpath.c
+++ b/drivers/md/dm-mpath.c
@@ -343,12 +343,15 @@ static void multipath_init_per_bio_data(struct bio *bio, struct dm_mpath_io **mp
  * Path selection
  *-----------------------------------------------*/
 
+/* Returns a value > 0 if path group initialization is still in progress. */
 static int __pg_init_all_paths(struct multipath *m)
 {
 	struct pgpath *pgpath;
 	unsigned long pg_init_delay = 0;
 
-	if (atomic_read(&m->pg_init_in_progress) || test_bit(MPATHF_PG_INIT_DISABLED, &m->flags))
+	if (atomic_read(&m->pg_init_in_progress))
+		return 1;
+	if (test_bit(MPATHF_PG_INIT_DISABLED, &m->flags))
 		return 0;
 
 	atomic_inc(&m->pg_init_count);
-- 
2.10.0




More information about the dm-devel mailing list