io_uring: remove duplicated calls to io_kiocb_ppos

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

Signed-off-by: Dylan Yudaken <dylany@fb.com>
Reviewed-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Dylan Yudaken 2022-02-22 02:55:01 -08:00 committed by Jens Axboe
parent c5020bc8d9
commit af9c45eceb

View File

@ -3420,6 +3420,7 @@ static ssize_t loop_rw_iter(int rw, struct io_kiocb *req, struct iov_iter *iter)
struct kiocb *kiocb = &req->rw.kiocb; struct kiocb *kiocb = &req->rw.kiocb;
struct file *file = req->file; struct file *file = req->file;
ssize_t ret = 0; ssize_t ret = 0;
loff_t *ppos;
/* /*
* Don't support polled IO through this interface, and we can't * Don't support polled IO through this interface, and we can't
@ -3432,6 +3433,8 @@ static ssize_t loop_rw_iter(int rw, struct io_kiocb *req, struct iov_iter *iter)
!(kiocb->ki_filp->f_flags & O_NONBLOCK)) !(kiocb->ki_filp->f_flags & O_NONBLOCK))
return -EAGAIN; return -EAGAIN;
ppos = io_kiocb_ppos(kiocb);
while (iov_iter_count(iter)) { while (iov_iter_count(iter)) {
struct iovec iovec; struct iovec iovec;
ssize_t nr; ssize_t nr;
@ -3445,10 +3448,10 @@ static ssize_t loop_rw_iter(int rw, struct io_kiocb *req, struct iov_iter *iter)
if (rw == READ) { if (rw == READ) {
nr = file->f_op->read(file, iovec.iov_base, nr = file->f_op->read(file, iovec.iov_base,
iovec.iov_len, io_kiocb_ppos(kiocb)); iovec.iov_len, ppos);
} else { } else {
nr = file->f_op->write(file, iovec.iov_base, nr = file->f_op->write(file, iovec.iov_base,
iovec.iov_len, io_kiocb_ppos(kiocb)); iovec.iov_len, ppos);
} }
if (nr < 0) { if (nr < 0) {