Commit 1e23db45 authored by Jens Axboe's avatar Jens Axboe

io_uring: use iter_ubuf for single range imports

This is more efficient than iter_iov.
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
[merge to 6.2, minor fixes]
Signed-off-by: default avatarKeith Busch <kbusch@kernel.org>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
parent 4b61152e
...@@ -391,7 +391,7 @@ static struct iovec *__io_import_iovec(int ddir, struct io_kiocb *req, ...@@ -391,7 +391,7 @@ static struct iovec *__io_import_iovec(int ddir, struct io_kiocb *req,
rw->len = sqe_len; rw->len = sqe_len;
} }
ret = import_single_range(ddir, buf, sqe_len, s->fast_iov, iter); ret = import_ubuf(ddir, buf, sqe_len, iter);
if (ret) if (ret)
return ERR_PTR(ret); return ERR_PTR(ret);
return NULL; return NULL;
...@@ -450,7 +450,10 @@ static ssize_t loop_rw_iter(int ddir, struct io_rw *rw, struct iov_iter *iter) ...@@ -450,7 +450,10 @@ static ssize_t loop_rw_iter(int ddir, struct io_rw *rw, struct iov_iter *iter)
struct iovec iovec; struct iovec iovec;
ssize_t nr; ssize_t nr;
if (!iov_iter_is_bvec(iter)) { if (iter_is_ubuf(iter)) {
iovec.iov_base = iter->ubuf + iter->iov_offset;
iovec.iov_len = iov_iter_count(iter);
} else if (!iov_iter_is_bvec(iter)) {
iovec = iov_iter_iovec(iter); iovec = iov_iter_iovec(iter);
} else { } else {
iovec.iov_base = u64_to_user_ptr(rw->addr); iovec.iov_base = u64_to_user_ptr(rw->addr);
...@@ -495,7 +498,7 @@ static void io_req_map_rw(struct io_kiocb *req, const struct iovec *iovec, ...@@ -495,7 +498,7 @@ static void io_req_map_rw(struct io_kiocb *req, const struct iovec *iovec,
io->free_iovec = iovec; io->free_iovec = iovec;
io->bytes_done = 0; io->bytes_done = 0;
/* can only be fixed buffers, no need to do anything */ /* can only be fixed buffers, no need to do anything */
if (iov_iter_is_bvec(iter)) if (iov_iter_is_bvec(iter) || iter_is_ubuf(iter))
return; return;
if (!iovec) { if (!iovec) {
unsigned iov_off = 0; unsigned iov_off = 0;
......
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