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

io_uring: highlight read-retry loop

We already have implicit do-while for read-retries but with goto in the
end. Convert it to an actual do-while, it highlights it so making a
bit more understandable and is cleaner in general.
Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 5ea5dd45
...@@ -3566,7 +3566,8 @@ static int io_read(struct io_kiocb *req, bool force_nonblock, ...@@ -3566,7 +3566,8 @@ static int io_read(struct io_kiocb *req, bool force_nonblock,
rw = req->async_data; rw = req->async_data;
/* now use our persistent iterator, if we aren't already */ /* now use our persistent iterator, if we aren't already */
iter = &rw->iter; iter = &rw->iter;
retry:
do {
io_size -= ret; io_size -= ret;
rw->bytes_done += ret; rw->bytes_done += ret;
/* if we can retry, do so with the callbacks armed */ /* if we can retry, do so with the callbacks armed */
...@@ -3576,17 +3577,16 @@ static int io_read(struct io_kiocb *req, bool force_nonblock, ...@@ -3576,17 +3577,16 @@ static int io_read(struct io_kiocb *req, bool force_nonblock,
} }
/* /*
* Now retry read with the IOCB_WAITQ parts set in the iocb. If we * Now retry read with the IOCB_WAITQ parts set in the iocb. If
* get -EIOCBQUEUED, then we'll get a notification when the desired * we get -EIOCBQUEUED, then we'll get a notification when the
* page gets unlocked. We can also get a partial read here, and if we * desired page gets unlocked. We can also get a partial read
* do, then just retry at the new offset. * here, and if we do, then just retry at the new offset.
*/ */
ret = io_iter_do_read(req, iter); ret = io_iter_do_read(req, iter);
if (ret == -EIOCBQUEUED) if (ret == -EIOCBQUEUED)
return 0; return 0;
/* we got some bytes, but not all. retry. */ /* we got some bytes, but not all. retry. */
if (ret > 0 && ret < io_size) } while (ret > 0 && ret < io_size);
goto retry;
done: done:
kiocb_done(kiocb, ret, cs); kiocb_done(kiocb, ret, cs);
return 0; return 0;
......
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