Skip to content

Commit

Permalink
truncate: Convert invalidate_inode_pages2_range to folios
Browse files Browse the repository at this point in the history
If we're going to unmap a folio, we have to be sure to unmap the entire
folio, not just the part of it which lies after the search index.

Signed-off-by: Matthew Wilcox (Oracle) <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Reviewed-by: William Kucharski <[email protected]>
  • Loading branch information
Matthew Wilcox (Oracle) committed Jan 8, 2022
1 parent 338f379 commit f6357c3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions mm/truncate.c
Original file line number Diff line number Diff line change
Expand Up @@ -599,13 +599,13 @@ static int invalidate_complete_folio2(struct address_space *mapping,
return 0;
}

static int do_launder_page(struct address_space *mapping, struct page *page)
static int do_launder_folio(struct address_space *mapping, struct folio *folio)
{
if (!PageDirty(page))
if (!folio_test_dirty(folio))
return 0;
if (page->mapping != mapping || mapping->a_ops->launder_page == NULL)
if (folio->mapping != mapping || mapping->a_ops->launder_page == NULL)
return 0;
return mapping->a_ops->launder_page(page);
return mapping->a_ops->launder_page(&folio->page);
}

/**
Expand Down Expand Up @@ -671,7 +671,7 @@ int invalidate_inode_pages2_range(struct address_space *mapping,
unmap_mapping_folio(folio);
BUG_ON(folio_mapped(folio));

ret2 = do_launder_page(mapping, &folio->page);
ret2 = do_launder_folio(mapping, folio);
if (ret2 == 0) {
if (!invalidate_complete_folio2(mapping, folio))
ret2 = -EBUSY;
Expand Down

0 comments on commit f6357c3

Please sign in to comment.