io_uring: simplify io_req_map_rw()

Don't deref req->io->rw every time, but put it in a local variable. This
looks prettier, generates less instructions, and doesn't break alias
analysis.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Pavel Begunkov 2020-07-13 22:59:18 +03:00 committed by Jens Axboe
parent e73751225b
commit b64e3444d4
1 changed files with 9 additions and 7 deletions

View File

@ -2828,15 +2828,17 @@ static void io_req_map_rw(struct io_kiocb *req, ssize_t io_size,
struct iovec *iovec, struct iovec *fast_iov, struct iovec *iovec, struct iovec *fast_iov,
struct iov_iter *iter) struct iov_iter *iter)
{ {
req->io->rw.nr_segs = iter->nr_segs; struct io_async_rw *rw = &req->io->rw;
req->io->rw.size = io_size;
req->io->rw.iov = iovec; rw->nr_segs = iter->nr_segs;
if (!req->io->rw.iov) { rw->size = io_size;
req->io->rw.iov = req->io->rw.fast_iov; if (!iovec) {
if (req->io->rw.iov != fast_iov) rw->iov = rw->fast_iov;
memcpy(req->io->rw.iov, fast_iov, if (rw->iov != fast_iov)
memcpy(rw->iov, fast_iov,
sizeof(struct iovec) * iter->nr_segs); sizeof(struct iovec) * iter->nr_segs);
} else { } else {
rw->iov = iovec;
req->flags |= REQ_F_NEED_CLEANUP; req->flags |= REQ_F_NEED_CLEANUP;
} }
} }