Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751332AbdIJQUv (ORCPT ); Sun, 10 Sep 2017 12:20:51 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:6001 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750943AbdIJQUu (ORCPT ); Sun, 10 Sep 2017 12:20:50 -0400 From: Yunlong Song To: , , , , CC: , , , , Subject: [PATCH] f2fs-tools: move_curseg_info only if check_curseg_offset fails Date: Mon, 11 Sep 2017 00:20:36 +0800 Message-ID: <1505060436-45299-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.0A090205.59B56660.002C,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: 4d8d8f4b4fe895258eedb2a044a24c29 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 856 Lines: 28 Current design will lose recovery process when check_curseg_offset is OK. Signed-off-by: Yunlong Song --- fsck/fsck.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/fsck/fsck.c b/fsck/fsck.c index cb341ba..56a47be 100644 --- a/fsck/fsck.c +++ b/fsck/fsck.c @@ -2026,9 +2026,11 @@ int fsck_verify(struct f2fs_sb_info *sbi) fix_hard_links(sbi); fix_nat_entries(sbi); rewrite_sit_area_bitmap(sbi); - move_curseg_info(sbi, SM_I(sbi)->main_blkaddr); - write_curseg_info(sbi); - flush_curseg_sit_entries(sbi); + if (check_curseg_offset(sbi)) { + move_curseg_info(sbi, SM_I(sbi)->main_blkaddr); + write_curseg_info(sbi); + flush_curseg_sit_entries(sbi); + } fix_checkpoint(sbi); } else if (is_set_ckpt_flags(cp, CP_FSCK_FLAG)) { write_checkpoint(sbi); -- 1.8.5.2