Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp91782rbb; Fri, 23 Feb 2024 12:55:59 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXPDneXUdA+7fj2vC26YRwwACZ4bQeuvQJkCsaoEcOwp+ZatjBkBfr/rcBn8YwpCBxy6EiaAO54JuczGfkK/0GJuu5FHtSs2/pXiIuUDA== X-Google-Smtp-Source: AGHT+IG+FJy/mlIdfAKPfowmm87EHo2QNdF++jibvbSG80PdZr6zZtQZYiJM0o6Ya+kIybDpR4/r X-Received: by 2002:a17:90b:3743:b0:29a:7d56:fb86 with SMTP id ne3-20020a17090b374300b0029a7d56fb86mr1020756pjb.21.1708721759554; Fri, 23 Feb 2024 12:55:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708721759; cv=pass; d=google.com; s=arc-20160816; b=PBWljmaF+JrrUBJVjoI01rvu5q3vNwShUyQVBwm5n3pGyL0OcrxvUi01Sc3KrhoHvi mC3lcpZl9+7E5kWEte4a3AQWKpCMuLc10VZ2+Ie6bLcKbtvuTeRJ7lqc3rcVHhMdhw65 Uj069j7nNRbMKEVfqFsiawOH5JJYPHpgdp1Fru4Q1J26UMIqvmXK39ElwAL9C2GSVcPq NZ/cq8xcfFjDZpzFoOqX8C4WEI66w73u941TMA9aue/ahvZbzy+yIGGRsl6i7QaCThbk ttv7z45uQK8H7/r6jjBYF7pELu/jhlNCunBYclpnqkeaSYTqg+msKhKxjAd5r80wR353 rdig== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=D7XUHBVG5VP8tTRX82JAqat+7CnBaGyL6YGkNS+felE=; fh=rqHW7NazYv3wAmgqDKAbZUXWTmf0VaM5epB9R4zfTUE=; b=NzNUSc2KFab1iEX1yx/rPOpMfW6RCVOnauxUChB2t3oT0VjyVVndKgHz0vQ4LxL/eY Ab4+d5vo5149G09+otxr6mEIUqkFbFl/oZLgoY1hulFKl4PfOOtEBTLgrBs9o9fzHkRZ 5drGBkPS4EFcZkKQYTU08eIZFQRf3j2AVfoCDS1T/zSQNgM5JNyyouJ4j1zd95FVTFKI eJCy7p3cREo0LCZvEjv+EYAGjMX5MLdmu/gW4fnHq5h+e/IpImV3W1OxS2jEx/o5mFku BLDG+zuLAX8h0EuUrIgoOLe5mQwsaxdhYzk8DH46kLPkcMz7tE/XUhrfykJuTm49nwr+ kUGQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LRpvbscO; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-79148-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79148-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id kk15-20020a17090b4a0f00b00298f66dd39esi1776649pjb.3.2024.02.23.12.55.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 12:55:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-79148-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LRpvbscO; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-79148-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79148-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 442FF286157 for ; Fri, 23 Feb 2024 20:55:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B1272149396; Fri, 23 Feb 2024 20:55:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LRpvbscO" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D1A5E148FE2 for ; Fri, 23 Feb 2024 20:55:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708721738; cv=none; b=qf/9pg950SU+rGsMMgp6NLnrgGjonbfOiWyJF04qemOmd1qx1+yYe7+5dEVkmBjpvBEWNT5RJtEPY9IdiLeb12AgqiZNhvO4Hn7FMXm+DCyMS1SFNQD7cbBOrOuuOU9V+gTf36xOFryAdErbVrAmuwoM+yOH60LLDBM+zNm0w2k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708721738; c=relaxed/simple; bh=R/vfhqy/4C7K0V3VZuGnVkSeQBgr0Z+xmB/Uvgm51/A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PbOe7YV82qZlrVbmvlkso1Ulbot1WUhM3k+gbfXmXobvH81IVwXmy8JtEuYR7IBjTxlMa39ROow3q6ok7ukm43jOcnCmX8cp4ImJD1RJiEVTkIg/F8y4cO2/uc4xuKSdKU1EvM0Q0yrbTLRrBtq5x/0Hejxt5YkMJ5oJ4wTzamQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LRpvbscO; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C9C0C433C7; Fri, 23 Feb 2024 20:55:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708721738; bh=R/vfhqy/4C7K0V3VZuGnVkSeQBgr0Z+xmB/Uvgm51/A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LRpvbscO7LXmmXBcarD3+VMukyWgtYq/6MbNM+YJxM44f1d3Zscji2NmhPWQqhtO4 8G24rwNuhd1Xrlv6Q6TwY6VPOglTLsMbZMuVRC63y4lAMgbaRtGbrC84e6szyRKYoh KSs3yaxKLEHKui4pzYmwLNARtBc7KNrBUqaRhDjXnKdNCSyjxkU7FMrxbpszmpjTUJ 6HGt1x6ruljOlk2VymQbuYzArXoMHqFDTZ36z/hueyDxP4xn8xMWruGMM/R0MqGzRr JQawne3K20bKzxEwvRqL9WoPAqLsCUXV1yWZf1k4RLj807ar9hwUhNDhYa5YsGqcT4 Sy3tqAPGcTKnA== From: Jaegeuk Kim To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Cc: Jaegeuk Kim Subject: [PATCH 3/5] f2fs: print zone status in string and some log Date: Fri, 23 Feb 2024 12:55:33 -0800 Message-ID: <20240223205535.307307-3-jaegeuk@kernel.org> X-Mailer: git-send-email 2.44.0.rc0.258.g7320e95886-goog In-Reply-To: <20240223205535.307307-1-jaegeuk@kernel.org> References: <20240223205535.307307-1-jaegeuk@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit No functional change, but add some more logs. Signed-off-by: Jaegeuk Kim --- fs/f2fs/segment.c | 34 ++++++++++++++++++++++++---------- fs/f2fs/super.c | 1 + 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index d4f228e6f771..6d586ae8b55f 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -4912,6 +4912,16 @@ static int sanity_check_curseg(struct f2fs_sb_info *sbi) } #ifdef CONFIG_BLK_DEV_ZONED +const char *f2fs_zone_status[BLK_ZONE_COND_OFFLINE + 1] = { + [BLK_ZONE_COND_NOT_WP] = "NOT_WP", + [BLK_ZONE_COND_EMPTY] = "EMPTY", + [BLK_ZONE_COND_IMP_OPEN] = "IMPLICITE_OPEN", + [BLK_ZONE_COND_EXP_OPEN] = "EXPLICITE_OPEN", + [BLK_ZONE_COND_CLOSED] = "CLOSED", + [BLK_ZONE_COND_READONLY] = "READONLY", + [BLK_ZONE_COND_FULL] = "FULL", + [BLK_ZONE_COND_OFFLINE] = "OFFLINE", +}; static int check_zone_write_pointer(struct f2fs_sb_info *sbi, struct f2fs_dev_info *fdev, @@ -4928,18 +4938,22 @@ static int check_zone_write_pointer(struct f2fs_sb_info *sbi, zone_block = fdev->start_blk + (zone->start >> log_sectors_per_block); zone_segno = GET_SEGNO(sbi, zone_block); + /* + * Get # of valid block of the zone. + */ + valid_block_cnt = get_valid_blocks(sbi, zone_segno, true); + /* * Skip check of zones cursegs point to, since * fix_curseg_write_pointer() checks them. */ if (zone_segno >= MAIN_SEGS(sbi) || - IS_CURSEC(sbi, GET_SEC_FROM_SEG(sbi, zone_segno))) + IS_CURSEC(sbi, GET_SEC_FROM_SEG(sbi, zone_segno))) { + f2fs_notice(sbi, "Open zones: valid block[0x%x,0x%x] cond[%s]", + zone_segno, valid_block_cnt, + f2fs_zone_status[zone->cond]); return 0; - - /* - * Get # of valid block of the zone. - */ - valid_block_cnt = get_valid_blocks(sbi, zone_segno, true); + } if ((!valid_block_cnt && zone->cond == BLK_ZONE_COND_EMPTY) || (valid_block_cnt && zone->cond == BLK_ZONE_COND_FULL)) @@ -4947,8 +4961,8 @@ static int check_zone_write_pointer(struct f2fs_sb_info *sbi, if (!valid_block_cnt) { f2fs_notice(sbi, "Zone without valid block has non-zero write " - "pointer. Reset the write pointer: cond[0x%x]", - zone->cond); + "pointer. Reset the write pointer: cond[%s]", + f2fs_zone_status[zone->cond]); ret = __f2fs_issue_discard_zone(sbi, fdev->bdev, zone_block, zone->len >> log_sectors_per_block); if (ret) @@ -4965,8 +4979,8 @@ static int check_zone_write_pointer(struct f2fs_sb_info *sbi, * 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] cond[0x%x]", - zone_segno, valid_block_cnt, zone->cond); + "pointer: valid block[0x%x,0x%x] cond[%s]", + zone_segno, valid_block_cnt, f2fs_zone_status[zone->cond]); ret = blkdev_zone_mgmt(fdev->bdev, REQ_OP_ZONE_FINISH, zone->start, zone->len, GFP_NOFS); diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 4d03ce1109ad..fc7f1a9fbbda 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -4674,6 +4674,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) * check zoned block devices' write pointer consistency. */ if (!f2fs_readonly(sb) && f2fs_sb_has_blkzoned(sbi)) { + f2fs_notice(sbi, "Checking entire write pointers"); err = f2fs_check_write_pointer(sbi); if (err) goto free_meta; -- 2.44.0.rc0.258.g7320e95886-goog