diff options
author | Jens Axboe <axboe@kernel.dk> | 2024-02-07 07:51:53 -0700 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2024-02-08 13:27:06 -0700 |
commit | 4caa74fdce7d59582b3e3f95b718b47e043f276e (patch) | |
tree | ddffa3628439514ba4de53ec5c4e5a6b7f72c436 /io_uring | |
parent | bfe30bfde279529011161a60e5a7ca4be83de422 (diff) | |
download | lwn-4caa74fdce7d59582b3e3f95b718b47e043f276e.tar.gz lwn-4caa74fdce7d59582b3e3f95b718b47e043f276e.zip |
io_uring: cleanup io_req_complete_post()
Move the ctx declaration and assignment up to be generally available
in the function, as we use req->ctx at the top anyway.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring')
-rw-r--r-- | io_uring/io_uring.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index 17bd16be1dfd..704df7e23734 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -1024,15 +1024,15 @@ static void __io_req_complete_post(struct io_kiocb *req, unsigned issue_flags) void io_req_complete_post(struct io_kiocb *req, unsigned issue_flags) { - if (req->ctx->task_complete && req->ctx->submitter_task != current) { + struct io_ring_ctx *ctx = req->ctx; + + if (ctx->task_complete && ctx->submitter_task != current) { req->io_task_work.func = io_req_task_complete; io_req_task_work_add(req); } else if (!(issue_flags & IO_URING_F_UNLOCKED) || - !(req->ctx->flags & IORING_SETUP_IOPOLL)) { + !(ctx->flags & IORING_SETUP_IOPOLL)) { __io_req_complete_post(req, issue_flags); } else { - struct io_ring_ctx *ctx = req->ctx; - mutex_lock(&ctx->uring_lock); __io_req_complete_post(req, issue_flags & ~IO_URING_F_UNLOCKED); mutex_unlock(&ctx->uring_lock); |