summaryrefslogtreecommitdiffstats
path: root/mm/truncate.c
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <willy@infradead.org>2021-11-26 13:25:38 -0500
committerMatthew Wilcox (Oracle) <willy@infradead.org>2022-01-08 00:28:41 -0500
commitccbbf761d440b0d5afcbf232db37435dc38d6161 (patch)
treec2e7f1109cb100ff5f952134598ef0e539628b19 /mm/truncate.c
parent1e84a3d997b74c33491899e31d48774f252213ab (diff)
downloadlinux-stable-ccbbf761d440b0d5afcbf232db37435dc38d6161.tar.gz
linux-stable-ccbbf761d440b0d5afcbf232db37435dc38d6161.tar.bz2
linux-stable-ccbbf761d440b0d5afcbf232db37435dc38d6161.zip
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) <willy@infradead.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: William Kucharski <william.kucharski@oracle.com>
Diffstat (limited to 'mm/truncate.c')
-rw-r--r--mm/truncate.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/mm/truncate.c b/mm/truncate.c
index 0000424fc56b..0df420c1cf5b 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);