Skip to contentSkip to conversation

f2fs: avoid unnecessary shrink in f2fs_shrink_scan()

PATCH Applied Chao Yu 2 participants 2 messages Aug 5 F2FS file system

lore
Share & tools
lore

Chao Yu

author maintainer
#0 lore raw

PATCH 1/1 f2fs: avoid unnecessary shrink in f2fs_shrink_scan()

In f2fs_shrink_scan(), let's check if we have already shrinked enough number of memory before calling f2fs_shrink_read_extent_tree().

---
 fs/f2fs/shrinker.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/f2fs/shrinker.c +2 -1
index b88babcf6ab4..4f6bf5926de4 100644
@@ -109,7 +109,8 @@ unsigned long f2fs_shrink_scan(struct shrinker *shrink,
 		freed += f2fs_shrink_age_extent_tree(sbi, nr >> 2);
 
 		/* shrink read extent cache entries */
-		freed += f2fs_shrink_read_extent_tree(sbi, nr >> 2);
+		if (freed < nr)
+			freed += f2fs_shrink_read_extent_tree(sbi, nr >> 2);
 
 		/* shrink clean nat cache entries */
 		if (freed < nr)
Signature · 1 line
2.49.0
#1 lore raw
This patch was applied to jaegeuk/f2fs.git (dev) by Jaegeuk Kim <[email protected]>:

Hello:

This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <[email protected]>:

Quoted 7 lines · On Wed, 5 Aug 2026 12:20:50 +0000 you wrote:

In f2fs_shrink_scan(), let's check if we have already shrinked enough number of memory before calling f2fs_shrink_read_extent_tree().

---
 fs/f2fs/shrinker.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Here is the summary with links:
- [f2fs-dev] f2fs: avoid unnecessary shrink in f2fs_shrink_scan()

    https://git.kernel.org/jaegeuk/f2fs/c/7173538c41d6

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html