From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753684AbdKGFqG (ORCPT ); Tue, 7 Nov 2017 00:46:06 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:57147 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1753640AbdKGFqF (ORCPT ); Tue, 7 Nov 2017 00:46:05 -0500 Subject: Re: [f2fs-dev] [PATCH] f2fs: keep scanning until enough free nids are acquired To: Fan Li , "'Chao Yu'" , "'Jaegeuk Kim'" CC: , References: <001901d35775$47b598f0$d720cad0$@samsung.com> From: Chao Yu Message-ID: Date: Tue, 7 Nov 2017 13:45:52 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <001901d35775$47b598f0$d720cad0$@samsung.com> Content-Type: text/plain; charset="windows-1252" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.134.22.195] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2017/11/7 11:04, Fan Li wrote: > 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 Thanks, > --- > fs/f2fs/node.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c > index 3d0d1be..5cef118 100644 > --- a/fs/f2fs/node.c > +++ b/fs/f2fs/node.c > @@ -2010,7 +2010,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; > } > > -- > 2.7.4 > > >