mm/truncate: Convert invalidate_inode_page() to use a folio

This saves a number of calls to compound_head().
Signed-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarMiaohe Lin <linmiaohe@huawei.com>
parent 1b8ddbee
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment