diff options
author | Dylan Yudaken <dylany@fb.com> | 2022-02-22 02:55:01 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@google.com> | 2023-02-18 09:30:52 +0000 |
commit | 7230401304917132e7a0bd04a72a5fc185624a0d (patch) | |
tree | 26ef3c5882f47810be4c2bbac717e26235796504 | |
parent | f138022c6a1a36b7b2831446c36f0ad46a77aa86 (diff) | |
download | common-7230401304917132e7a0bd04a72a5fc185624a0d.tar.gz |
UPSTREAM: io_uring: remove duplicated calls to io_kiocb_ppos
commit af9c45ecebaf1b428306f41421f4bcffe439f735 upstream.
io_kiocb_ppos is called in both branches, and it seems that the compiler
does not fuse this. Fusing removes a few bytes from loop_rw_iter.
Before:
$ nm -S fs/io_uring.o | grep loop_rw_iter
0000000000002430 0000000000000124 t loop_rw_iter
After:
$ nm -S fs/io_uring.o | grep loop_rw_iter
0000000000002430 000000000000010d t loop_rw_iter
Change-Id: Ibd662d59697d9cb1e484319050f6e5f960f6ac5c
Signed-off-by: Dylan Yudaken <dylany@fb.com>
Reviewed-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Bug: 268174392
(cherry picked from commit 076f872314d4da36e878673cbef1eae3514b0c6d)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
-rw-r--r-- | io_uring/io_uring.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index 713a2436feef..7b26c0c08375 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -3310,6 +3310,7 @@ static ssize_t loop_rw_iter(int rw, struct io_kiocb *req, struct iov_iter *iter) struct kiocb *kiocb = &req->rw.kiocb; struct file *file = req->file; ssize_t ret = 0; + loff_t *ppos; /* * Don't support polled IO through this interface, and we can't @@ -3321,6 +3322,8 @@ static ssize_t loop_rw_iter(int rw, struct io_kiocb *req, struct iov_iter *iter) if (kiocb->ki_flags & IOCB_NOWAIT) return -EAGAIN; + ppos = io_kiocb_ppos(kiocb); + while (iov_iter_count(iter)) { struct iovec iovec; ssize_t nr; @@ -3334,10 +3337,10 @@ static ssize_t loop_rw_iter(int rw, struct io_kiocb *req, struct iov_iter *iter) if (rw == READ) { nr = file->f_op->read(file, iovec.iov_base, - iovec.iov_len, io_kiocb_ppos(kiocb)); + iovec.iov_len, ppos); } else { nr = file->f_op->write(file, iovec.iov_base, - iovec.iov_len, io_kiocb_ppos(kiocb)); + iovec.iov_len, ppos); } if (nr < 0) { |