Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2886294rdb; Mon, 4 Dec 2023 10:04:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IEX/jc/DpSraaNl9GlUyZuOS/e+tLRDcHVgyEL1Qpb3zBmmLFl9KCqqAJIv63ggzBMwQo4u X-Received: by 2002:a05:6a20:2214:b0:181:15:5755 with SMTP id u20-20020a056a20221400b0018100155755mr4257691pzb.56.1701713088004; Mon, 04 Dec 2023 10:04:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701713087; cv=none; d=google.com; s=arc-20160816; b=sU8F6PXRxrOaogngxf3oMqRmFjttN0s3RevtxvRjQopg1RPywhpf1dZBMtaf39CjBd kraU8KYzS3wV9lCdYu2+pnthSzY6DoiTbfRspisJ7AsCI9+Avoc2xukrJ/duOfTv8xzn DJC3lp3QeovnQ1xrU+UUtqHv+/QjuzBEXlXA+QRa8H9dD4dhv/MbTi0svseGk87HwTqU NcTRXMx6RHNrYmu3GwwbawwQaOwxG65OtTck/BXWwEwH9nDi3QDBbdLfTv9n3CIzMrIO zTdzBO5+7Hi5/XRdf4Nd8QidWjT9BW7+eg5JeIUeki8I1xb9wqLK/vKF8LonQQ/kfW9H UvsQ== 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=42FM9Lmlz3ljAIiJllHUD6LJzJkhOHhnO7eCP4sRhgQ=; fh=rqHW7NazYv3wAmgqDKAbZUXWTmf0VaM5epB9R4zfTUE=; b=eP31UJc1if+iI+gE6DoJVY01fdx+s62NvwJ6qlKTqVwg8FkP24hAfsQqfO2iSKQ3rn rcQyH5nP6U5HtbFAyh9EeRISqcpmLCRNWtur/89PxAM/9kSNgqO2DWk74QbgppllQiBJ adhLc1zPpb8B5MskhAwXtwtJABD0gd77Qgy72gmPp6W4LmiOIdz2NePoN8GGyfwQGm/X a6YERwvho/vfAmykMQFZbbIByaHlojgbK+OtN1UALJJ8CgsMy3o8jSiUlN24UXWA2WL9 VTA6E65JNRHcdFLvM2J2Gy2QTAR/TL+p48zG06XQsBqweQ8eylePeB/FUudH3Y+BfpIe n3cA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ur12VQb4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id n124-20020a632782000000b005be0ca9ca31si3744032pgn.294.2023.12.04.10.04.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 10:04:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ur12VQb4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id D2BCD805F41E; Mon, 4 Dec 2023 10:04:43 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230437AbjLDSEY (ORCPT + 99 others); Mon, 4 Dec 2023 13:04:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229659AbjLDSEY (ORCPT ); Mon, 4 Dec 2023 13:04:24 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C259DB4 for ; Mon, 4 Dec 2023 10:04:30 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50B42C433C8; Mon, 4 Dec 2023 18:04:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701713070; bh=mUugqGoNQY22hq7LD3Ng4JWWKEvMHSmLjfx04YNhku8=; h=From:To:Cc:Subject:Date:From; b=Ur12VQb4BP2PBWEsFOMmdyNuhOyOq9zdSRy80z1wC0D7+LaHAetoEvrqRb8zl2OrA V6RUsswTmytl3T/Q13d4lM8GRErmj202ovcKxAKrbhk+YnskL2w2+5Nq8eHkrxWsSA U2ytjP22b1y1jF4ckQB7Hs47rrKovgL1lslvSRsTvx93ilLOhIqHfJ9x+cdD0LjX8u oFYTcniGkb2iMOVXhyuHeDgrQ+8HQHyu9uiYJdaFF5AXSmyXEkOk4LkSb4bdzbSi5B HOAihdb8gM/T0oxKmrfe0hdiPqSB7hNaTXN/qGqnsvchwh26BFRLDq6SMfwBz/qrNy 2IRyswgB7RFHg== From: Jaegeuk Kim To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Cc: Jaegeuk Kim Subject: [PATCH 1/4] f2fs: allocate new section if it's not new Date: Mon, 4 Dec 2023 10:04:25 -0800 Message-ID: <20231204180428.925779-1-jaegeuk@kernel.org> X-Mailer: git-send-email 2.43.0.rc2.451.g8631bc7472-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.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 (fry.vger.email [0.0.0.0]); Mon, 04 Dec 2023 10:04:44 -0800 (PST) If fsck can allocate a new zone, it'd be better to use that instead of allocating a new one. And, it modifies kernel messages. Signed-off-by: Jaegeuk Kim --- fs/f2fs/segment.c | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 08e2f44a1264..9081c9af977a 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -4949,20 +4949,18 @@ static int check_zone_write_pointer(struct f2fs_sb_info *sbi, return ret; } - if (is_set_ckpt_flags(sbi, CP_UMOUNT_FLAG)) { - /* - * If there are valid blocks and the write pointer doesn't match - * with them, we need to report the inconsistency and fill - * the zone till the end to close the zone. This inconsistency - * does not cause write error because the zone will not be - * selected for write operation until it get discarded. - */ - f2fs_notice(sbi, "Valid blocks are not aligned with write " + /* + * If there are valid blocks and the write pointer doesn't match + * with them, we need to report the inconsistency and fill + * the zone till the end to close the zone. This inconsistency + * does not cause write error because the zone will not be + * selected for write operation until it get discarded. + */ + f2fs_notice(sbi, "Valid blocks are not aligned with write " "pointer: valid block[0x%x,0x%x] wp[0x%x,0x%x]", GET_SEGNO(sbi, last_valid_block), GET_BLKOFF_FROM_SEG0(sbi, last_valid_block), wp_segno, wp_blkoff); - } ret = blkdev_zone_mgmt(fdev->bdev, REQ_OP_ZONE_FINISH, zone->start, zone->len, GFP_NOFS); @@ -5053,15 +5051,18 @@ static int fix_curseg_write_pointer(struct f2fs_sb_info *sbi, int type) f2fs_notice(sbi, "Unaligned curseg[%d] with write pointer: " "curseg[0x%x,0x%x] wp[0x%x,0x%x]", type, cs->segno, cs->next_blkoff, wp_segno, wp_blkoff); - } else { - f2fs_notice(sbi, "Not successfully unmounted in the previous " - "mount"); } - f2fs_notice(sbi, "Assign new section to curseg[%d]: " - "curseg[0x%x,0x%x]", type, cs->segno, cs->next_blkoff); + /* Allocate a new section if it's not new. */ + if (cs->next_blkoff) { + unsigned int old_segno = cs->segno, old_blkoff = cs->next_blkoff; - f2fs_allocate_new_section(sbi, type, true); + f2fs_allocate_new_section(sbi, type, true); + f2fs_notice(sbi, "Assign new section to curseg[%d]: " + "[0x%x,0x%x] -> [0x%x,0x%x]", + type, old_segno, old_blkoff, + cs->segno, cs->next_blkoff); + } /* check consistency of the zone curseg pointed to */ if (check_zone_write_pointer(sbi, zbd, &zone)) -- 2.43.0.rc2.451.g8631bc7472-goog