Skip to content

Commit

Permalink
blk-mq: skip zero-queue maps in blk_mq_map_swqueue
Browse files Browse the repository at this point in the history
From 7e849dd ("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]>
Reviewed-by: Christoph Hellwig <[email protected]>
Signed-off-by: Ming Lei <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Ming Lei authored and axboe committed Dec 17, 2018
1 parent 1336981 commit e5edd5f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions block/blk-mq.c
Original file line number Diff line number Diff line change
Expand Up @@ -2438,6 +2438,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);

/*
Expand Down

0 comments on commit e5edd5f

Please sign in to comment.