diff options
author | Jens Axboe <axboe@kernel.dk> | 2021-10-13 16:28:14 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2021-10-19 23:18:25 +0200 |
commit | a808a9d545cdffb964f27239d1fc0c6e2330b424 (patch) | |
tree | 4157216f874fa4385bc09f2ac1500cebee9a2ab0 /block/blk-mq.h | |
parent | blk-mq: don't handle non-flush requests in blk_insert_flush (diff) | |
download | linux-a808a9d545cdffb964f27239d1fc0c6e2330b424.tar.xz linux-a808a9d545cdffb964f27239d1fc0c6e2330b424.zip |
block: inline fast path of driver tag allocation
If we don't use an IO scheduler or have shared tags, then we don't need
to call into this external function at all. This saves ~2% for such
a setup.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-mq.h')
-rw-r--r-- | block/blk-mq.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/block/blk-mq.h b/block/blk-mq.h index ebf67f4d4f2e..d8ccb341e82e 100644 --- a/block/blk-mq.h +++ b/block/blk-mq.h @@ -258,7 +258,20 @@ static inline void blk_mq_put_driver_tag(struct request *rq) __blk_mq_put_driver_tag(rq->mq_hctx, rq); } -bool blk_mq_get_driver_tag(struct request *rq); +bool __blk_mq_get_driver_tag(struct blk_mq_hw_ctx *hctx, struct request *rq); + +static inline bool blk_mq_get_driver_tag(struct request *rq) +{ + struct blk_mq_hw_ctx *hctx = rq->mq_hctx; + + if (rq->tag != BLK_MQ_NO_TAG && + !(hctx->flags & BLK_MQ_F_TAG_QUEUE_SHARED)) { + hctx->tags->rqs[rq->tag] = rq; + return true; + } + + return __blk_mq_get_driver_tag(hctx, rq); +} static inline void blk_mq_clear_mq_map(struct blk_mq_queue_map *qmap) { |