Re: [PATCH v2 3/9] mm/page_io: convert bio_first_page_all() to bio_first_folio_all()

From: Christoph Hellwig
Date: Thu Jul 20 2023 - 01:34:52 EST


On Wed, Jul 19, 2023 at 03:17:34PM +0100, Matthew Wilcox wrote:
> On Wed, Jul 19, 2023 at 05:58:42PM +0800, Peng Zhang wrote:
> > From: ZhangPeng <zhangpeng362@xxxxxxxxxx>
> >
> > Convert bio_first_page_all() to bio_first_folio_all() to return a
> > folio, which makes it easier to use.
>
> This wasn't what I was suggesting. Indeed, this may introduce bugs.
> I was suggesting adding bio_first_folio_all() so that it can be used
> by code that knows this is what it wants.

To add another opinion: I'd really like to see bio_first_page_all
go away. The right way to iterate over the pages is an iterator.
If we really want to micro-opimize not setting up an iteator because
we know we have exactly one page/folio just stash it into bi_private.