Message ID | 20211108040551.1942823-13-willy@infradead.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | iomap/xfs folio patches | expand |
On Mon, Nov 08, 2021 at 04:05:35AM +0000, Matthew Wilcox (Oracle) wrote: > Keep iomap_invalidatepage around as a wrapper for use in address_space > operations. > > Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> > Reviewed-by: Christoph Hellwig <hch@lst.de> Looks good to me, Reviewed-by: Darrick J. Wong <djwong@kernel.org> --D > --- > fs/iomap/buffered-io.c | 20 ++++++++++++-------- > include/linux/iomap.h | 1 + > 2 files changed, 13 insertions(+), 8 deletions(-) > > diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c > index 49f96fdadcb4..b7cbe4d202d8 100644 > --- a/fs/iomap/buffered-io.c > +++ b/fs/iomap/buffered-io.c > @@ -468,23 +468,27 @@ iomap_releasepage(struct page *page, gfp_t gfp_mask) > } > EXPORT_SYMBOL_GPL(iomap_releasepage); > > -void > -iomap_invalidatepage(struct page *page, unsigned int offset, unsigned int len) > +void iomap_invalidate_folio(struct folio *folio, size_t offset, size_t len) > { > - struct folio *folio = page_folio(page); > - > - trace_iomap_invalidatepage(page->mapping->host, offset, len); > + trace_iomap_invalidatepage(folio->mapping->host, offset, len); > > /* > * If we're invalidating the entire page, clear the dirty state from it > * and release it to avoid unnecessary buildup of the LRU. > */ > - if (offset == 0 && len == PAGE_SIZE) { > - WARN_ON_ONCE(PageWriteback(page)); > - cancel_dirty_page(page); > + if (offset == 0 && len == folio_size(folio)) { > + WARN_ON_ONCE(folio_test_writeback(folio)); > + folio_cancel_dirty(folio); > iomap_page_release(folio); > } > } > +EXPORT_SYMBOL_GPL(iomap_invalidate_folio); > + > +void iomap_invalidatepage(struct page *page, unsigned int offset, > + unsigned int len) > +{ > + iomap_invalidate_folio(page_folio(page), offset, len); > +} > EXPORT_SYMBOL_GPL(iomap_invalidatepage); > > #ifdef CONFIG_MIGRATION > diff --git a/include/linux/iomap.h b/include/linux/iomap.h > index 6d1b08d0ae93..29491fb9c5ba 100644 > --- a/include/linux/iomap.h > +++ b/include/linux/iomap.h > @@ -225,6 +225,7 @@ void iomap_readahead(struct readahead_control *, const struct iomap_ops *ops); > int iomap_is_partially_uptodate(struct page *page, unsigned long from, > unsigned long count); > int iomap_releasepage(struct page *page, gfp_t gfp_mask); > +void iomap_invalidate_folio(struct folio *folio, size_t offset, size_t len); > void iomap_invalidatepage(struct page *page, unsigned int offset, > unsigned int len); > #ifdef CONFIG_MIGRATION > -- > 2.33.0 >
diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index 49f96fdadcb4..b7cbe4d202d8 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -468,23 +468,27 @@ iomap_releasepage(struct page *page, gfp_t gfp_mask) } EXPORT_SYMBOL_GPL(iomap_releasepage); -void -iomap_invalidatepage(struct page *page, unsigned int offset, unsigned int len) +void iomap_invalidate_folio(struct folio *folio, size_t offset, size_t len) { - struct folio *folio = page_folio(page); - - trace_iomap_invalidatepage(page->mapping->host, offset, len); + trace_iomap_invalidatepage(folio->mapping->host, offset, len); /* * If we're invalidating the entire page, clear the dirty state from it * and release it to avoid unnecessary buildup of the LRU. */ - if (offset == 0 && len == PAGE_SIZE) { - WARN_ON_ONCE(PageWriteback(page)); - cancel_dirty_page(page); + if (offset == 0 && len == folio_size(folio)) { + WARN_ON_ONCE(folio_test_writeback(folio)); + folio_cancel_dirty(folio); iomap_page_release(folio); } } +EXPORT_SYMBOL_GPL(iomap_invalidate_folio); + +void iomap_invalidatepage(struct page *page, unsigned int offset, + unsigned int len) +{ + iomap_invalidate_folio(page_folio(page), offset, len); +} EXPORT_SYMBOL_GPL(iomap_invalidatepage); #ifdef CONFIG_MIGRATION diff --git a/include/linux/iomap.h b/include/linux/iomap.h index 6d1b08d0ae93..29491fb9c5ba 100644 --- a/include/linux/iomap.h +++ b/include/linux/iomap.h @@ -225,6 +225,7 @@ void iomap_readahead(struct readahead_control *, const struct iomap_ops *ops); int iomap_is_partially_uptodate(struct page *page, unsigned long from, unsigned long count); int iomap_releasepage(struct page *page, gfp_t gfp_mask); +void iomap_invalidate_folio(struct folio *folio, size_t offset, size_t len); void iomap_invalidatepage(struct page *page, unsigned int offset, unsigned int len); #ifdef CONFIG_MIGRATION