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/node.c | |
parent | 2658e50de61429f57d9496bfe371f232e2d039a1 (diff) | |
download | lwn-1b38dc8e74a366b92986755c304591e330f3c3e0.tar.gz lwn-1b38dc8e74a366b92986755c304591e330f3c3e0.zip |
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/node.c')
-rw-r--r-- | fs/f2fs/node.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 7dd63b794bfb..a05eb35a372c 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -328,11 +328,11 @@ static void set_node_addr(struct f2fs_sb_info *sbi, struct node_info *ni, int try_to_free_nats(struct f2fs_sb_info *sbi, int nr_shrink) { struct f2fs_nm_info *nm_i = NM_I(sbi); + int nr = nr_shrink; - if (available_free_memory(sbi, NAT_ENTRIES)) + if (!down_write_trylock(&nm_i->nat_tree_lock)) return 0; - down_write(&nm_i->nat_tree_lock); while (nr_shrink && !list_empty(&nm_i->nat_entries)) { struct nat_entry *ne; ne = list_first_entry(&nm_i->nat_entries, @@ -341,7 +341,7 @@ int try_to_free_nats(struct f2fs_sb_info *sbi, int nr_shrink) nr_shrink--; } up_write(&nm_i->nat_tree_lock); - return nr_shrink; + return nr - nr_shrink; } /* |