Skip to content

Commit 27a6707

Browse files
committed
io_uring/uring_cmd: take advantage of completion batching
We know now what the completion context is for the uring_cmd completion handling, so use that to have io_req_task_complete() decide what the best way to complete the request is. This allows batching of the posted completions if we have multiple pending, rather than always doing them one-by-one. Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 360cd42 commit 27a6707

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

io_uring/uring_cmd.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,15 @@ void io_uring_cmd_done(struct io_uring_cmd *ioucmd, ssize_t ret, ssize_t res2,
5454
io_req_set_res(req, ret, 0);
5555
if (req->ctx->flags & IORING_SETUP_CQE32)
5656
io_req_set_cqe32_extra(req, res2, 0);
57-
if (req->ctx->flags & IORING_SETUP_IOPOLL)
57+
if (req->ctx->flags & IORING_SETUP_IOPOLL) {
5858
/* order with io_iopoll_req_issued() checking ->iopoll_complete */
5959
smp_store_release(&req->iopoll_completed, 1);
60-
else
61-
io_req_complete_post(req, issue_flags);
60+
} else {
61+
struct io_tw_state ts = {
62+
.locked = !(issue_flags & IO_URING_F_UNLOCKED),
63+
};
64+
io_req_task_complete(req, &ts);
65+
}
6266
}
6367
EXPORT_SYMBOL_GPL(io_uring_cmd_done);
6468

0 commit comments

Comments
 (0)