From: Matthew Wilcox (Oracle) Date: Fri, 26 Nov 2021 18:25:38 +0000 (-0500) Subject: truncate: Skip known-truncated indices X-Git-Tag: v5.17-rc1~107^2~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ccbbf761d440b0d5afcbf232db37435dc38d6161;p=thirdparty%2Fkernel%2Flinux.git truncate: Skip known-truncated indices If we've truncated an entire folio, we can skip over all the indices covered by this folio. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig Reviewed-by: William Kucharski --- diff --git a/mm/truncate.c b/mm/truncate.c index 0000424fc56b6..0df420c1cf5b7 100644 --- a/mm/truncate.c +++ b/mm/truncate.c @@ -408,6 +408,7 @@ void truncate_inode_pages_range(struct address_space *mapping, folio_wait_writeback(folio); truncate_inode_folio(mapping, folio); folio_unlock(folio); + index = folio_index(folio) + folio_nr_pages(folio) - 1; } truncate_exceptional_pvec_entries(mapping, &pvec, indices); pagevec_release(&pvec);