All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: linux-fsdevel@vger.kernel.org
Cc: torvalds@linux-foundation.org, brauner@kernel.org,
	Jens Axboe <axboe@kernel.dk>
Subject: [PATCH 1/2] iov_iter: convert import_single_range() to ITER_UBUF
Date: Fri, 24 Mar 2023 14:44:42 -0600	[thread overview]
Message-ID: <20230324204443.45950-2-axboe@kernel.dk> (raw)
In-Reply-To: <20230324204443.45950-1-axboe@kernel.dk>

Since we're just importing a single vector, we don't have to turn it
into an ITER_IOVEC. Instead turn it into an ITER_UBUF, which is cheaper
to iterate.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
 lib/iov_iter.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/lib/iov_iter.c b/lib/iov_iter.c
index 274014e4eafe..fc82cc42ffe6 100644
--- a/lib/iov_iter.c
+++ b/lib/iov_iter.c
@@ -1866,9 +1866,7 @@ int import_single_range(int rw, void __user *buf, size_t len,
 	if (unlikely(!access_ok(buf, len)))
 		return -EFAULT;
 
-	iov->iov_base = buf;
-	iov->iov_len = len;
-	iov_iter_init(i, rw, iov, 1, len);
+	iov_iter_ubuf(i, rw, buf, len);
 	return 0;
 }
 EXPORT_SYMBOL(import_single_range);
-- 
2.39.2


  reply	other threads:[~2023-03-24 20:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-24 20:44 [PATCHSET 0/2] Turn single segment imports into ITER_UBUF Jens Axboe
2023-03-24 20:44 ` Jens Axboe [this message]
2023-03-24 20:44 ` [PATCH 2/2] iov_iter: import single vector iovecs as ITER_UBUF Jens Axboe
2023-03-24 21:14 ` [PATCHSET 0/2] Turn single segment imports into ITER_UBUF Linus Torvalds
2023-03-24 21:52   ` Jens Axboe
2023-03-25  4:46 ` Al Viro
2023-03-27 18:01   ` Jens Axboe
2023-03-27 18:42     ` Al Viro
2023-03-27 18:52       ` Jens Axboe
2023-03-27 18:59         ` Jens Axboe
2023-03-27 20:02           ` Al Viro
2023-03-27 20:03             ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230324204443.45950-2-axboe@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=brauner@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.