linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org, torvalds@linux-foundation.org,
	brauner@kernel.org
Subject: Re: [PATCH 2/8] iov_iter: add iovec_nr_user_vecs() helper
Date: Tue, 28 Mar 2023 13:27:32 -0600	[thread overview]
Message-ID: <8f36e443-e072-3c85-4ff9-b76476d7b98f@kernel.dk> (raw)
In-Reply-To: <20230328184220.GL3390869@ZenIV>

On 3/28/23 12:42 PM, Al Viro wrote:
> On Tue, Mar 28, 2023 at 11:36:07AM -0600, Jens Axboe wrote:
>> This returns the number of user segments in an iov_iter. The input can
>> either be an ITER_IOVEC, where it'll return the number of iovecs. Or it
>> can be an ITER_UBUF, in which case the number of segments is always 1.
>>
>> Outside of those two, no user backed iterators exist. Just return 0 for
>> those.
> 
> Umm...  Why not set ->nr_segs to 1 in iov_iter_ubuf() instead?  Note that
> it won't be more costly; that part of struct iov_iter (8 bytes at offset 40
> on amd64) is *not* left uninitialized - zero gets stored there.  That way
> you'll get constant 1 stored there, which is just as cheap...

Good point, let's have a prep patch that does that too.

-- 
Jens Axboe



  parent reply	other threads:[~2023-03-28 19:27 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-28 17:36 [PATCHSET v4 0/8] Turn single segment imports into ITER_UBUF Jens Axboe
2023-03-28 17:36 ` [PATCH 1/8] iov_iter: teach iov_iter_iovec() to deal with ITER_UBUF Jens Axboe
2023-03-28 17:36 ` [PATCH 2/8] iov_iter: add iovec_nr_user_vecs() helper Jens Axboe
2023-03-28 18:42   ` Al Viro
2023-03-28 18:45     ` Linus Torvalds
2023-03-28 19:27     ` Jens Axboe [this message]
2023-03-28 17:36 ` [PATCH 3/8] snd: move mapping an iov_iter to user bufs into a helper Jens Axboe
2023-03-28 17:36 ` [PATCH 4/8] snd: make snd_map_bufs() deal with ITER_UBUF Jens Axboe
2023-03-28 17:50   ` Linus Torvalds
2023-03-28 17:52     ` Jens Axboe
2023-03-28 18:52       ` Al Viro
2023-03-28 19:28         ` Jens Axboe
2023-03-28 17:36 ` [PATCH 5/8] IB/hfi1: make hfi1_write_iter() deal with ITER_UBUF iov_iter Jens Axboe
2023-03-28 18:43   ` Linus Torvalds
2023-03-28 18:55     ` Matthew Wilcox
2023-03-28 19:05       ` Linus Torvalds
2023-03-28 19:16         ` Linus Torvalds
2023-03-28 21:21           ` Jens Axboe
2023-03-28 21:38             ` Jens Axboe
2023-03-28 21:51               ` Jens Axboe
2023-03-28 19:30     ` Jens Axboe
2023-03-28 20:38     ` Al Viro
2023-03-28 20:46       ` Jens Axboe
2023-03-28 22:06       ` Linus Torvalds
2023-03-28 17:36 ` [PATCH 6/8] IB/qib: make qib_write_iter() " Jens Axboe
2023-03-28 17:36 ` [PATCH 7/8] iov_iter: convert import_single_range() to ITER_UBUF Jens Axboe
2023-03-28 17:36 ` [PATCH 8/8] iov_iter: import single vector iovecs as ITER_UBUF 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=8f36e443-e072-3c85-4ff9-b76476d7b98f@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=brauner@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).