diff options
author | Hao Xu <haoxu@linux.alibaba.com> | 2021-12-07 17:39:50 +0800 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2021-12-07 15:02:42 -0700 |
commit | a37fae8aaa62b05c11f059fee8fedf4313975abd (patch) | |
tree | 9d8b9ceb11cb37ed1d270e47a1bf932d64f1e93b /fs/io_uring.c | |
parent | 9f8d032a364b2b579c6ce5a62b967056f8711e69 (diff) | |
download | lwn-a37fae8aaa62b05c11f059fee8fedf4313975abd.tar.gz lwn-a37fae8aaa62b05c11f059fee8fedf4313975abd.zip |
io_uring: split io_req_complete_post() and add a helper
Split io_req_complete_post(), this is a prep for the next patch.
Signed-off-by: Hao Xu <haoxu@linux.alibaba.com>
Link: https://lore.kernel.org/r/20211207093951.247840-5-haoxu@linux.alibaba.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/io_uring.c')
-rw-r--r-- | fs/io_uring.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c index 85f9459e9072..21738ed7521e 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -1891,12 +1891,11 @@ static noinline bool io_fill_cqe_aux(struct io_ring_ctx *ctx, u64 user_data, return __io_fill_cqe(ctx, user_data, res, cflags); } -static void io_req_complete_post(struct io_kiocb *req, s32 res, - u32 cflags) +static void __io_req_complete_post(struct io_kiocb *req, s32 res, + u32 cflags) { struct io_ring_ctx *ctx = req->ctx; - spin_lock(&ctx->completion_lock); if (!(req->flags & REQ_F_CQE_SKIP)) __io_fill_cqe(ctx, req->user_data, res, cflags); /* @@ -1918,6 +1917,15 @@ static void io_req_complete_post(struct io_kiocb *req, s32 res, wq_list_add_head(&req->comp_list, &ctx->locked_free_list); ctx->locked_free_nr++; } +} + +static void io_req_complete_post(struct io_kiocb *req, s32 res, + u32 cflags) +{ + struct io_ring_ctx *ctx = req->ctx; + + spin_lock(&ctx->completion_lock); + __io_req_complete_post(req, res, cflags); io_commit_cqring(ctx); spin_unlock(&ctx->completion_lock); io_cqring_ev_posted(ctx); |