diff options
author | Pavel Begunkov <asml.silence@gmail.com> | 2021-02-01 18:59:56 +0000 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2021-02-01 13:09:21 -0700 |
commit | 57cd657b8272a66277c139e7bbdc8b86057cb415 (patch) | |
tree | a26e3482cf57f147c8d680beb5777392cfbb2f28 /fs | |
parent | ce3d5aae331fa0eb1e88199e0380f517ed0c58f6 (diff) | |
download | linux-57cd657b8272a66277c139e7bbdc8b86057cb415.tar.bz2 |
io_uring: simplify do_read return parsing
do_read() returning 0 bytes read (not -EAGAIN/etc.) is not an important
enough of a case to prioritise it. Fold it into ret < 0 check, so we get
rid of an extra if and make it a bit more readable.
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/io_uring.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c index 77878274fcb1..24ad36d71289 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -3526,7 +3526,6 @@ static int io_read(struct io_kiocb *req, bool force_nonblock, else kiocb->ki_flags |= IOCB_NOWAIT; - /* If the file doesn't support async, just async punt */ no_async = force_nonblock && !io_file_supports_async(req->file, READ); if (no_async) @@ -3538,9 +3537,7 @@ static int io_read(struct io_kiocb *req, bool force_nonblock, ret = io_iter_do_read(req, iter); - if (!ret) { - goto done; - } else if (ret == -EIOCBQUEUED) { + if (ret == -EIOCBQUEUED) { ret = 0; goto out_free; } else if (ret == -EAGAIN) { @@ -3554,7 +3551,7 @@ static int io_read(struct io_kiocb *req, bool force_nonblock, iov_iter_revert(iter, io_size - iov_iter_count(iter)); ret = 0; goto copy_iov; - } else if (ret < 0) { + } else if (ret <= 0) { /* make sure -ERESTARTSYS -> -EINTR is done */ goto done; } |