summaryrefslogtreecommitdiffstats
path: root/fs/io_uring.c
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2020-02-01 03:58:42 +0300
committerJens Axboe <axboe@kernel.dk>2020-02-03 17:27:47 -0700
commit3e577dcd73a1fdc641bf45e5ea4a37869de221b5 (patch)
tree5770edb4dcebdb65ed0d5a4598ecd09fcdf29ed9 /fs/io_uring.c
parent6c8a31346925cbb373f84a18428ab3df59d3950e (diff)
downloadlinux-stable-3e577dcd73a1fdc641bf45e5ea4a37869de221b5.tar.gz
linux-stable-3e577dcd73a1fdc641bf45e5ea4a37869de221b5.tar.bz2
linux-stable-3e577dcd73a1fdc641bf45e5ea4a37869de221b5.zip
io_uring: put the flag changing code in the same spot
Both iocb_flags() and kiocb_set_rw_flags() are inline and modify kiocb->ki_flags. Place them close, so they can be potentially better optimised. 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.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 42b45c57c3f8..edb00ae2619b 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -1867,8 +1867,11 @@ static int io_prep_rw(struct io_kiocb *req, const struct io_uring_sqe *sqe,
req->flags |= REQ_F_CUR_POS;
kiocb->ki_pos = req->file->f_pos;
}
- kiocb->ki_flags = iocb_flags(kiocb->ki_filp);
kiocb->ki_hint = ki_hint_validate(file_write_hint(kiocb->ki_filp));
+ kiocb->ki_flags = iocb_flags(kiocb->ki_filp);
+ ret = kiocb_set_rw_flags(kiocb, READ_ONCE(sqe->rw_flags));
+ if (unlikely(ret))
+ return ret;
ioprio = READ_ONCE(sqe->ioprio);
if (ioprio) {
@@ -1880,10 +1883,6 @@ static int io_prep_rw(struct io_kiocb *req, const struct io_uring_sqe *sqe,
} else
kiocb->ki_ioprio = get_current_ioprio();
- ret = kiocb_set_rw_flags(kiocb, READ_ONCE(sqe->rw_flags));
- if (unlikely(ret))
- return ret;
-
/* don't allow async punt if RWF_NOWAIT was requested */
if ((kiocb->ki_flags & IOCB_NOWAIT) ||
(req->file->f_flags & O_NONBLOCK))