summaryrefslogtreecommitdiffstats
path: root/mm/page_io.c
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <willy@infradead.org>2022-02-09 20:22:00 +0000
committerMatthew Wilcox (Oracle) <willy@infradead.org>2022-03-15 08:23:30 -0400
commit6f31a5a261dbbe7bf7f585dfe81f8acd4b25ec3b (patch)
treecd3b4d33eed13560f5a04e4ce11f2794efeca92b /mm/page_io.c
parent072acba6d08730beba5bad293c7ce6d0c4b0624c (diff)
downloadlinux-6f31a5a261dbbe7bf7f585dfe81f8acd4b25ec3b.tar.bz2
fs: Add aops->dirty_folio
This replaces ->set_page_dirty(). It returns a bool instead of an int and takes the address_space as a parameter instead of expecting the implementations to retrieve the address_space from the page. This is particularly important for filesystems which use FS_OPS for swap. 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/page_io.c')
-rw-r--r--mm/page_io.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/mm/page_io.c b/mm/page_io.c
index 0bf8e40f4e57..24c975fb4e21 100644
--- a/mm/page_io.c
+++ b/mm/page_io.c
@@ -444,9 +444,12 @@ int swap_set_page_dirty(struct page *page)
if (data_race(sis->flags & SWP_FS_OPS)) {
struct address_space *mapping = sis->swap_file->f_mapping;
+ const struct address_space_operations *aops = mapping->a_ops;
VM_BUG_ON_PAGE(!PageSwapCache(page), page);
- return mapping->a_ops->set_page_dirty(page);
+ if (aops->dirty_folio)
+ return aops->dirty_folio(mapping, page_folio(page));
+ return aops->set_page_dirty(page);
} else {
return __set_page_dirty_no_writeback(page);
}