diff options
author | Matthew Wilcox (Oracle) <willy@infradead.org> | 2022-05-01 13:35:31 +0200 |
---|---|---|
committer | Matthew Wilcox (Oracle) <willy@infradead.org> | 2022-05-10 05:12:52 +0200 |
commit | d2329aa0c78f4a8dd368bb706f196ab99f692eaa (patch) | |
tree | 8dcdbf74ed2e54f05633b58585aa0bcb9027c046 /mm/filemap.c | |
parent | fs: Convert drop_buffers() to use a folio (diff) | |
download | linux-d2329aa0c78f4a8dd368bb706f196ab99f692eaa.tar.xz linux-d2329aa0c78f4a8dd368bb706f196ab99f692eaa.zip |
fs: Add free_folio address space operation
Include documentation and convert the callers to use ->free_folio as
well as ->freepage.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Diffstat (limited to 'mm/filemap.c')
-rw-r--r-- | mm/filemap.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/mm/filemap.c b/mm/filemap.c index d335a154a0d9..adcdef56890f 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -226,8 +226,12 @@ void __filemap_remove_folio(struct folio *folio, void *shadow) void filemap_free_folio(struct address_space *mapping, struct folio *folio) { void (*freepage)(struct page *); + void (*free_folio)(struct folio *); int refs = 1; + free_folio = mapping->a_ops->free_folio; + if (free_folio) + free_folio(folio); freepage = mapping->a_ops->freepage; if (freepage) freepage(&folio->page); @@ -807,6 +811,7 @@ void replace_page_cache_page(struct page *old, struct page *new) struct folio *fold = page_folio(old); struct folio *fnew = page_folio(new); struct address_space *mapping = old->mapping; + void (*free_folio)(struct folio *) = mapping->a_ops->free_folio; void (*freepage)(struct page *) = mapping->a_ops->freepage; pgoff_t offset = old->index; XA_STATE(xas, &mapping->i_pages, offset); @@ -835,9 +840,11 @@ void replace_page_cache_page(struct page *old, struct page *new) if (PageSwapBacked(new)) __inc_lruvec_page_state(new, NR_SHMEM); xas_unlock_irq(&xas); + if (free_folio) + free_folio(fold); if (freepage) freepage(old); - put_page(old); + folio_put(fold); } EXPORT_SYMBOL_GPL(replace_page_cache_page); |