f2fs: fix wrong condition to trigger background checkpoint correctly
authorChao Yu <chao@kernel.org>
Tue, 28 Sep 2021 19:19:14 +0000 (03:19 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Mon, 11 Oct 2021 23:15:23 +0000 (16:15 -0700)
In f2fs_balance_fs_bg(), it needs to check both NAT_ENTRIES and INO_ENTRIES
memory usage to decide whether we should skip background checkpoint, otherwise
we may always skip checking INO_ENTRIES memory usage, so that INO_ENTRIES may
potentially cause high memory footprint.

Fixes: 493720a48543 ("f2fs: fix to avoid REQ_TIME and CP_TIME collision")
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/segment.c

index f3f4dee43985fa930305397e7df4e3eb09083f85..3189537a19dc59926b9c30a2c9d301f93bd08415 100644 (file)
@@ -580,7 +580,7 @@ void f2fs_balance_fs_bg(struct f2fs_sb_info *sbi, bool from_bg)
                goto do_sync;
 
        /* checkpoint is the only way to shrink partial cached entries */
-       if (f2fs_available_free_memory(sbi, NAT_ENTRIES) ||
+       if (f2fs_available_free_memory(sbi, NAT_ENTRIES) &&
                f2fs_available_free_memory(sbi, INO_ENTRIES))
                return;