diff options
author | Pavel Begunkov <asml.silence@gmail.com> | 2021-03-19 17:22:34 +0000 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2021-04-11 17:41:58 -0600 |
commit | 1840038e119573fc624a2fc586a1c5ced50b59f2 (patch) | |
tree | 9e4076bc02be5dae4947298ae02d644566ee360a /fs/io_uring.c | |
parent | de968c182b4f48a421b0a3862e747c4147a7da22 (diff) | |
download | lwn-1840038e119573fc624a2fc586a1c5ced50b59f2.tar.gz lwn-1840038e119573fc624a2fc586a1c5ced50b59f2.zip |
io_uring: optimise success case of __io_queue_sqe
Move the case of successfully issued request by doing that check first.
It's not much of a difference, just generates slightly better code for
me.
Signed-off-by: Pavel Begunkov <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 | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c index 416afa7af5df..b08813eacd49 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -6330,15 +6330,7 @@ static void __io_queue_sqe(struct io_kiocb *req) * We async punt it if the file wasn't marked NOWAIT, or if the file * doesn't support non-blocking read/write attempts */ - if (ret == -EAGAIN && !(req->flags & REQ_F_NOWAIT)) { - if (!io_arm_poll_handler(req)) { - /* - * Queued up for async execution, worker will release - * submit reference when the iocb is actually submitted. - */ - io_queue_async_work(req); - } - } else if (likely(!ret)) { + if (likely(!ret)) { /* drop submission reference */ if (req->flags & REQ_F_COMPLETE_INLINE) { struct io_ring_ctx *ctx = req->ctx; @@ -6350,6 +6342,14 @@ static void __io_queue_sqe(struct io_kiocb *req) } else { io_put_req(req); } + } else if (ret == -EAGAIN && !(req->flags & REQ_F_NOWAIT)) { + if (!io_arm_poll_handler(req)) { + /* + * Queued up for async execution, worker will release + * submit reference when the iocb is actually submitted. + */ + io_queue_async_work(req); + } } else { io_req_complete_failed(req, ret); } |