summaryrefslogtreecommitdiffstats
path: root/mm/truncate.c
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <willy@infradead.org>2022-02-09 21:21:32 +0100
committerMatthew Wilcox (Oracle) <willy@infradead.org>2022-03-15 13:23:29 +0100
commit128d1f8241d62ab014eef6dd4ef9bb977dbeadb2 (patch)
tree993afed4947fda2a865573f47a7d19c4022519f6 /mm/truncate.c
parentext4: Use folio_invalidate() (diff)
downloadlinux-128d1f8241d62ab014eef6dd4ef9bb977dbeadb2.tar.xz
linux-128d1f8241d62ab014eef6dd4ef9bb977dbeadb2.zip
fs: Add invalidate_folio() aops method
This is used in preference to invalidatepage, if defined. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Tested-by: Damien Le Moal <damien.lemoal@opensource.wdc.com> Acked-by: Damien Le Moal <damien.lemoal@opensource.wdc.com> Tested-by: Mike Marshall <hubcap@omnibond.com> # orangefs Tested-by: David Howells <dhowells@redhat.com> # afs
Diffstat (limited to 'mm/truncate.c')
-rw-r--r--mm/truncate.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/mm/truncate.c b/mm/truncate.c
index aa0ed373789d..b9ad298e6ce7 100644
--- a/mm/truncate.c
+++ b/mm/truncate.c
@@ -154,9 +154,15 @@ static int invalidate_exceptional_entry2(struct address_space *mapping,
*/
void folio_invalidate(struct folio *folio, size_t offset, size_t length)
{
+ const struct address_space_operations *aops = folio->mapping->a_ops;
void (*invalidatepage)(struct page *, unsigned int, unsigned int);
- invalidatepage = folio->mapping->a_ops->invalidatepage;
+ if (aops->invalidate_folio) {
+ aops->invalidate_folio(folio, offset, length);
+ return;
+ }
+
+ invalidatepage = aops->invalidatepage;
#ifdef CONFIG_BLOCK
if (!invalidatepage)
invalidatepage = block_invalidatepage;