From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751996AbdKNG22 (ORCPT ); Tue, 14 Nov 2017 01:28:28 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:10917 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751030AbdKNG2V (ORCPT ); Tue, 14 Nov 2017 01:28:21 -0500 Subject: =?UTF-8?Q?Re:_=e7=ad=94=e5=a4=8d:_[f2fs-dev]_[PATCH_RESEND]_f2fs:_v?= =?UTF-8?Q?alidate_before_set/clear_free_nat_bitmap?= To: LiFan , "'Jaegeuk Kim'" CC: "'Chao Yu'" , , References: <000401d35ac6$b6c36700$244a3500$@samsung.com> <20171114045418.GB13008@jaegeuk-macbookpro.roam.corp.google.com> <000501d35d0d$e5d313d0$b1793b70$@samsung.com> From: Chao Yu Message-ID: Date: Tue, 14 Nov 2017 14:27:42 +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: <000501d35d0d$e5d313d0$b1793b70$@samsung.com> Content-Type: text/plain; charset="gbk" Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.134.22.195] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020202.5A0A8CE4.00BC,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: f64f3d8c54fca9428a025f86dc74d4c5 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2017/11/14 13:59, LiFan wrote: > Sorry, it seems my company mailbox single mail would cut the long line short > automatically. > It's fine in my outlook mail, so I overlooked. Maybe 'git send-email' can be one of your options to save some work in your email client? ;) Thanks, > I haven't find a way to solve that yet, please hold both of my new patch. > I will fix it as soon as possible. > > > -----邮件原件----- > 发件人: Jaegeuk Kim [mailto:jaegeuk@kernel.org] > 发送时间: 2017年11月14日 12:54 > 收件人: LiFan > 抄送: 'Chao Yu'; 'Chao Yu'; linux-kernel@vger.kernel.org; > linux-f2fs-devel@lists.sourceforge.net > 主题: Re: [f2fs-dev] [PATCH RESEND] f2fs: validate before set/clear free nat > bitmap > > Sorry, I can't merge this patch due to wrong format. > > On 11/11, LiFan wrote: >> In flush_nat_entries, all dirty nats will be flushed and if their new >> address isn't NULL_ADDR, their bitmaps will be updated, the >> free_nid_count of the bitmaps will be increased regardless of whether >> the nats have already been occupied before. This could lead to wrong >> free_nid_count. >> So this patch checks the status of the bits before actually set/clear > them. >> >> Fixes: 586d1492f301 ("f2fs: skip scanning free nid bitmap of full NAT >> blocks") >> >> Signed-off-by: Fan li >> --- >> fs/f2fs/node.c | 17 ++++++++++------- >> 1 file changed, 10 insertions(+), 7 deletions(-) >> >> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index d234c6e..b965a53 >> 100644 >> --- a/fs/f2fs/node.c >> +++ b/fs/f2fs/node.c >> @@ -1906,15 +1906,18 @@ static void update_free_nid_bitmap(struct >> f2fs_sb_info *sbi, nid_t nid, >> if (!test_bit_le(nat_ofs, nm_i->nat_block_bitmap)) >> return; >> >> - if (set) >> + if (set) { >> + if (test_bit_le(nid_ofs, nm_i->free_nid_bitmap[nat_ofs])) >> + return; >> __set_bit_le(nid_ofs, nm_i->free_nid_bitmap[nat_ofs]); >> - else >> - __clear_bit_le(nid_ofs, nm_i->free_nid_bitmap[nat_ofs]); >> - >> - if (set) >> nm_i->free_nid_count[nat_ofs]++; >> - else if (!build) >> - nm_i->free_nid_count[nat_ofs]--; >> + } else { >> + if (!test_bit_le(nid_ofs, nm_i->free_nid_bitmap[nat_ofs])) >> + return; >> + __clear_bit_le(nid_ofs, nm_i->free_nid_bitmap[nat_ofs]); >> + if (!build) >> + nm_i->free_nid_count[nat_ofs]--; >> + } >> } >> >> static void scan_nat_page(struct f2fs_sb_info *sbi, >> -- >> 2.7.4 >> > > > > >