Skip to content

Commit f45f118

Browse files
committed
dm mpath: factor out multipath_queue_bio
Enables further cleanup. Signed-off-by: Mike Snitzer <[email protected]>
1 parent 73265f3 commit f45f118

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

drivers/md/dm-mpath.c

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,18 @@ static void multipath_release_clone(struct request *clone,
574574
* Map cloned bios (bio-based multipath)
575575
*/
576576

577+
static void multipath_queue_bio(struct multipath *m, struct bio *bio)
578+
{
579+
unsigned long flags;
580+
581+
/* Queue for the daemon to resubmit */
582+
spin_lock_irqsave(&m->lock, flags);
583+
bio_list_add(&m->queued_bios, bio);
584+
if (!test_bit(MPATHF_QUEUE_IO, &m->flags))
585+
queue_work(kmultipathd, &m->process_queued_bios);
586+
spin_unlock_irqrestore(&m->lock, flags);
587+
}
588+
577589
static struct pgpath *__map_bio(struct multipath *m, struct bio *bio)
578590
{
579591
struct pgpath *pgpath;
@@ -590,16 +602,11 @@ static struct pgpath *__map_bio(struct multipath *m, struct bio *bio)
590602

591603
if ((pgpath && queue_io) ||
592604
(!pgpath && test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags))) {
593-
/* Queue for the daemon to resubmit */
594-
spin_lock_irqsave(&m->lock, flags);
595-
bio_list_add(&m->queued_bios, bio);
596-
spin_unlock_irqrestore(&m->lock, flags);
605+
multipath_queue_bio(m, bio);
597606

598607
/* PG_INIT_REQUIRED cannot be set without QUEUE_IO */
599608
if (queue_io || test_bit(MPATHF_PG_INIT_REQUIRED, &m->flags))
600609
pg_init_all_paths(m);
601-
else if (!queue_io)
602-
queue_work(kmultipathd, &m->process_queued_bios);
603610

604611
return ERR_PTR(-EAGAIN);
605612
}
@@ -1678,12 +1685,7 @@ static int multipath_end_io_bio(struct dm_target *ti, struct bio *clone,
16781685
spin_unlock_irqrestore(&m->lock, flags);
16791686
}
16801687

1681-
spin_lock_irqsave(&m->lock, flags);
1682-
bio_list_add(&m->queued_bios, clone);
1683-
if (!test_bit(MPATHF_QUEUE_IO, &m->flags))
1684-
queue_work(kmultipathd, &m->process_queued_bios);
1685-
spin_unlock_irqrestore(&m->lock, flags);
1686-
1688+
multipath_queue_bio(m, clone);
16871689
r = DM_ENDIO_INCOMPLETE;
16881690
done:
16891691
if (pgpath) {

0 commit comments

Comments
 (0)