diff options
author | Pavel Begunkov <asml.silence@gmail.com> | 2022-04-15 22:08:31 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2022-04-24 18:02:52 -0600 |
commit | 924a07e482baae0ced5fb9922b827c46f0c0972d (patch) | |
tree | 6e2c7613fc16d91ba69a045f7d21a40c139fbd7e /fs/io_uring.c | |
parent | df3becde8d9dcaaf17a615009301479f8f9c6323 (diff) | |
download | lwn-924a07e482baae0ced5fb9922b827c46f0c0972d.tar.gz lwn-924a07e482baae0ced5fb9922b827c46f0c0972d.zip |
io_uring: refactor io_submit_sqe()
Remove one extra if for non-linked path of io_submit_sqe().
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/03183199d1bf494b4a72eca16d792c8a5945acb4.1650056133.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.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c index cb7c3bc7c1b7..fe9df32be921 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -7765,7 +7765,7 @@ static inline int io_submit_sqe(struct io_ring_ctx *ctx, struct io_kiocb *req, * submitted sync once the chain is complete. If none of those * conditions are true (normal request), then just queue it. */ - if (link->head) { + if (unlikely(link->head)) { ret = io_req_prep_async(req); if (unlikely(ret)) return io_submit_fail_init(sqe, req, ret); @@ -7779,17 +7779,22 @@ static inline int io_submit_sqe(struct io_ring_ctx *ctx, struct io_kiocb *req, /* last request of the link, flush it */ req = link->head; link->head = NULL; - } else if (req->flags & IO_REQ_LINK_FLAGS) { - link->head = req; - link->last = req; + if (req->flags & (REQ_F_FORCE_ASYNC | REQ_F_FAIL)) + goto fallback; + + } else if (unlikely(req->flags & (IO_REQ_LINK_FLAGS | + REQ_F_FORCE_ASYNC | REQ_F_FAIL))) { + if (req->flags & IO_REQ_LINK_FLAGS) { + link->head = req; + link->last = req; + } else { +fallback: + io_queue_sqe_fallback(req); + } return 0; } - if (likely(!(req->flags & (REQ_F_FORCE_ASYNC | REQ_F_FAIL)))) - io_queue_sqe(req); - else - io_queue_sqe_fallback(req); - + io_queue_sqe(req); return 0; } |