From: Christoph Hellwig <hch@lst.de>
To: Damien Le Moal <dlemoal@kernel.org>
Cc: Christoph Hellwig <hch@lst.de>, Jens Axboe <axboe@kernel.dk>,
Christian Brauner <brauner@kernel.org>,
"Darrick J. Wong" <djwong@kernel.org>,
Carlos Maiolino <cem@kernel.org>, Qu Wenruo <wqu@suse.com>,
Al Viro <viro@zeniv.linux.org.uk>,
linux-block@vger.kernel.org, linux-xfs@vger.kernel.org,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 04/15] iov_iter: extract a iov_iter_extract_bvecs helper from bio code
Date: Mon, 26 Jan 2026 12:48:30 +0100 [thread overview]
Message-ID: <20260126114830.GA23617@lst.de> (raw)
In-Reply-To: <c8ec9ff0-a445-49d1-8b84-6b0ed39c9b92@kernel.org>
On Mon, Jan 26, 2026 at 03:27:16PM +0900, Damien Le Moal wrote:
> On 1/26/26 2:53 PM, Christoph Hellwig wrote:
> > Massage __bio_iov_iter_get_pages so that it doesn't need the bio, and
> > move it to lib/iov_iter.c so that it can be used by block code for
> > other things than filling a bio and by other subsystems like netfs.
> >
> > Signed-off-by: Christoph Hellwig <hch@lst.de>
>
>
> > +ssize_t iov_iter_extract_bvecs(struct iov_iter *iter, struct bio_vec *bv,
> > + size_t max_size, unsigned short *nr_vecs,
> > + unsigned short max_vecs, iov_iter_extraction_t extraction_flags)
> > +{
> > + unsigned short entries_left = max_vecs - *nr_vecs;
>
> Do we need to check that *nrvecs > 0 && *nrvecs < max_vecs ?
> Also, if *nr_vecs == max_vecs, we should warn and return 0, no ?
*nr_vecs = 0 is fine, and in fact the most common case.
We could add a protection for *nrvecs < max_vecs, but this is a very
low-level API, so we should be able to expect some sanity from the
users. Especially as it will blow up instantly, including with KASAN
splats.
next prev parent reply other threads:[~2026-01-26 11:48 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-26 5:53 bounce buffer direct I/O when stable pages are required v3 Christoph Hellwig
2026-01-26 5:53 ` [PATCH 01/15] block: add a BIO_MAX_SIZE constant and use it Christoph Hellwig
2026-01-26 6:20 ` Damien Le Moal
2026-01-26 10:24 ` Johannes Thumshirn
2026-01-26 10:55 ` Anuj gupta
2026-01-26 19:36 ` Darrick J. Wong
2026-01-27 14:22 ` Martin K. Petersen
2026-01-26 5:53 ` [PATCH 02/15] block: refactor get_contig_folio_len Christoph Hellwig
2026-01-26 10:59 ` Anuj gupta
2026-01-27 14:24 ` Martin K. Petersen
2026-01-26 5:53 ` [PATCH 03/15] block: open code bio_add_page and fix handling of mismatching P2P ranges Christoph Hellwig
2026-01-27 14:25 ` Martin K. Petersen
2026-01-26 5:53 ` [PATCH 04/15] iov_iter: extract a iov_iter_extract_bvecs helper from bio code Christoph Hellwig
2026-01-26 6:27 ` Damien Le Moal
2026-01-26 11:48 ` Christoph Hellwig [this message]
2026-01-27 14:26 ` Martin K. Petersen
2026-01-26 5:53 ` [PATCH 05/15] block: remove bio_release_page Christoph Hellwig
2026-01-27 14:27 ` Martin K. Petersen
2026-01-26 5:53 ` [PATCH 06/15] block: add helpers to bounce buffer an iov_iter into bios Christoph Hellwig
2026-01-26 19:39 ` Darrick J. Wong
2026-01-27 14:29 ` Martin K. Petersen
2026-01-26 5:53 ` [PATCH 07/15] iomap: fix submission side handling of completion side errors Christoph Hellwig
2026-01-26 5:53 ` [PATCH 08/15] iomap: simplify iomap_dio_bio_iter Christoph Hellwig
2026-01-26 5:53 ` [PATCH 09/15] iomap: split out the per-bio logic from iomap_dio_bio_iter Christoph Hellwig
2026-01-26 5:53 ` [PATCH 10/15] iomap: share code between iomap_dio_bio_end_io and iomap_finish_ioend_direct Christoph Hellwig
2026-01-26 5:53 ` [PATCH 11/15] iomap: free the bio before completing the dio Christoph Hellwig
2026-01-26 6:22 ` Damien Le Moal
2026-01-26 11:49 ` Christoph Hellwig
2026-01-26 5:53 ` [PATCH 12/15] iomap: rename IOMAP_DIO_DIRTY to IOMAP_DIO_USER_BACKED Christoph Hellwig
2026-01-26 5:53 ` [PATCH 13/15] iomap: support ioends for direct reads Christoph Hellwig
2026-01-26 5:53 ` [PATCH 14/15] iomap: add a flag to bounce buffer direct I/O Christoph Hellwig
2026-01-26 5:53 ` [PATCH 15/15] xfs: use bounce buffering direct I/O when the device requires stable pages Christoph Hellwig
2026-01-26 10:54 ` bounce buffer direct I/O when stable pages are required v3 Anuj gupta
2026-01-26 12:47 ` Christoph Hellwig
2026-01-28 9:50 ` Carlos Maiolino
2026-01-28 12:17 ` Jens Axboe
2026-01-28 12:17 ` 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=20260126114830.GA23617@lst.de \
--to=hch@lst.de \
--cc=axboe@kernel.dk \
--cc=brauner@kernel.org \
--cc=cem@kernel.org \
--cc=djwong@kernel.org \
--cc=dlemoal@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=wqu@suse.com \
/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