Commit b64e3444 authored by Pavel Begunkov's avatar Pavel Begunkov Committed by Jens Axboe

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: default avatarPavel Begunkov <asml.silence@gmail.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent e7375122
...@@ -2828,15 +2828,17 @@ static void io_req_map_rw(struct io_kiocb *req, ssize_t io_size, ...@@ -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;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment