Commit c1d7ecf7 authored by Bart Van Assche's avatar Bart Van Assche Committed by Mike Snitzer

dm mpath: delay requeuing while path initialization is in progress

Requeuing a request immediately while path initialization is ongoing
causes high CPU usage, something that is undesired.  Hence delay
requeuing while path initialization is in progress.
Signed-off-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: default avatarHannes Reinecke <hare@suse.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
parent 7083abbb
...@@ -322,13 +322,16 @@ static int __pg_init_all_paths(struct multipath *m) ...@@ -322,13 +322,16 @@ static int __pg_init_all_paths(struct multipath *m)
return atomic_read(&m->pg_init_in_progress); return atomic_read(&m->pg_init_in_progress);
} }
static void pg_init_all_paths(struct multipath *m) static int pg_init_all_paths(struct multipath *m)
{ {
int ret;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&m->lock, flags); spin_lock_irqsave(&m->lock, flags);
__pg_init_all_paths(m); ret = __pg_init_all_paths(m);
spin_unlock_irqrestore(&m->lock, flags); spin_unlock_irqrestore(&m->lock, flags);
return ret;
} }
static void __switch_pg(struct multipath *m, struct priority_group *pg) static void __switch_pg(struct multipath *m, struct priority_group *pg)
...@@ -503,7 +506,8 @@ static int multipath_clone_and_map(struct dm_target *ti, struct request *rq, ...@@ -503,7 +506,8 @@ static int multipath_clone_and_map(struct dm_target *ti, struct request *rq,
return -EIO; /* Failed */ return -EIO; /* Failed */
} else if (test_bit(MPATHF_QUEUE_IO, &m->flags) || } else if (test_bit(MPATHF_QUEUE_IO, &m->flags) ||
test_bit(MPATHF_PG_INIT_REQUIRED, &m->flags)) { test_bit(MPATHF_PG_INIT_REQUIRED, &m->flags)) {
pg_init_all_paths(m); if (pg_init_all_paths(m))
return DM_MAPIO_DELAY_REQUEUE;
return DM_MAPIO_REQUEUE; return DM_MAPIO_REQUEUE;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment