Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751725AbdHAH5G (ORCPT ); Tue, 1 Aug 2017 03:57:06 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:10740 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750763AbdHAH5E (ORCPT ); Tue, 1 Aug 2017 03:57:04 -0400 From: Yunlong Song To: , , , , CC: , , , , Subject: [PATCH] f2fs: update cur_valid_map_mir together with cur_valid_map Date: Tue, 1 Aug 2017 15:56:46 +0800 Message-ID: <1501574206-150946-1-git-send-email-yunlong.song@huawei.com> X-Mailer: git-send-email 1.8.5.2 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.107.193.250] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020205.5980344F.0027,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: 6a5e1b5baf0d5c25ec9e479e1fb777ed Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1082 Lines: 36 When cur_valid_map passes the f2fs_test_and_set(,clear)_bit test, cur_valid_map_mir update is skipped unlikely, so fix it. Signed-off-by: Yunlong Song --- fs/f2fs/segment.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 151968e..6f7731a 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -1535,6 +1535,10 @@ static void update_sit_entry(struct f2fs_sb_info *sbi, block_t blkaddr, int del) f2fs_bug_on(sbi, 1); #endif } +#ifdef CONFIG_F2FS_CHECK_FS + else + f2fs_set_bit(offset, se->cur_valid_map_mir); +#endif if (f2fs_discard_en(sbi) && !f2fs_test_and_set_bit(offset, se->discard_map)) sbi->discard_blks--; @@ -1556,6 +1560,10 @@ static void update_sit_entry(struct f2fs_sb_info *sbi, block_t blkaddr, int del) f2fs_bug_on(sbi, 1); #endif } +#ifdef CONFIG_F2FS_CHECK_FS + else + f2fs_clear_bit(offset, se->cur_valid_map_mir); +#endif if (f2fs_discard_en(sbi) && f2fs_test_and_clear_bit(offset, se->discard_map)) sbi->discard_blks++; -- 1.8.5.2