Commit f80a50a6 authored by Pavel Begunkov's avatar Pavel Begunkov Committed by Jens Axboe

io_uring: prioritise read success path over fails

Rearrange io_read return handling so first we expect it completing
successfully and only then checking for errors, which is a colder path.
Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/c91c7c2da11815ec8b04b5d872f60dc4cde662c5.1634144845.git.asml.silence@gmail.comSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 04f34081
...@@ -3487,7 +3487,7 @@ static int io_read(struct io_kiocb *req, unsigned int issue_flags) ...@@ -3487,7 +3487,7 @@ static int io_read(struct io_kiocb *req, unsigned int issue_flags)
ret = 0; ret = 0;
} else if (ret == -EIOCBQUEUED) { } else if (ret == -EIOCBQUEUED) {
goto out_free; goto out_free;
} else if (ret <= 0 || ret == req->result || !force_nonblock || } else if (ret == req->result || ret <= 0 || !force_nonblock ||
(req->flags & REQ_F_NOWAIT) || !need_read_all(req)) { (req->flags & REQ_F_NOWAIT) || !need_read_all(req)) {
/* read all, failed, already did sync or don't want to retry */ /* read all, failed, already did sync or don't want to retry */
goto done; goto done;
......
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