mm/truncate: Convert invalidate_inode_page() to use a folio
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Sat, 12 Feb 2022 22:39:10 +0000 (17:39 -0500)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Mon, 21 Mar 2022 16:59:01 +0000 (12:59 -0400)
This saves a number of calls to compound_head().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Miaohe Lin <linmiaohe@huawei.com>
mm/truncate.c

index e5e2edaa0b7634b7e75405f32e0c622196b445e0..b73c30c95cd06a2e1eefd41023496af2ae6b625e 100644 (file)
@@ -281,14 +281,15 @@ EXPORT_SYMBOL(generic_error_remove_page);
  */
 int invalidate_inode_page(struct page *page)
 {
-       struct address_space *mapping = page_mapping(page);
+       struct folio *folio = page_folio(page);
+       struct address_space *mapping = folio_mapping(folio);
        if (!mapping)
                return 0;
-       if (PageDirty(page) || PageWriteback(page))
+       if (folio_test_dirty(folio) || folio_test_writeback(folio))
                return 0;
        if (page_mapped(page))
                return 0;
-       if (page_has_private(page) && !try_to_release_page(page, 0))
+       if (folio_has_private(folio) && !filemap_release_folio(folio, 0))
                return 0;
 
        return remove_mapping(mapping, page);