diff options
author | Pavel Begunkov <asml.silence@gmail.com> | 2020-06-28 12:52:35 +0300 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2020-06-28 08:10:17 -0600 |
commit | 6795c5aba247653f99d1f336ff496dd74659b322 (patch) | |
tree | a6400f0a93b5cee55e6e1419c13f58344b10eaf0 /fs/io_uring.c | |
parent | 9b0d911acce00b67f7e7336f838b732de7d917d6 (diff) | |
download | lwn-6795c5aba247653f99d1f336ff496dd74659b322.tar.gz lwn-6795c5aba247653f99d1f336ff496dd74659b322.zip |
io_uring: clean up req->result setting by rw
Assign req->result to io_size early in io_{read,write}(), it's enough
and makes it more straightforward.
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 | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c index 14c5655c0434..f283d111666b 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -2384,7 +2384,6 @@ static int io_prep_rw(struct io_kiocb *req, const struct io_uring_sqe *sqe, kiocb->ki_flags |= IOCB_HIPRI; kiocb->ki_complete = io_complete_rw_iopoll; - req->result = 0; req->iopoll_completed = 0; } else { if (kiocb->ki_flags & IOCB_HIPRI) @@ -2957,10 +2956,8 @@ static int io_read(struct io_kiocb *req, bool force_nonblock, if (!force_nonblock) kiocb->ki_flags &= ~IOCB_NOWAIT; - req->result = 0; io_size = ret; - if (req->flags & REQ_F_LINK_HEAD) - req->result = io_size; + req->result = io_size; /* If the file doesn't support async, just async punt */ if (force_nonblock && !io_file_supports_async(req->file, READ)) @@ -3054,10 +3051,8 @@ static int io_write(struct io_kiocb *req, bool force_nonblock, if (!force_nonblock) req->rw.kiocb.ki_flags &= ~IOCB_NOWAIT; - req->result = 0; io_size = ret; - if (req->flags & REQ_F_LINK_HEAD) - req->result = io_size; + req->result = io_size; /* If the file doesn't support async, just async punt */ if (force_nonblock && !io_file_supports_async(req->file, WRITE)) |