From: Fan Li Date: Tue, 7 Nov 2017 03:04:33 +0000 (+0800) Subject: f2fs: keep scanning until enough free nids are acquired X-Git-Tag: v4.15-rc1~83^2~10 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=74986213adaff2ceab81fc0bb29dbb80d05665b3;p=users%2Fjedix%2Flinux-maple.git f2fs: keep scanning until enough free nids are acquired In current version, after scan_free_nid_bits, the scan is over if nid_cnt[FREE_NID] != 0. In most cases, there are still free nids in the free list during the scan, and scan_free_nid_bits usually can't increase nid_cnt[FREE_NID]. It causes that __build_free_nids is called many times without solving the shortage of the free nids. This patch fixes that. Signed-off-by: Fan li Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim --- diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index fef5c68886b1..97799bd503cc 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -2015,7 +2015,7 @@ static void __build_free_nids(struct f2fs_sb_info *sbi, bool sync, bool mount) /* try to find free nids in free_nid_bitmap */ scan_free_nid_bits(sbi); - if (nm_i->nid_cnt[FREE_NID]) + if (nm_i->nid_cnt[FREE_NID] >= NAT_ENTRY_PER_BLOCK) return; }