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

Now we can call mapping_evict_folio() instead of invalidate_inode_page()
and save a few 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 d6c75dc2
...@@ -507,27 +507,27 @@ static unsigned long __invalidate_mapping_pages(struct address_space *mapping, ...@@ -507,27 +507,27 @@ static unsigned long __invalidate_mapping_pages(struct address_space *mapping,
folio_batch_init(&fbatch); folio_batch_init(&fbatch);
while (find_lock_entries(mapping, index, end, &fbatch, indices)) { while (find_lock_entries(mapping, index, end, &fbatch, indices)) {
for (i = 0; i < folio_batch_count(&fbatch); i++) { for (i = 0; i < folio_batch_count(&fbatch); i++) {
struct page *page = &fbatch.folios[i]->page; struct folio *folio = fbatch.folios[i];
/* We rely upon deletion not changing page->index */ /* We rely upon deletion not changing folio->index */
index = indices[i]; index = indices[i];
if (xa_is_value(page)) { if (xa_is_value(folio)) {
count += invalidate_exceptional_entry(mapping, count += invalidate_exceptional_entry(mapping,
index, index,
page); folio);
continue; continue;
} }
index += thp_nr_pages(page) - 1; index += folio_nr_pages(folio) - 1;
ret = invalidate_inode_page(page); ret = mapping_evict_folio(mapping, folio);
unlock_page(page); folio_unlock(folio);
/* /*
* Invalidation is a hint that the page is no longer * Invalidation is a hint that the folio is no longer
* of interest and try to speed up its reclaim. * of interest and try to speed up its reclaim.
*/ */
if (!ret) { if (!ret) {
deactivate_file_page(page); deactivate_file_page(&folio->page);
/* It is likely on the pagevec of a remote CPU */ /* It is likely on the pagevec of a remote CPU */
if (nr_pagevec) if (nr_pagevec)
(*nr_pagevec)++; (*nr_pagevec)++;
......
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