ext4: Use folio_invalidate()
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Wed, 9 Feb 2022 20:21:31 +0000 (20:21 +0000)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Tue, 15 Mar 2022 12:23:29 +0000 (08:23 -0400)
Instead of calling ->invalidatepage directly, use folio_invalidate().

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
fs/ext4/inode.c

index 01c9e4f..57800ec 100644 (file)
@@ -1971,6 +1971,7 @@ out_no_pagelock:
 static int ext4_writepage(struct page *page,
                          struct writeback_control *wbc)
 {
+       struct folio *folio = page_folio(page);
        int ret = 0;
        loff_t size;
        unsigned int len;
@@ -1980,8 +1981,8 @@ static int ext4_writepage(struct page *page,
        bool keep_towrite = false;
 
        if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb)))) {
-               inode->i_mapping->a_ops->invalidatepage(page, 0, PAGE_SIZE);
-               unlock_page(page);
+               folio_invalidate(folio, 0, folio_size(folio));
+               folio_unlock(folio);
                return -EIO;
        }