Skip to content

Commit bfebd1c

Browse files
committed
dm: add full blk-mq support to request-based DM
Commit e5863d9 ("dm: allocate requests in target when stacking on blk-mq devices") served as the first step toward fully utilizing blk-mq in request-based DM -- it enabled stacking an old-style (request_fn) request_queue ontop of the underlying blk-mq device(s). That first step didn't improve performance of DM multipath ontop of fast blk-mq devices (e.g. NVMe) because the top-level old-style request_queue was severely limited by the queue_lock. The second step offered here enables stacking a blk-mq request_queue ontop of the underlying blk-mq device(s). This unlocks significant performance gains on fast blk-mq devices, Keith Busch tested on his NVMe testbed and offered this really positive news: "Just providing a performance update. All my fio tests are getting roughly equal performance whether accessed through the raw block device or the multipath device mapper (~470k IOPS). I could only push ~20% of the raw iops through dm before this conversion, so this latest tree is looking really solid from a performance standpoint." Signed-off-by: Mike Snitzer <[email protected]> Tested-by: Keith Busch <[email protected]>
1 parent 0ce6579 commit bfebd1c

File tree

4 files changed

+261
-73
lines changed

4 files changed

+261
-73
lines changed

drivers/md/dm-mpath.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1703,7 +1703,7 @@ static int multipath_busy(struct dm_target *ti)
17031703
*---------------------------------------------------------------*/
17041704
static struct target_type multipath_target = {
17051705
.name = "multipath",
1706-
.version = {1, 8, 0},
1706+
.version = {1, 9, 0},
17071707
.module = THIS_MODULE,
17081708
.ctr = multipath_ctr,
17091709
.dtr = multipath_dtr,

drivers/md/dm-table.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <linux/mutex.h>
1919
#include <linux/delay.h>
2020
#include <linux/atomic.h>
21+
#include <linux/blk-mq.h>
2122

2223
#define DM_MSG_PREFIX "table"
2324

@@ -1695,9 +1696,13 @@ void dm_table_run_md_queue_async(struct dm_table *t)
16951696
md = dm_table_get_md(t);
16961697
queue = dm_get_md_queue(md);
16971698
if (queue) {
1698-
spin_lock_irqsave(queue->queue_lock, flags);
1699-
blk_run_queue_async(queue);
1700-
spin_unlock_irqrestore(queue->queue_lock, flags);
1699+
if (queue->mq_ops)
1700+
blk_mq_run_hw_queues(queue, true);
1701+
else {
1702+
spin_lock_irqsave(queue->queue_lock, flags);
1703+
blk_run_queue_async(queue);
1704+
spin_unlock_irqrestore(queue->queue_lock, flags);
1705+
}
17011706
}
17021707
}
17031708
EXPORT_SYMBOL(dm_table_run_md_queue_async);

0 commit comments

Comments
 (0)