From patchwork Mon Dec 4 18:04:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaegeuk Kim X-Patchwork-Id: 13478860 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E12C7C10DC3 for ; Mon, 4 Dec 2023 18:05:32 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1rADJy-0002sP-Uv; Mon, 04 Dec 2023 18:05:31 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1rADJo-0002sH-54 for linux-f2fs-devel@lists.sourceforge.net; Mon, 04 Dec 2023 18:05:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:Message-ID: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=42FM9Lmlz3ljAIiJllHUD6LJzJkhOHhnO7eCP4sRhgQ=; b=DRrAu3lkC3gaEuboEUiaQF2gi6 m4ThnQEqOBHMmCJGus7eSv2/0/qPgZ+FVdnEB2qY4vnQzoKWY7RWq0vMX+Pbkmkm5TmGnVZX92bVE KzOpSbs2y8S1CcfoyxUBGJ2VlPA8PAyUcS7CQDwYjfEmoQrZu5O36STWDqEF9ErVo28Q=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject:Cc:To:From :Sender:Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=42FM9Lmlz3ljAIiJllHUD6LJzJkhOHhnO7eCP4sRhgQ=; b=J pkc5msFPIEhFNQCO8yDCTge+kunh/r/lCOCB08ntEWhZGxXm3PAu15INc/uVviQJW16MkAYa6TlDi csgj85cPb/taAb5Ns084Me9HEYdIcUZJ1aYRj9LMKspL3EkxuV2YF4OBNwPXEOcA8qzmhfj7Iqu5v 19IFSNq/TNJNHY1w=; Received: from dfw.source.kernel.org ([139.178.84.217]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1rADJl-0003Tr-UJ for linux-f2fs-devel@lists.sourceforge.net; Mon, 04 Dec 2023 18:05:19 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id B43BD61012 for ; Mon, 4 Dec 2023 18:04:30 +0000 (UTC) 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 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 X-Headers-End: 1rADJl-0003Tr-UJ Subject: [f2fs-dev] [PATCH 1/4] f2fs: allocate new section if it's not new X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jaegeuk Kim Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net 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))