{
enum hctx_type type = HCTX_TYPE_DEFAULT;
- if (q->tag_set->nr_maps > HCTX_TYPE_POLL &&
- ((flags & REQ_HIPRI) && test_bit(QUEUE_FLAG_POLL, &q->queue_flags)))
+ if ((flags & REQ_HIPRI) &&
+ 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;
- else if (q->tag_set->nr_maps > HCTX_TYPE_READ &&
- ((flags & REQ_OP_MASK) == REQ_OP_READ))
+ else if (((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;
-
+
return blk_mq_map_queue_type(q, type, cpu);
}