* [PATCH] nvme: simplify nvme_req_qid()
@ 2019-08-04 7:19 Minwoo Im
2019-08-05 18:10 ` Sagi Grimberg
[not found] ` <CGME20190805181113epcas3p2fe0b38b9075ca205e5a8beff77531c10@epcms2p4>
0 siblings, 2 replies; 4+ messages in thread
From: Minwoo Im @ 2019-08-04 7:19 UTC (permalink / raw)
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(-)
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index 26b563f9985b..2e76198f5833 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -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
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] nvme: simplify nvme_req_qid()
2019-08-04 7:19 [PATCH] nvme: simplify nvme_req_qid() Minwoo Im
@ 2019-08-05 18:10 ` Sagi Grimberg
[not found] ` <CGME20190805181113epcas3p2fe0b38b9075ca205e5a8beff77531c10@epcms2p4>
1 sibling, 0 replies; 4+ messages in thread
From: Sagi Grimberg @ 2019-08-05 18:10 UTC (permalink / raw)
> 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?
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] nvme: simplify nvme_req_qid()
[not found] ` <CGME20190805181113epcas3p2fe0b38b9075ca205e5a8beff77531c10@epcms2p4>
@ 2019-08-12 11:01 ` Minwoo Im
2019-08-13 6:26 ` Sagi Grimberg
0 siblings, 1 reply; 4+ messages in thread
From: Minwoo Im @ 2019-08-12 11:01 UTC (permalink / raw)
Hi, Sagi.
> > 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,
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] nvme: simplify nvme_req_qid()
2019-08-12 11:01 ` Minwoo Im
@ 2019-08-13 6:26 ` Sagi Grimberg
0 siblings, 0 replies; 4+ messages in thread
From: Sagi Grimberg @ 2019-08-13 6:26 UTC (permalink / raw)
> Hi, Sagi.
>
>>> 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 ?
This is at least used by smartqpi (although I did remember that more
used to use it...)
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-08-13 6:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-04 7:19 [PATCH] nvme: simplify nvme_req_qid() Minwoo Im
2019-08-05 18:10 ` Sagi Grimberg
[not found] ` <CGME20190805181113epcas3p2fe0b38b9075ca205e5a8beff77531c10@epcms2p4>
2019-08-12 11:01 ` Minwoo Im
2019-08-13 6:26 ` Sagi Grimberg
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.