btrfs: Use folio_invalidate()
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Wed, 9 Feb 2022 20:21:29 +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/btrfs/extent_io.c

index 409bad3..1e6bf7f 100644 (file)
@@ -4048,6 +4048,7 @@ static noinline_for_stack int __extent_writepage_io(struct btrfs_inode *inode,
 static int __extent_writepage(struct page *page, struct writeback_control *wbc,
                              struct extent_page_data *epd)
 {
+       struct folio *folio = page_folio(page);
        struct inode *inode = page->mapping->host;
        struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
        const u64 page_start = page_offset(page);
@@ -4068,8 +4069,8 @@ static int __extent_writepage(struct page *page, struct writeback_control *wbc,
        pg_offset = offset_in_page(i_size);
        if (page->index > end_index ||
           (page->index == end_index && !pg_offset)) {
-               page->mapping->a_ops->invalidatepage(page, 0, PAGE_SIZE);
-               unlock_page(page);
+               folio_invalidate(folio, 0, folio_size(folio));
+               folio_unlock(folio);
                return 0;
        }