[Devel,rh7,2/3] cleancache: avoid pointless cleancache_invalidate_inode() calls.

Submitted by Andrey Ryabinin on April 12, 2017, 3:52 p.m.

Details

Message ID 20170412155233.1707-2-aryabinin@virtuozzo.com
State New
Series "fs/cleancache: fix data invalidation in the cleancache during direct_io"
Headers show

Commit Message

Andrey Ryabinin April 12, 2017, 3:52 p.m.
Per Alexey: there is no point in invalidation of cleancache on entry to
truncate_inode_pages_range/invalidate_inode_pages2_range routines.
It is waste of time, cleancache will be repopulated by invalidation
(which it stupid, of course). It is enough to do this once at exit.

https://jira.sw.ru/browse/PSBM-63908
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
---
 mm/truncate.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

Patch hide | download patch | download mbox

diff --git a/mm/truncate.c b/mm/truncate.c
index ce4b1d8..1db0425 100644
--- a/mm/truncate.c
+++ b/mm/truncate.c
@@ -285,9 +285,8 @@  void truncate_inode_pages_range(struct address_space *mapping,
 	int		i;
 	int		bug_if_page_has_bh = 0;
 
-	cleancache_invalidate_inode(mapping);
 	if (mapping->nrpages == 0 && mapping->nrexceptional == 0)
-		return;
+		goto out;
 
 	/* Offsets within partial pages */
 	partial_start = lstart & (PAGE_CACHE_SIZE - 1);
@@ -390,7 +389,7 @@  void truncate_inode_pages_range(struct address_space *mapping,
 	 * will be released, just zeroed, so we can bail out now.
 	 */
 	if (start >= end)
-		return;
+		goto out;
 
 	index = start;
 	for ( ; ; ) {
@@ -431,6 +430,8 @@  void truncate_inode_pages_range(struct address_space *mapping,
 		pagevec_release(&pvec);
 		index++;
 	}
+
+out:
 	cleancache_invalidate_inode(mapping);
 }
 EXPORT_SYMBOL(truncate_inode_pages_range);
@@ -627,10 +628,8 @@  int invalidate_inode_pages2_range(struct address_space *mapping,
 	int ret2 = 0;
 	int did_range_unmap = 0;
 
-	cleancache_invalidate_inode(mapping);
-
 	if (mapping->nrpages == 0 && mapping->nrexceptional == 0)
-		return 0;
+		goto out;
 
 	pagevec_init(&pvec, 0);
 	index = start;
@@ -692,6 +691,8 @@  int invalidate_inode_pages2_range(struct address_space *mapping,
 		cond_resched();
 		index++;
 	}
+
+out:
 	cleancache_invalidate_inode(mapping);
 	return ret;
 }