Lines Matching refs:sbi
22 static unsigned long __count_nat_entries(struct f2fs_sb_info *sbi) in __count_nat_entries() argument
24 long count = NM_I(sbi)->nat_cnt - NM_I(sbi)->dirty_nat_cnt; in __count_nat_entries()
29 static unsigned long __count_free_nids(struct f2fs_sb_info *sbi) in __count_free_nids() argument
31 long count = NM_I(sbi)->nid_cnt[FREE_NID] - MAX_FREE_NIDS; in __count_free_nids()
36 static unsigned long __count_extent_cache(struct f2fs_sb_info *sbi) in __count_extent_cache() argument
38 return atomic_read(&sbi->total_zombie_tree) + in __count_extent_cache()
39 atomic_read(&sbi->total_ext_node); in __count_extent_cache()
45 struct f2fs_sb_info *sbi; in f2fs_shrink_count() local
52 sbi = list_entry(p, struct f2fs_sb_info, s_list); in f2fs_shrink_count()
55 if (!mutex_trylock(&sbi->umount_mutex)) { in f2fs_shrink_count()
62 count += __count_extent_cache(sbi); in f2fs_shrink_count()
65 count += __count_nat_entries(sbi); in f2fs_shrink_count()
68 count += __count_free_nids(sbi); in f2fs_shrink_count()
72 mutex_unlock(&sbi->umount_mutex); in f2fs_shrink_count()
82 struct f2fs_sb_info *sbi; in f2fs_shrink_scan() local
93 sbi = list_entry(p, struct f2fs_sb_info, s_list); in f2fs_shrink_scan()
95 if (sbi->shrinker_run_no == run_no) in f2fs_shrink_scan()
99 if (!mutex_trylock(&sbi->umount_mutex)) { in f2fs_shrink_scan()
105 sbi->shrinker_run_no = run_no; in f2fs_shrink_scan()
108 freed += f2fs_shrink_extent_tree(sbi, nr >> 1); in f2fs_shrink_scan()
112 freed += try_to_free_nats(sbi, nr - freed); in f2fs_shrink_scan()
116 freed += try_to_free_nids(sbi, nr - freed); in f2fs_shrink_scan()
120 list_move_tail(&sbi->s_list, &f2fs_list); in f2fs_shrink_scan()
121 mutex_unlock(&sbi->umount_mutex); in f2fs_shrink_scan()
129 void f2fs_join_shrinker(struct f2fs_sb_info *sbi) in f2fs_join_shrinker() argument
132 list_add_tail(&sbi->s_list, &f2fs_list); in f2fs_join_shrinker()
136 void f2fs_leave_shrinker(struct f2fs_sb_info *sbi) in f2fs_leave_shrinker() argument
138 f2fs_shrink_extent_tree(sbi, __count_extent_cache(sbi)); in f2fs_leave_shrinker()
141 list_del(&sbi->s_list); in f2fs_leave_shrinker()