From d05b59dc10e6c7c74da439561831f744196eb412 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Sun, 22 May 2022 19:49:36 -0600 Subject: [PATCH 4/4] io_uring: use import_ubuf() for send/recv We just have the single buffer, no point in using ITER_IOVEC when we can be using the more efficient ITER_UBUF instead. Signed-off-by: Jens Axboe --- fs/io_uring.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index 73f53c208df2..91255f2326e5 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -5272,7 +5272,6 @@ static int io_send(struct io_kiocb *req, unsigned int issue_flags) { struct io_sr_msg *sr = &req->sr_msg; struct msghdr msg; - struct iovec iov; struct socket *sock; unsigned flags; int min_ret = 0; @@ -5282,7 +5281,7 @@ static int io_send(struct io_kiocb *req, unsigned int issue_flags) if (unlikely(!sock)) return -ENOTSOCK; - ret = import_single_range(WRITE, sr->buf, sr->len, &iov, &msg.msg_iter); + ret = import_ubuf(WRITE, sr->buf, sr->len, &msg.msg_iter); if (unlikely(ret)) return ret; @@ -5521,7 +5520,6 @@ static int io_recv(struct io_kiocb *req, unsigned int issue_flags) struct msghdr msg; void __user *buf = sr->buf; struct socket *sock; - struct iovec iov; unsigned flags; int ret, min_ret = 0; bool force_nonblock = issue_flags & IO_URING_F_NONBLOCK; @@ -5537,7 +5535,7 @@ static int io_recv(struct io_kiocb *req, unsigned int issue_flags) buf = u64_to_user_ptr(kbuf->addr); } - ret = import_single_range(READ, buf, sr->len, &iov, &msg.msg_iter); + ret = import_ubuf(READ, buf, sr->len, &msg.msg_iter); if (unlikely(ret)) goto out_free; -- 2.35.1