aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKinglong Mee <kinglongmee@gmail.com>2017-02-26 07:47:16 -0500
committerJaegeuk Kim <jaegeuk@kernel.org>2017-02-27 13:07:48 -0500
commitf0cdbfe6ef0b2f3d42e1cf87bf962e730c2420cb (patch)
treecd094445cdc048b7a21cb7ca77d1dadb79be47f8
parent4ac912427c4214d8031d9ad6fbc3bc75e71512df (diff)
f2fs: use MAX_FREE_NIDS for the free nids target
F2FS has define MAX_FREE_NIDS for maximum of cached free nids target. Signed-off-by: Kinglong Mee <kinglongmee@gmail.com> Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r--fs/f2fs/node.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index fd12a32f7e87..b3aead4c5a0f 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -1871,7 +1871,6 @@ static void scan_free_nid_bits(struct f2fs_sb_info *sbi)
1871 struct curseg_info *curseg = CURSEG_I(sbi, CURSEG_HOT_DATA); 1871 struct curseg_info *curseg = CURSEG_I(sbi, CURSEG_HOT_DATA);
1872 struct f2fs_journal *journal = curseg->journal; 1872 struct f2fs_journal *journal = curseg->journal;
1873 unsigned int i, idx; 1873 unsigned int i, idx;
1874 unsigned int target = FREE_NID_PAGES * NAT_ENTRY_PER_BLOCK;
1875 1874
1876 down_read(&nm_i->nat_tree_lock); 1875 down_read(&nm_i->nat_tree_lock);
1877 1876
@@ -1887,7 +1886,7 @@ static void scan_free_nid_bits(struct f2fs_sb_info *sbi)
1887 nid = i * NAT_ENTRY_PER_BLOCK + idx; 1886 nid = i * NAT_ENTRY_PER_BLOCK + idx;
1888 add_free_nid(sbi, nid, true); 1887 add_free_nid(sbi, nid, true);
1889 1888
1890 if (nm_i->nid_cnt[FREE_NID_LIST] >= target) 1889 if (nm_i->nid_cnt[FREE_NID_LIST] >= MAX_FREE_NIDS)
1891 goto out; 1890 goto out;
1892 } 1891 }
1893 } 1892 }
@@ -1913,7 +1912,6 @@ static int scan_nat_bits(struct f2fs_sb_info *sbi)
1913 struct f2fs_nm_info *nm_i = NM_I(sbi); 1912 struct f2fs_nm_info *nm_i = NM_I(sbi);
1914 struct page *page; 1913 struct page *page;
1915 unsigned int i = 0; 1914 unsigned int i = 0;
1916 nid_t target = FREE_NID_PAGES * NAT_ENTRY_PER_BLOCK;
1917 nid_t nid; 1915 nid_t nid;
1918 1916
1919 if (!enabled_nat_bits(sbi, NULL)) 1917 if (!enabled_nat_bits(sbi, NULL))
@@ -1934,7 +1932,7 @@ check_empty:
1934 add_free_nid(sbi, nid, true); 1932 add_free_nid(sbi, nid, true);
1935 } 1933 }
1936 1934
1937 if (nm_i->nid_cnt[FREE_NID_LIST] >= target) 1935 if (nm_i->nid_cnt[FREE_NID_LIST] >= MAX_FREE_NIDS)
1938 goto out; 1936 goto out;
1939 i++; 1937 i++;
1940 goto check_empty; 1938 goto check_empty;
@@ -1952,7 +1950,7 @@ check_partial:
1952 scan_nat_page(sbi, page, nid); 1950 scan_nat_page(sbi, page, nid);
1953 f2fs_put_page(page, 1); 1951 f2fs_put_page(page, 1);
1954 1952
1955 if (nm_i->nid_cnt[FREE_NID_LIST] < target) { 1953 if (nm_i->nid_cnt[FREE_NID_LIST] < MAX_FREE_NIDS) {
1956 i++; 1954 i++;
1957 goto check_partial; 1955 goto check_partial;
1958 } 1956 }