Commit 6cac3759 authored by Haicheng Li's avatar Haicheng Li Committed by Jaegeuk Kim

f2fs: fix inconsistent using of NM_WOUT_THRESHOLD

try_to_free_nats() is usually called with parameter nr_shrink as
	"nm_i->nat_cnt - NM_WOUT_THRESHOLD"
by flush_nat_entries() during checkpointing process.

However, this is inconsistent with the actual threshold check as
	"if (nm_i->nat_cnt < 2 * NM_WOUT_THRESHOLD)"
, which will ignore the free_nats requests when
	NM_WOUT_THRESHOLD < nm_i->nat_cnt < 2 * NM_WOUT_THRESHOLD

So fix the threshold check condition.
Signed-off-by: default avatarHaicheng Li <haicheng.li@linux.intel.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk.kim@samsung.com>
parent afcb7ca0
...@@ -244,7 +244,7 @@ static int try_to_free_nats(struct f2fs_sb_info *sbi, int nr_shrink) ...@@ -244,7 +244,7 @@ static int try_to_free_nats(struct f2fs_sb_info *sbi, int nr_shrink)
{ {
struct f2fs_nm_info *nm_i = NM_I(sbi); struct f2fs_nm_info *nm_i = NM_I(sbi);
if (nm_i->nat_cnt < 2 * NM_WOUT_THRESHOLD) if (nm_i->nat_cnt <= NM_WOUT_THRESHOLD)
return 0; return 0;
write_lock(&nm_i->nat_tree_lock); write_lock(&nm_i->nat_tree_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment