Add one helper function for iterating all hardware queues in polling mode. Signed-off-by: Jeffle Xu <jefflexu@xxxxxxxxxxxxxxxxx> --- 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