diff options
author | Jianchao Wang <jianchao.w.wang@oracle.com> | 2019-01-24 13:25:33 +0300 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2019-02-01 18:33:43 +0300 |
commit | bb94aea1444b9859faa8d72aff3713fcd11c6696 (patch) | |
tree | 0ac5fc4f031d07a8368dff0b773f7d10f83fa80a /block/blk-mq.h | |
parent | 8ccdf4a3775229314c8bd365ac88c2cbdf36be13 (diff) | |
download | linux-bb94aea1444b9859faa8d72aff3713fcd11c6696.tar.xz |
blk-mq: save default hctx into ctx->hctxs for not-supported type
Currently, we check whether the hctx type is supported every time
in hot path. Actually, this is not necessary, we could save the
default hctx into ctx->hctxs if the type is not supported when
map swqueues and use it directly with ctx->hctxs[type].
We also needn't check whether the poll is enabled or not, because
the caller would clear the REQ_HIPRI in that case.
Signed-off-by: Jianchao Wang <jianchao.w.wang@oracle.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-mq.h')
-rw-r--r-- | block/blk-mq.h | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/block/blk-mq.h b/block/blk-mq.h index 9fb06261518e..14b7efb94f75 100644 --- a/block/blk-mq.h +++ b/block/blk-mq.h @@ -106,15 +106,12 @@ static inline struct blk_mq_hw_ctx *blk_mq_map_queue(struct request_queue *q, { enum hctx_type type = HCTX_TYPE_DEFAULT; - 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)) + /* + * The caller ensure that if REQ_HIPRI, poll must be enabled. + */ + if (flags & REQ_HIPRI) type = HCTX_TYPE_POLL; - - 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) + else if ((flags & REQ_OP_MASK) == REQ_OP_READ) type = HCTX_TYPE_READ; return ctx->hctxs[type]; |