diff options
author | Jaegeuk Kim <jaegeuk@kernel.org> | 2015-06-19 15:36:07 -0700 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2015-08-04 14:09:55 -0700 |
commit | 1b38dc8e74a366b92986755c304591e330f3c3e0 (patch) | |
tree | b5e5b2d8c23eaf31b697b7031692d537f18bf5d7 /fs/f2fs/segment.c | |
parent | 2658e50de61429f57d9496bfe371f232e2d039a1 (diff) |
f2fs: shrink nat_cache entries
This patch registers shrinking nat_cache entries.
Reviewed-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/segment.c')
-rw-r--r-- | fs/f2fs/segment.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 61b97f9cb9f6..d5ee99258cbc 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -306,8 +306,12 @@ void f2fs_balance_fs_bg(struct f2fs_sb_info *sbi) /* try to shrink extent cache when there is no enough memory */ f2fs_shrink_extent_tree(sbi, EXTENT_CACHE_SHRINK_NUMBER); - /* check the # of cached NAT entries and prefree segments */ - if (try_to_free_nats(sbi, NAT_ENTRY_PER_BLOCK) || + /* check the # of cached NAT entries */ + if (!available_free_memory(sbi, NAT_ENTRIES)) + try_to_free_nats(sbi, NAT_ENTRY_PER_BLOCK); + + /* checkpoint is the only way to shrink partial cached entries */ + if (!available_free_memory(sbi, NAT_ENTRIES) || excess_prefree_segs(sbi) || !available_free_memory(sbi, INO_ENTRIES)) f2fs_sync_fs(sbi->sb, true); |