nvme: simplify nvme_req_qid()
PATCH 1/1 nvme: simplify nvme_req_qid()
blk_mq_unique_tag() just makes a unique tag which holds not only the tag, but also the queue_num of the hctx. With this unique tag, blk_mq_unique_tag_to_hwq is nothing but removing the tag from it.
Therefore the qid or the I/O queues can simply be:
(struct blk_mq_hw_ctx *)->queue_num + 1
--- drivers/nvme/host/nvme.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/nvme.h +1 -1
@@ -126,7 +126,7 @@ static inline u16 nvme_req_qid(struct request *req) {if (!req->rq_disk)return 0 ; -return blk_mq_unique_tag_to_hwq (blk_mq_unique_tag (req)) +1 ; +return req->mq_hctx->queue_num +1 ; }/* The below value is the specific amount of delay needed before checking
Signature · 1 line
2.17.1
Sagi Grimberg
maintainerPATCH 1/1 nvme: simplify nvme_req_qid()
Quoted 7 lines
blk_mq_unique_tag()just makes a unique tag which holds not only the tag, but also thequeue_numof the hctx. With this unique tag,blk_mq_unique_tag_to_hwqis nothing but removing the tag from it.Therefore the qid or the I/O queues can simply be:
(struct blk_mq_hw_ctx *)->queue_num + 1
This pattern is not unique to nvme, perhaps add a helper for it in the block layer and modify the callers?
PATCH 1/1 nvme: simplify nvme_req_qid()
Hi, Sagi.
Quoted 9 lines
Quoted 6 lines
blk_mq_unique_tag()just makes a unique tag which holds not only the tag, but also thequeue_numof the hctx. With this unique tag,blk_mq_unique_tag_to_hwqis nothing but removing the tag from it.Therefore the qid or the I/O queues can simply be:
(struct blk_mq_hw_ctx *)->queue_num + 1This pattern is not unique to nvme, perhaps add a helper for it in the block layer and modify the callers?
Sorry, but could you please elaborate a little bit more in detail that Why the pattern is not unique to nvme ?
Thanks,
Sagi Grimberg
maintainerPATCH 1/1 nvme: simplify nvme_req_qid()
Quoted 7 lines
Hi, Sagi.
Quoted 4 lines
Quoted 4 lines
blk_mq_unique_tag()just makes a unique tag which holds not only the tag, but also thequeue_numof the hctx. With this unique tag,blk_mq_unique_tag_to_hwqis nothing but removing the tag from it.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Therefore the qid or the I/O queues can simply be:
(struct blk_mq_hw_ctx *)->queue_num + 1This pattern is not unique to nvme, perhaps add a helper for it in the block layer and modify the callers?
Sorry, but could you please elaborate a little bit more in detail that Why the pattern is not unique to nvme ?
This is at least used by smartqpi (although I did remember that more used to use it...)