Skip to content

Commit

Permalink
mm/truncate: Convert invalidate_inode_page() to use a folio
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Matthew Wilcox (Oracle) committed Mar 21, 2022
1 parent 1b8ddbe commit 4418481
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions mm/truncate.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 4418481

Please sign in to comment.