Skip to content

Commit 3e577dc

Browse files
isilenceaxboe
authored andcommitted
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 <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 6c8a313 commit 3e577dc

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

fs/io_uring.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1867,8 +1867,11 @@ static int io_prep_rw(struct io_kiocb *req, const struct io_uring_sqe *sqe,
18671867
req->flags |= REQ_F_CUR_POS;
18681868
kiocb->ki_pos = req->file->f_pos;
18691869
}
1870-
kiocb->ki_flags = iocb_flags(kiocb->ki_filp);
18711870
kiocb->ki_hint = ki_hint_validate(file_write_hint(kiocb->ki_filp));
1871+
kiocb->ki_flags = iocb_flags(kiocb->ki_filp);
1872+
ret = kiocb_set_rw_flags(kiocb, READ_ONCE(sqe->rw_flags));
1873+
if (unlikely(ret))
1874+
return ret;
18721875

18731876
ioprio = READ_ONCE(sqe->ioprio);
18741877
if (ioprio) {
@@ -1880,10 +1883,6 @@ static int io_prep_rw(struct io_kiocb *req, const struct io_uring_sqe *sqe,
18801883
} else
18811884
kiocb->ki_ioprio = get_current_ioprio();
18821885

1883-
ret = kiocb_set_rw_flags(kiocb, READ_ONCE(sqe->rw_flags));
1884-
if (unlikely(ret))
1885-
return ret;
1886-
18871886
/* don't allow async punt if RWF_NOWAIT was requested */
18881887
if ((kiocb->ki_flags & IOCB_NOWAIT) ||
18891888
(req->file->f_flags & O_NONBLOCK))

0 commit comments

Comments
 (0)