Re: [PATCH 15/21] iomap: Convert iomap_write_begin and iomap_write_end to folios

From: Matthew Wilcox
Date: Wed Nov 03 2021 - 08:50:16 EST


On Wed, Nov 03, 2021 at 03:15:13AM +0000, Matthew Wilcox wrote:
> On Tue, Nov 02, 2021 at 04:22:15PM -0700, Darrick J. Wong wrote:
> > > + page = folio_file_page(folio, pos >> PAGE_SHIFT);
> >
> > Isn't this only needed in the BUFFER_HEAD case?
>
> Good catch. Want me to fold this in?
>
> @@ -632,12 +631,12 @@ static int iomap_write_begin(const struct iomap_iter *iter, loff_t pos,
> goto out_no_page;
> }
>
> - page = folio_file_page(folio, pos >> PAGE_SHIFT);
> if (srcmap->type == IOMAP_INLINE)
> status = iomap_write_begin_inline(iter, folio);
> - else if (srcmap->flags & IOMAP_F_BUFFER_HEAD)
> + else if (srcmap->flags & IOMAP_F_BUFFER_HEAD) {
> + struct page *page = folio_file_page(folio, pos >> PAGE_SHIFT);
> status = __block_write_begin_int(page, pos, len, NULL, srcmap);

On second thoughts, this is silly. __block_write_begin_int() doesn't
want the precise page (because it constructs buffer_heads and attaches
them to the passed-in page). I should just pass &folio->page here.
And __block_write_begin_int() should be converted to take a folio
at some point.