From patchwork Fri Oct 27 15:49:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daeho Jeong X-Patchwork-Id: 159006 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp701126vqb; Fri, 27 Oct 2023 08:50:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGhBtU+t0qi4rhmxmcb6IqROSSen6kD8/Uu8PJhQf2DJGPSUXfWDb/wl+0mM+e63aUYBUp6 X-Received: by 2002:a05:6870:a9a1:b0:1ef:3916:2d80 with SMTP id ep33-20020a056870a9a100b001ef39162d80mr3913570oab.46.1698421804622; Fri, 27 Oct 2023 08:50:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698421804; cv=none; d=google.com; s=arc-20160816; b=XFF7MfVlzGSwtMuHHJt/n4WFyL7zshrwDaw5Xq4Dq59P8Zi5C4ezw90NVSbIHvRL0K aEVutKibW6rkmGGsFPH6nytOgKa7yPax4+ROTwkvEbEJzx6no2idG0EkTQzgNj88Mgcu SajvwczJ4vNcFZrb9sNpl2SVRYXogTJ7PBugQVAvQrn8mbKUCg5A8vbKRypdmeKEeYen twTG/k0c0N1zeOes03eoH/CnhFetE0iFZYs0HntEfPwUhXR7X9Vq7B9W/kZolBsESHX6 SLvmPv2hCJESqZ842MoVi/p2eqdZH+T3b/lPGYRszQrA1017FPiApbl2SdkxFxOo7wmU ABvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=cTGZ3m1qe87c+NuEwbcQd6GcZq/RTlx8NPY386XZ8A4=; fh=IvJDhn2XbJ55zxf0p/e9A+SWoPpre/ymwh9Q/MPTdCg=; b=YOxi0K1OZ8a8maBmjDkEm7ZwbaLYdJ+fZUtKX3M0pkuc9X5NS2zyE0Hp4rcOGfBe/H fVmB6Sd35w8TgmSZNhvhLqQCOdzWz4G+WH06wolPRNxXtT3uUZ+Xx0k5S0Pf9rxcFDSN Ox9Uh89upW/ulTOPy9CMAXkFQN01IA5rSrJqEuNNrL8VxGB8UYsAH9nLIWh7iqfh14E+ 7+V5lAJgrRGuR3w+NZWNQS8hKwupqXixyyQ5zx9Adu+Eo8S+hGN8XafPr8iMSGJPQDjV hxxEhLHbNqdXEgwkdJFcHYDSNh031tLaeclRxlMwmNOo9QDeZDDGHLD5uF28yPKnk6gM X8Gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=i4xLrZVV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id j9-20020a255509000000b00d8680fb22f6si2955514ybb.85.2023.10.27.08.50.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Oct 2023 08:50:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=i4xLrZVV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 2816D82976BA; Fri, 27 Oct 2023 08:50:02 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346235AbjJ0Ptp (ORCPT + 25 others); Fri, 27 Oct 2023 11:49:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346174AbjJ0Pto (ORCPT ); Fri, 27 Oct 2023 11:49:44 -0400 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9F99CE for ; Fri, 27 Oct 2023 08:49:39 -0700 (PDT) Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1cc2f17ab26so1041425ad.0 for ; Fri, 27 Oct 2023 08:49:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698421779; x=1699026579; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=cTGZ3m1qe87c+NuEwbcQd6GcZq/RTlx8NPY386XZ8A4=; b=i4xLrZVVZtOJFcD8m06YQWcTY5+aLIxQvjsrQApqEr5Lrji5c0tic5egNl10g+9PK4 nKbsUELnSFbIOeb/xURs8ZozeIIM9+ZKrD65A03NsiTKDPSxDOZBo/VQfzdwWBZGXF5A Q1znqinCaCaZcwXxzq4N36wcYJU5Qca8BBDpfyvTlu2qRNvG0OF7U+XrJL0k7fugUiIC 4iUDJLhetqOatQk4Bg0X0xWmxUj2pQSI8VrkXi2pVf6EncXCVf3Th8Uut+Wa9pDGF08L 3yM4klzgiW/kfYicD5kNpt6ND/0mMGWyn+04ttokaNIQbZnY3lLi8AbTWfzHmqakfb4f 0L2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698421779; x=1699026579; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=cTGZ3m1qe87c+NuEwbcQd6GcZq/RTlx8NPY386XZ8A4=; b=EX5JVNKJMsFslKw0mStaIbENzPNVR39qEBzr8AKS4dvysmLFATnrHCe7SsP4JsH0wq I9uuNjR3zQSNcKOGlur4Wrh3m0FCp6SaW2Wv5mj84aOGxl/HuQ50KZ324F9cd1/IlSRM VShwtW1/2SGa+tbMXZteCrgGAsUzjyhbJSMs+IRb1d+BxqEFsqVsHheBzPNo71pkSum8 Dydh8q6ddKBnZarHf9n7np6W/flgi0eWOD6XeMoloaAuGlJHKy1IqmTZI80aovvXR0gP pLwuwyI5mB6XJ79T5Gx6tMGPB+Pd95Fq57j39mEe38aTWbVzAzhAEd8YIu+Z01xgl9vk EmTw== X-Gm-Message-State: AOJu0YzVBig2/iCoBK+54KBJaOaVPLixIvNx12Xg83Uf45IvASP8hX0D 1f6DsnviigJN8MJ7ylJs2f+qoP1BVQg= X-Received: by 2002:a17:902:f990:b0:1cc:1ee2:d41d with SMTP id ky16-20020a170902f99000b001cc1ee2d41dmr2091834plb.39.1698421778702; Fri, 27 Oct 2023 08:49:38 -0700 (PDT) Received: from daehojeong-desktop.mtv.corp.google.com ([2620:15c:211:201:d9fe:c408:7e52:ad85]) by smtp.gmail.com with ESMTPSA id ij27-20020a170902ab5b00b001ca4c20003dsm1761412plb.69.2023.10.27.08.49.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Oct 2023 08:49:38 -0700 (PDT) From: Daeho Jeong To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com Cc: Daeho Jeong Subject: [PATCH] f2fs-tools: do not put CP_UMOUNT_FLAG for roll forward recovery Date: Fri, 27 Oct 2023 08:49:35 -0700 Message-ID: <20231027154935.1384979-1-daeho43@gmail.com> X-Mailer: git-send-email 2.42.0.820.g83a721a137-goog MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Fri, 27 Oct 2023 08:50:02 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780924342443048524 X-GMAIL-MSGID: 1780924342443048524 From: Daeho Jeong If we write CP_UMOUNT_FLAG in fsck, f2fs will not do foll forward recovery even though it has to do. Signed-off-by: Daeho Jeong Reviewed-by: Chao Yu --- fsck/fsck.c | 3 ++- fsck/mount.c | 5 ++++- include/f2fs_fs.h | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/fsck/fsck.c b/fsck/fsck.c index f1a55db..126458c 100644 --- a/fsck/fsck.c +++ b/fsck/fsck.c @@ -2526,7 +2526,8 @@ static void fix_checkpoint(struct f2fs_sb_info *sbi) struct f2fs_super_block *sb = F2FS_RAW_SUPER(sbi); struct f2fs_checkpoint *cp = F2FS_CKPT(sbi); unsigned long long cp_blk_no; - u32 flags = c.alloc_failed ? CP_FSCK_FLAG: CP_UMOUNT_FLAG; + u32 flags = c.alloc_failed ? CP_FSCK_FLAG : + (c.roll_forward ? 0 : CP_UMOUNT_FLAG); block_t orphan_blks = 0; block_t cp_blocks; u32 i; diff --git a/fsck/mount.c b/fsck/mount.c index 3b02d73..805671c 100644 --- a/fsck/mount.c +++ b/fsck/mount.c @@ -3218,7 +3218,7 @@ void write_checkpoint(struct f2fs_sb_info *sbi) struct f2fs_super_block *sb = F2FS_RAW_SUPER(sbi); block_t orphan_blks = 0; unsigned long long cp_blk_no; - u32 flags = CP_UMOUNT_FLAG; + u32 flags = c.roll_forward ? 0 : CP_UMOUNT_FLAG; int i, ret; uint32_t crc = 0; @@ -3837,6 +3837,9 @@ static int record_fsync_data(struct f2fs_sb_info *sbi) if (ret) goto out; + if (c.func == FSCK && inode_list.next != &inode_list) + c.roll_forward = 1; + ret = late_build_segment_manager(sbi); if (ret < 0) { ERR_MSG("late_build_segment_manager failed\n"); diff --git a/include/f2fs_fs.h b/include/f2fs_fs.h index abd5abf..faa5d6b 100644 --- a/include/f2fs_fs.h +++ b/include/f2fs_fs.h @@ -1513,6 +1513,7 @@ struct f2fs_configuration { unsigned int feature; /* defined features */ unsigned int quota_bits; /* quota bits */ time_t fixed_time; + int roll_forward; /* mkfs parameters */ int fake_seed;