Skip to contentSkip to conversation

nvme: simplify nvme_req_qid()

PATCH New Minwoo Im 3 participants 4 messages Aug 4, 2019 – Aug 13, 2019 NVMe

lore
Share & tools
lore

Minwoo Im

author
#0 lore raw

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
Cc Keith Busch <kbusch at kernel.org>
Cc Jens Axboe <axboe at fb.com>
Cc Christoph Hellwig <hch at lst.de>
Cc Sagi Grimberg <sagi at grimberg.me>
Signed-off-by Minwoo Im <minwoo.im.dev at gmail.com>
---
 drivers/nvme/host/nvme.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/nvme.h +1 -1
index 26b563f9985b..2e76198f5833 100644
@@ -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
maintainer
#1 lore raw

PATCH 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 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

This pattern is not unique to nvme, perhaps add a helper for it in the block layer and modify the callers?

#2 lore raw

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 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

This 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,

maintainer
#3 lore raw

PATCH 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 the queue_num of the hctx. With this unique tag, blk_mq_unique_tag_to_hwq is 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 + 1

This 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...)