Re: [PATCH 15/21] iomap: Convert iomap_write_begin and iomap_write_end to folios
From: Matthew Wilcox
Date: Tue Nov 02 2021 - 23:16:40 EST
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?
+++ b/fs/iomap/buffered-io.c
@@ -608,7 +608,6 @@ static int iomap_write_begin(const struct iomap_iter *iter,
loff_t pos,
const struct iomap_page_ops *page_ops = iter->iomap.page_ops;
const struct iomap *srcmap = iomap_iter_srcmap(iter);
struct folio *folio;
- struct page *page;
unsigned fgp = FGP_LOCK | FGP_WRITE | FGP_CREAT | FGP_STABLE | FGP_NOFS;
int status = 0;
@@ -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);
- else
+ } else
status = __iomap_write_begin(iter, pos, len, folio);
if (unlikely(status))