Re: [PATCH] block: Add bvec_folio()
From: Christoph Hellwig
Date: Mon May 25 2026 - 02:06:33 EST
> +/**
> + * bvec_folio - Return the first folio referenced by this bvec
> + * @bv: bvec to access
> + *
> + * bvecs can span multiple folios. Unless you know that this
> + * bvec does not, you may be better off using something like
> + * bio_for_each_folio_all() which iterates over all folios.
> + */
> +static inline struct folio *bvec_folio(const struct bio_vec *bv)
> +{
> + return page_folio(bv->bv_page);
> +}
The comment here is confusing. bio_for_each_folio_all is a helper that
only works in the submitter side, and not for anything using the
bvec_iter required for drivers or anything else sitting below a
potential bio clone/split or using bvecs from an upper layer (like
ITER_BVEC direct I/O). Additionally bv_page can be a different
page than the fist page due to large bv_offset on split bios.
So I'm not against the function per se, but the documentation must
explain the minefields it is stepping into a bit better.