linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeffle Xu <jefflexu@linux.alibaba.com>
To: snitzer@redhat.com, axboe@kernel.dk
Cc: linux-block@vger.kernel.org, dm-devel@redhat.com,
	joseph.qi@linux.alibaba.com, xiaoguang.wang@linux.alibaba.com,
	haoxu@linux.alibaba.com
Subject: [RFC 1/3] block/mq: add iterator for polling hw queues
Date: Tue, 20 Oct 2020 14:54:18 +0800	[thread overview]
Message-ID: <20201020065420.124885-2-jefflexu@linux.alibaba.com> (raw)
In-Reply-To: <20201020065420.124885-1-jefflexu@linux.alibaba.com>

Add one helper function for iterating all hardware queues in polling
mode.

Signed-off-by: Jeffle Xu <jefflexu@linux.alibaba.com>
---
 include/linux/blk-mq.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index b23eeca4d677..81c70ce97715 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -571,6 +571,12 @@ static inline void *blk_mq_rq_to_pdu(struct request *rq)
 	for ((i) = 0; (i) < (q)->nr_hw_queues &&			\
 	     ({ hctx = (q)->queue_hw_ctx[i]; 1; }); (i)++)
 
+#define queue_for_each_poll_hw_ctx(q, hctx, i)				\
+	for ((i) = 0; ((q)->tag_set->nr_maps > HCTX_TYPE_POLL) &&	\
+	     (i) < (q)->tag_set->map[HCTX_TYPE_POLL].nr_queues &&	\
+	     ({ hctx = (q)->queue_hw_ctx[((q)->tag_set->map[HCTX_TYPE_POLL].queue_offset + (i))]; 1; }); \
+	     (i)++)
+
 #define hctx_for_each_ctx(hctx, ctx, i)					\
 	for ((i) = 0; (i) < (hctx)->nr_ctx &&				\
 	     ({ ctx = (hctx)->ctxs[(i)]; 1; }); (i)++)
-- 
2.27.0


  reply	other threads:[~2020-10-20  6:54 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-20  6:54 [RFC 0/3] Add support of iopoll for dm device Jeffle Xu
2020-10-20  6:54 ` Jeffle Xu [this message]
2020-10-20  6:54 ` [RFC 2/3] block: add back ->poll_fn in request queue Jeffle Xu
2020-10-20  6:54 ` [RFC 3/3] dm: add support for IO polling Jeffle Xu
2020-10-21 20:49   ` Mike Snitzer
2020-10-22  3:14   ` Ming Lei
2020-10-21 20:39 ` [RFC 0/3] Add support of iopoll for dm device Mike Snitzer
2020-10-22  5:28   ` JeffleXu
2020-10-26 18:53     ` Mike Snitzer
2020-11-02  3:14       ` JeffleXu
2020-11-02 15:28         ` Mike Snitzer
2020-11-03  8:59           ` JeffleXu
2020-11-04  6:47           ` JeffleXu
2020-11-04 15:08             ` Mike Snitzer
2020-11-06  2:51               ` [dm-devel] " JeffleXu
2020-11-06 17:45                 ` Mike Snitzer
2020-11-08  1:09                   ` [dm-devel] " JeffleXu
2020-11-09 18:15                     ` Mike Snitzer
2020-11-10  1:43                       ` [dm-devel] " JeffleXu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201020065420.124885-2-jefflexu@linux.alibaba.com \
    --to=jefflexu@linux.alibaba.com \
    --cc=axboe@kernel.dk \
    --cc=dm-devel@redhat.com \
    --cc=haoxu@linux.alibaba.com \
    --cc=joseph.qi@linux.alibaba.com \
    --cc=linux-block@vger.kernel.org \
    --cc=snitzer@redhat.com \
    --cc=xiaoguang.wang@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).