Message ID | 20211013165416.985696-8-axboe@kernel.dk (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Batched completions | expand |
On Wed, Oct 13, 2021 at 10:54:14AM -0600, Jens Axboe wrote: > 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. blk_poll() is gone now :) > + if (iob) { > + iob->complete = q->mq_ops->complete_batch; > + if (!iob->complete) { > + WARN_ON_ONCE(iob->req_list); > + iob = NULL; > + } > + } Assigning first and checking later looks a little strange, even if it makes no actual difference. Why not: if (iob && q->mq_ops->complete_batch) iob->complete = q->mq_ops->complete_batch; else iob = NULL; Also I'd expect this patch in the series right after the other block patches.
On 10/14/21 1:48 AM, Christoph Hellwig wrote: > On Wed, Oct 13, 2021 at 10:54:14AM -0600, Jens Axboe wrote: >> 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. > > blk_poll() is gone now :) > >> + if (iob) { >> + iob->complete = q->mq_ops->complete_batch; >> + if (!iob->complete) { >> + WARN_ON_ONCE(iob->req_list); >> + iob = NULL; >> + } >> + } > > Assigning first and checking later looks a little strange, even if it > makes no actual difference. Why not: > > if (iob && q->mq_ops->complete_batch) > iob->complete = q->mq_ops->complete_batch; > else > iob = NULL; Done. > Also I'd expect this patch in the series right after the other block > patches. Moved.
diff --git a/block/blk-mq.c b/block/blk-mq.c index d603703cf272..deafd444761d 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -4302,6 +4302,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 (iob) { + iob->complete = q->mq_ops->complete_batch; + if (!iob->complete) { + WARN_ON_ONCE(iob->req_list); + iob = NULL; + } + } + do { hctx->poll_invoked++;
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(+)