mm/truncate: bail out early from invalidate_inode_pages2_range() if mapping is empty
Subsystems (2)
[email protected]
maintainerPATCH 88/102 mm/truncate: bail out early from invalidate_inode_pages2_range() if mapping is empty
From: Andrey Ryabinin <[email protected]>
Subject: mm/truncate: bail out early from invalidate_inode_pages2_range() if mapping is empty
If mapping is empty (both ->nrpages and ->nrexceptional is zero) we can avoid pointless lookups in empty radix tree and bail out immediately after cleancache invalidation.
Signed-off-by Andrey Ryabinin <[email protected]>
Reviewed-by Jan Kara <[email protected]>
Cc Alexander Viro <[email protected]>
Cc Ross Zwisler <[email protected]>
Cc Jens Axboe <[email protected]>
Cc Johannes Weiner <[email protected]>
Cc Alexey Kuznetsov <[email protected]>
Cc Christoph Hellwig <[email protected]>
Cc Nikolay Borisov <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
mm/truncate.c | 3 +++ 1 file changed, 3 insertions(+)
mm/truncate.c renamed from mm/truncate.c~mm-truncate-bail-out-early-from-invalidate_inode_pages2_range-if-mapping-is-empty +3 -0
@@ -624,6 +624,9 @@ int invalidate_inode_pages2_range(structint did_range_unmap =0 ;cleancache_invalidate_inode (mapping); +if (mapping->nrpages ==0 && mapping->nrexceptional ==0 ) +return 0 ; +pagevec_init (&pvec,0 ); index = start; while (index <= end && pagevec_lookup_entries(&pvec, mapping, index,
_