Commit 9da070b1 authored by Pavel Begunkov's avatar Pavel Begunkov Committed by Jens Axboe

io_uring: consistent naming for inline completion

Improve naming of the inline/deferred completion helper so it's
consistent with it's *_post counterpart. Add some comments and extra
lockdeps to ensure the locking is done right.
Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/797c619943dac06529e9d3fcb16e4c3cde6ad1a3.1655684496.git.asml.silence@gmail.comSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent c059f785
...@@ -1380,7 +1380,7 @@ void io_req_task_complete(struct io_kiocb *req, bool *locked) ...@@ -1380,7 +1380,7 @@ void io_req_task_complete(struct io_kiocb *req, bool *locked)
} }
if (*locked) if (*locked)
io_req_add_compl_list(req); io_req_complete_defer(req);
else else
io_req_complete_post(req); io_req_complete_post(req);
} }
...@@ -1648,7 +1648,7 @@ static int io_issue_sqe(struct io_kiocb *req, unsigned int issue_flags) ...@@ -1648,7 +1648,7 @@ static int io_issue_sqe(struct io_kiocb *req, unsigned int issue_flags)
if (ret == IOU_OK) { if (ret == IOU_OK) {
if (issue_flags & IO_URING_F_COMPLETE_DEFER) if (issue_flags & IO_URING_F_COMPLETE_DEFER)
io_req_add_compl_list(req); io_req_complete_defer(req);
else else
io_req_complete_post(req); io_req_complete_post(req);
} else if (ret != IOU_ISSUE_SKIP_COMPLETE) } else if (ret != IOU_ISSUE_SKIP_COMPLETE)
......
...@@ -222,10 +222,18 @@ static inline void io_tw_lock(struct io_ring_ctx *ctx, bool *locked) ...@@ -222,10 +222,18 @@ static inline void io_tw_lock(struct io_ring_ctx *ctx, bool *locked)
} }
} }
static inline void io_req_add_compl_list(struct io_kiocb *req) /*
* Don't complete immediately but use deferred completion infrastructure.
* Protected by ->uring_lock and can only be used either with
* IO_URING_F_COMPLETE_DEFER or inside a tw handler holding the mutex.
*/
static inline void io_req_complete_defer(struct io_kiocb *req)
__must_hold(&req->ctx->uring_lock)
{ {
struct io_submit_state *state = &req->ctx->submit_state; struct io_submit_state *state = &req->ctx->submit_state;
lockdep_assert_held(&req->ctx->uring_lock);
wq_list_add_tail(&req->comp_list, &state->compl_reqs); wq_list_add_tail(&req->comp_list, &state->compl_reqs);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment