Commit 5aceaeb2 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

blk-mq: only dispatch to non-defauly queue maps if they have queues

We should check if a given queue map actually has queues enabled before
dispatching to it.  This allows drivers to not initialize optional but
not used map types, which subsequently will allow fixing problems with
queue map rebuilds for that case.
Reviewed-by: default avatarMing Lei <ming.lei@redhat.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 346fc108
...@@ -105,14 +105,17 @@ static inline struct blk_mq_hw_ctx *blk_mq_map_queue(struct request_queue *q, ...@@ -105,14 +105,17 @@ static inline struct blk_mq_hw_ctx *blk_mq_map_queue(struct request_queue *q,
{ {
enum hctx_type type = HCTX_TYPE_DEFAULT; enum hctx_type type = HCTX_TYPE_DEFAULT;
if (q->tag_set->nr_maps > HCTX_TYPE_POLL && if ((flags & REQ_HIPRI) &&
((flags & REQ_HIPRI) && test_bit(QUEUE_FLAG_POLL, &q->queue_flags))) q->tag_set->nr_maps > HCTX_TYPE_POLL &&
q->tag_set->map[HCTX_TYPE_POLL].nr_queues &&
test_bit(QUEUE_FLAG_POLL, &q->queue_flags))
type = HCTX_TYPE_POLL; type = HCTX_TYPE_POLL;
else if (q->tag_set->nr_maps > HCTX_TYPE_READ && else if (((flags & REQ_OP_MASK) == REQ_OP_READ) &&
((flags & REQ_OP_MASK) == REQ_OP_READ)) q->tag_set->nr_maps > HCTX_TYPE_READ &&
q->tag_set->map[HCTX_TYPE_READ].nr_queues)
type = HCTX_TYPE_READ; type = HCTX_TYPE_READ;
return blk_mq_map_queue_type(q, type, cpu); return blk_mq_map_queue_type(q, type, cpu);
} }
......
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