Re: [PATCH] block: Add bvec_folio()
Matthew Wilcox <[email protected]>
| Newsgroups | org.kernel.vger.io-uring,org.kernel.vger.linux-block,org.kernel.vger.linux-kernel,org.kvack.linux-mm |
|---|---|
| Message-ID | <[email protected]> |
On Mon, May 25, 2026 at 11:43:22PM -0700, Christoph Hellwig wrote: > On Mon, May 25, 2026 at 02:29:27PM +0100, Matthew Wilcox wrote: > > > So I'm not against the function per se, but the documentation must > > > explain the minefields it is stepping into a bit better. > > > > Lower level drivers shouldn't be concerning themselves with folios. > > For a start, we can put non-folios (eg slab memory) into bvecs. > > Well, that is a very good thing to put into the comment. We can also > put them into high-level bvecs, so framing this as 'only use if you > know the memory is folios, which you can't unless you are the entity > who filled the bio' might be a good choice. How about: /** * bvec_folio - Return the first folio referenced by this bvec * @bv: bvec to access * * bvecs can contain non-folio memory, so this should only be called by * the creator of the bvec; drivers have no business looking at the owner * of the memory. It may not even be the right interface for the caller * to use as bvecs can span multiple folios. You may be better off using * something like bio_for_each_folio_all() which iterates over all folios. */