From nobody Fri Nov 29 04:46:06 2024 Received: from exchange.fintech.ru (exchange.fintech.ru [195.54.195.159]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 39F821A7058; Tue, 24 Sep 2024 12:04:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.54.195.159 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727179472; cv=none; b=Utk2zP0DFuLfe+O3Hp6vZIBaXF84gNCiY9PjMyf9f0zntxLHJVCvXJ8mrqY+hkSxX1Es97Xx6HHGOsSMosSLL4EisQddAKpMLM6s8Owm4Z01b3LMmqnfckWunxJYrXcY1LMaTDAml7Ed7fNT9vnqLGkeRh4qdo4bXW8nkUs5J/g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727179472; c=relaxed/simple; bh=YdL10GeXIjk2nbU0lsa5VntCDc2dr0aErMRWGxduYus=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=oJgcjegTh+Zh0jRUJRzxwMKtT0pjdKd4bE2oRw8++jRX54Zqen57urDTx6er99vc1IVsLijig68vc+7pImmGqfCCHJ9MJ1QDNG/i8+BogefpqcSe0KVS5Mrs6zjCAUME19+WVZEzPJX50CAI1rcmZgFDpyJTUe0MyuufxQa4EvI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=fintech.ru; spf=pass smtp.mailfrom=fintech.ru; arc=none smtp.client-ip=195.54.195.159 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=fintech.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fintech.ru Received: from Ex16-01.fintech.ru (10.0.10.18) by exchange.fintech.ru (195.54.195.169) with Microsoft SMTP Server (TLS) id 14.3.498.0; Tue, 24 Sep 2024 15:04:18 +0300 Received: from localhost (10.0.253.138) by Ex16-01.fintech.ru (10.0.10.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Tue, 24 Sep 2024 15:04:18 +0300 From: Nikita Zhandarovich To: , Greg Kroah-Hartman CC: Nikita Zhandarovich , Jaegeuk Kim , Chao Yu , , , Subject: [PATCH 6.1 1/1] f2fs: convert to MAX_SBI_FLAG instead of 32 in stat_show() Date: Tue, 24 Sep 2024 05:04:11 -0700 Message-ID: <20240924120411.34948-2-n.zhandarovich@fintech.ru> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240924120411.34948-1-n.zhandarovich@fintech.ru> References: <20240924120411.34948-1-n.zhandarovich@fintech.ru> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: Ex16-02.fintech.ru (10.0.10.19) To Ex16-01.fintech.ru (10.0.10.18) Content-Type: text/plain; charset="utf-8" From: Yangtao Li commit 5bb9c111cd98ad844d48ace9924e29f56312f036 upstream. BIW reduce the s_flag array size and make s_flag constant. Signed-off-by: Yangtao Li Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim [Nikita: This patch has been cherry-picked from original commit: the only discrepancy was in stat_show(). Specifically, due to lack of commit dda7d77bcd42 ("f2fs: replace si->sbi w/ sbi in stat_show()") keep &si->sbi->s_flag instead of &sbi->s_flag.] Signed-off-by: Nikita Zhandarovich --- fs/f2fs/debug.c | 36 ++++++++++++++++++------------------ fs/f2fs/f2fs.h | 6 +++++- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c index a9baa121d829..002bf12b4e26 100644 --- a/fs/f2fs/debug.c +++ b/fs/f2fs/debug.c @@ -332,22 +332,22 @@ static void update_mem_info(struct f2fs_sb_info *sbi) #endif } =20 -static char *s_flag[] =3D { - [SBI_IS_DIRTY] =3D " fs_dirty", - [SBI_IS_CLOSE] =3D " closing", - [SBI_NEED_FSCK] =3D " need_fsck", - [SBI_POR_DOING] =3D " recovering", - [SBI_NEED_SB_WRITE] =3D " sb_dirty", - [SBI_NEED_CP] =3D " need_cp", - [SBI_IS_SHUTDOWN] =3D " shutdown", - [SBI_IS_RECOVERED] =3D " recovered", - [SBI_CP_DISABLED] =3D " cp_disabled", - [SBI_CP_DISABLED_QUICK] =3D " cp_disabled_quick", - [SBI_QUOTA_NEED_FLUSH] =3D " quota_need_flush", - [SBI_QUOTA_SKIP_FLUSH] =3D " quota_skip_flush", - [SBI_QUOTA_NEED_REPAIR] =3D " quota_need_repair", - [SBI_IS_RESIZEFS] =3D " resizefs", - [SBI_IS_FREEZING] =3D " freezefs", +static const char *s_flag[MAX_SBI_FLAG] =3D { + [SBI_IS_DIRTY] =3D "fs_dirty", + [SBI_IS_CLOSE] =3D "closing", + [SBI_NEED_FSCK] =3D "need_fsck", + [SBI_POR_DOING] =3D "recovering", + [SBI_NEED_SB_WRITE] =3D "sb_dirty", + [SBI_NEED_CP] =3D "need_cp", + [SBI_IS_SHUTDOWN] =3D "shutdown", + [SBI_IS_RECOVERED] =3D "recovered", + [SBI_CP_DISABLED] =3D "cp_disabled", + [SBI_CP_DISABLED_QUICK] =3D "cp_disabled_quick", + [SBI_QUOTA_NEED_FLUSH] =3D "quota_need_flush", + [SBI_QUOTA_SKIP_FLUSH] =3D "quota_skip_flush", + [SBI_QUOTA_NEED_REPAIR] =3D "quota_need_repair", + [SBI_IS_RESIZEFS] =3D "resizefs", + [SBI_IS_FREEZING] =3D "freezefs", }; =20 static int stat_show(struct seq_file *s, void *v) @@ -367,8 +367,8 @@ static int stat_show(struct seq_file *s, void *v) "Disabled" : (f2fs_cp_error(si->sbi) ? "Error" : "Good")); if (si->sbi->s_flag) { seq_puts(s, "[SBI:"); - for_each_set_bit(j, &si->sbi->s_flag, 32) - seq_puts(s, s_flag[j]); + for_each_set_bit(j, &si->sbi->s_flag, MAX_SBI_FLAG) + seq_printf(s, " %s", s_flag[j]); seq_puts(s, "]\n"); } seq_printf(s, "[SB: 1] [CP: 2] [SIT: %d] [NAT: %d] ", diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 2b540d87859e..75db7c09bdfe 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -1271,7 +1271,10 @@ struct f2fs_gc_control { unsigned int nr_free_secs; /* # of free sections to do GC */ }; =20 -/* For s_flag in struct f2fs_sb_info */ +/* + * For s_flag in struct f2fs_sb_info + * Modification on enum should be synchronized with s_flag array + */ enum { SBI_IS_DIRTY, /* dirty flag for checkpoint */ SBI_IS_CLOSE, /* specify unmounting */ @@ -1288,6 +1291,7 @@ enum { SBI_QUOTA_NEED_REPAIR, /* quota file may be corrupted */ SBI_IS_RESIZEFS, /* resizefs is in process */ SBI_IS_FREEZING, /* freezefs is in process */ + MAX_SBI_FLAG, }; =20 enum {