[PATCH 7/9] block: assign batch completion handler in blk_poll()
From: Jens Axboe <axboe@kernel.dk>
Date: 2021-10-12 18:17:56
Subsystem:
block layer, the rest · Maintainers:
Jens Axboe, Linus Torvalds
From: Jens Axboe <axboe@kernel.dk>
Date: 2021-10-12 18:17:56
Subsystem:
block layer, the rest · Maintainers:
Jens Axboe, Linus Torvalds
If an io_batch is passed in to blk_poll(), we need to assign the batch handler associated with this queue. This allows callers to complete an io_batch handler on by calling it. Signed-off-by: Jens Axboe <axboe@kernel.dk> --- block/blk-mq.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 9509c52a66a4..62fabc65d6b2 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c@@ -4107,6 +4107,19 @@ static int blk_mq_poll_classic(struct request_queue *q, blk_qc_t cookie, hctx->poll_considered++; + /* + * If batching is requested but the target doesn't support batched + * completions, then just clear ib and completions will be handled + * normally. + */ + if (ib) { + ib->complete = q->mq_ops->complete_batch; + if (!ib->complete) { + WARN_ON_ONCE(ib->req_list); + ib = NULL; + } + } + do { hctx->poll_invoked++;
--
2.33.0