firmware/br-ext-chip-allwinner/board/v83x/kernel/patches/00000-fs_f2fs_shrinker.c.patch

25 lines
795 B
Diff

diff -drupN a/fs/f2fs/shrinker.c b/fs/f2fs/shrinker.c
--- a/fs/f2fs/shrinker.c 2018-08-06 17:23:04.000000000 +0300
+++ b/fs/f2fs/shrinker.c 2022-06-12 05:28:14.000000000 +0300
@@ -21,14 +21,16 @@ static unsigned int shrinker_run_no;
static unsigned long __count_nat_entries(struct f2fs_sb_info *sbi)
{
- return NM_I(sbi)->nat_cnt - NM_I(sbi)->dirty_nat_cnt;
+ long count = NM_I(sbi)->nat_cnt - NM_I(sbi)->dirty_nat_cnt;
+
+ return count > 0 ? count : 0;
}
static unsigned long __count_free_nids(struct f2fs_sb_info *sbi)
{
- if (NM_I(sbi)->fcnt > MAX_FREE_NIDS)
- return NM_I(sbi)->fcnt - MAX_FREE_NIDS;
- return 0;
+ long count = NM_I(sbi)->nid_cnt[FREE_NID] - MAX_FREE_NIDS;
+
+ return count > 0 ? count : 0;
}
static unsigned long __count_extent_cache(struct f2fs_sb_info *sbi)