summaryrefslogtreecommitdiff
path: root/fs/io_uring.c
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2021-12-15 22:08:50 +0000
committerJens Axboe <axboe@kernel.dk>2021-12-28 09:51:15 -0800
commitcc8e9ba71a8626bd322d1945a8fc0c8a52131a63 (patch)
tree8183a8b1a1668442afb6f6ada138a33a1e6442f9 /fs/io_uring.c
parenteb0089d629ba413ebf820733ad11b4b2bed45514 (diff)
downloadlwn-cc8e9ba71a8626bd322d1945a8fc0c8a52131a63.tar.gz
lwn-cc8e9ba71a8626bd322d1945a8fc0c8a52131a63.zip
io_uring: use completion batching for poll rem/upd
Use __io_req_complete() in io_poll_update(), so we can utilise completion batching for both update/remove request and the poll we're killing (if any). Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/e2bdc6c5abd9e9b80f09b86d8823eb1c780362cd.1639605189.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/io_uring.c')
-rw-r--r--fs/io_uring.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 206066b59b62..eda8739592d0 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -2778,7 +2778,7 @@ static bool __io_complete_rw_common(struct io_kiocb *req, long res)
return false;
}
-static void io_req_task_complete(struct io_kiocb *req, bool *locked)
+static inline void io_req_task_complete(struct io_kiocb *req, bool *locked)
{
unsigned int cflags = io_put_kbuf(req);
int res = req->result;
@@ -5903,6 +5903,7 @@ static int io_poll_update(struct io_kiocb *req, unsigned int issue_flags)
struct io_ring_ctx *ctx = req->ctx;
struct io_kiocb *preq;
int ret2, ret = 0;
+ bool locked;
spin_lock(&ctx->completion_lock);
preq = io_poll_find(ctx, req->poll_update.old_user_data, true);
@@ -5928,13 +5929,16 @@ static int io_poll_update(struct io_kiocb *req, unsigned int issue_flags)
if (!ret2)
goto out;
}
+
req_set_fail(preq);
- io_req_complete(preq, -ECANCELED);
+ preq->result = -ECANCELED;
+ locked = !(issue_flags & IO_URING_F_UNLOCKED);
+ io_req_task_complete(preq, &locked);
out:
if (ret < 0)
req_set_fail(req);
/* complete update request, we're done with it */
- io_req_complete(req, ret);
+ __io_req_complete(req, issue_flags, ret, 0);
return 0;
}