summaryrefslogtreecommitdiff
path: root/io_uring/io_uring.c
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2022-06-16 10:21:59 +0100
committerJens Axboe <axboe@kernel.dk>2022-07-24 18:39:13 -0600
commit7012c81593d5a3bc6d0b8720345cf887ef1df914 (patch)
tree075cc6457ba2a1124c0927545f107b871352a655 /io_uring/io_uring.c
parent75d7b3aec13be557f15d099dc612dd658d670d1d (diff)
downloadlwn-7012c81593d5a3bc6d0b8720345cf887ef1df914.tar.gz
lwn-7012c81593d5a3bc6d0b8720345cf887ef1df914.zip
io_uring: refactor io_req_task_complete()
Clean up io_req_task_complete() and deduplicate io_put_kbuf() calls. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/ae3148ac7eb5cce3e06895cde306e9e959d6f6ae.1655371007.git.asml.silence@gmail.com Reviewed-by: Hao Xu <howeyxu@tencent.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring/io_uring.c')
-rw-r--r--io_uring/io_uring.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index 541c109a9273..957a5bc1b528 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -1306,15 +1306,19 @@ static int io_iopoll_check(struct io_ring_ctx *ctx, long min)
return ret;
}
-inline void io_req_task_complete(struct io_kiocb *req, bool *locked)
+
+void io_req_task_complete(struct io_kiocb *req, bool *locked)
{
- if (*locked) {
- req->cqe.flags |= io_put_kbuf(req, 0);
+ if (req->flags & (REQ_F_BUFFER_SELECTED|REQ_F_BUFFER_RING)) {
+ unsigned issue_flags = *locked ? 0 : IO_URING_F_UNLOCKED;
+
+ req->cqe.flags |= io_put_kbuf(req, issue_flags);
+ }
+
+ if (*locked)
io_req_add_compl_list(req);
- } else {
- req->cqe.flags |= io_put_kbuf(req, IO_URING_F_UNLOCKED);
+ else
io_req_complete_post(req);
- }
}
/*