Skip to contentSkip to conversation

blk-mq: skip zero-queue maps in blk_mq_map_swqueue

PATCH Applied Ming Lei 3 participants 3 messages Dec 17, 2018 Block layer

lore
Share & tools
lore

Ming Lei

author
#0 lore raw

PATCH 1/1 blk-mq: skip zero-queue maps in blk_mq_map_swqueue

From 7e849dd9cf37 ("nvme-pci: don't share queue maps"), the mapping table won't be initialized actually if map->nr_queues is zero, so we can't use blk_mq_map_queue_type() to retrieve hctx any more.

This way still may cause broken mapping, fix it by skipping zero-queues maps in blk_mq_map_swqueue().

Cc Jeff Moyer <[email protected]>
Cc Mike Snitzer <[email protected]>
Cc Christoph Hellwig <[email protected]>
---
 block/blk-mq.c | 3 +++
 1 file changed, 3 insertions(+)
block/blk-mq.c +3 -0
index 17de117be019..8075b16c5228 100644
@@ -2433,6 +2433,9 @@ static void blk_mq_map_swqueue(struct request_queue *q)
 
 		ctx = per_cpu_ptr(q->queue_ctx, i);
 		for (j = 0; j < set->nr_maps; j++) {
+			if (!set->map[j].nr_queues)
+				continue;
+
 			hctx = blk_mq_map_queue_type(q, j, i);
 
 			/*
Signature · 1 line
2.9.5
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Ming Lei
Quoted 1 line

From 7e849dd9cf37 ("nvme-pci: don't share queue maps"), the mapping

table won't be initialized actually if map->nr_queues is zero, so we can't use blk_mq_map_queue_type() to retrieve hctx any more.

This way still may cause broken mapping, fix it by skipping zero-queues maps in blk_mq_map_swqueue().

Looks fine,

maintainer Applied
#2 lore raw
In reply to Ming Lei
Quoted 6 lines · Ming Lei

From 7e849dd9cf37 ("nvme-pci: don't share queue maps"), the mapping table won't be initialized actually if map->nr_queues is zero, so we can't use blk_mq_map_queue_type() to retrieve hctx any more.

This way still may cause broken mapping, fix it by skipping zero-queues maps in blk_mq_map_swqueue().

Applied, thanks.

Signature · 1 line
Jens Axboe