提交 b64e3444 编写于 作者: P Pavel Begunkov 提交者: 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: NPavel Begunkov <asml.silence@gmail.com>
Signed-off-by: NJens Axboe <axboe@kernel.dk>
上级 e7375122
......@@ -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 iov_iter *iter)
{
req->io->rw.nr_segs = iter->nr_segs;
req->io->rw.size = io_size;
req->io->rw.iov = iovec;
if (!req->io->rw.iov) {
req->io->rw.iov = req->io->rw.fast_iov;
if (req->io->rw.iov != fast_iov)
memcpy(req->io->rw.iov, fast_iov,
struct io_async_rw *rw = &req->io->rw;
rw->nr_segs = iter->nr_segs;
rw->size = io_size;
if (!iovec) {
rw->iov = rw->fast_iov;
if (rw->iov != fast_iov)
memcpy(rw->iov, fast_iov,
sizeof(struct iovec) * iter->nr_segs);
} else {
rw->iov = iovec;
req->flags |= REQ_F_NEED_CLEANUP;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册