summaryrefslogtreecommitdiff
path: root/fs/io_uring.c
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2021-08-09 20:18:13 +0100
committerJens Axboe <axboe@kernel.dk>2021-08-23 13:10:26 -0600
commit5d70904367b45b74dab9da5c023b6629f511e48f (patch)
tree0aa2933353c34c07ec10a10feb29cced339f455d /fs/io_uring.c
parent90f67366cb8871951399fb5bcf182e902b896615 (diff)
downloadlwn-5d70904367b45b74dab9da5c023b6629f511e48f.tar.gz
lwn-5d70904367b45b74dab9da5c023b6629f511e48f.zip
io_uring: inline io_poll_remove_waitqs
Inline io_poll_remove_waitqs() into its only user and clean it up. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/2f1a91a19ffcd591531dc4c61e2f11c64a2d6a6d.1628536684.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.c23
1 files changed, 6 insertions, 17 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index e2718ce6dfbc..a8cef973a601 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -1059,7 +1059,6 @@ static void io_rsrc_put_work(struct work_struct *work);
static void io_req_task_queue(struct io_kiocb *req);
static void io_submit_flush_completions(struct io_ring_ctx *ctx);
-static bool io_poll_remove_waitqs(struct io_kiocb *req);
static int io_req_prep_async(struct io_kiocb *req);
static struct kmem_cache *req_cachep;
@@ -5251,34 +5250,24 @@ static bool __io_poll_remove_one(struct io_kiocb *req,
return do_complete;
}
-static bool io_poll_remove_waitqs(struct io_kiocb *req)
+static bool io_poll_remove_one(struct io_kiocb *req)
__must_hold(&req->ctx->completion_lock)
{
+ int refs;
bool do_complete;
io_poll_remove_double(req);
do_complete = __io_poll_remove_one(req, io_poll_get_single(req), true);
- if (req->opcode != IORING_OP_POLL_ADD && do_complete) {
- /* non-poll requests have submit ref still */
- req_ref_put(req);
- }
- return do_complete;
-}
-
-static bool io_poll_remove_one(struct io_kiocb *req)
- __must_hold(&req->ctx->completion_lock)
-{
- bool do_complete;
-
- do_complete = io_poll_remove_waitqs(req);
if (do_complete) {
io_cqring_fill_event(req->ctx, req->user_data, -ECANCELED, 0);
io_commit_cqring(req->ctx);
req_set_fail(req);
- io_put_req_deferred(req, 1);
- }
+ /* non-poll requests have submit ref still */
+ refs = 1 + (req->opcode != IORING_OP_POLL_ADD);
+ io_put_req_deferred(req, refs);
+ }
return do_complete;
}