From patchwork Tue Sep 24 12:04:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikita Zhandarovich X-Patchwork-Id: 13810881 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 D170CCF9C73 for ; Tue, 24 Sep 2024 12:16:52 +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 1st4TL-0006aa-28; Tue, 24 Sep 2024 12:16:51 +0000 Received: from [172.30.29.66] (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 1st4TI-0006aS-Nz for linux-f2fs-devel@lists.sourceforge.net; Tue, 24 Sep 2024 12:16:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Type:Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=hHwvyKdZsKZRuH70HLay5NTrOocz1Vg8//PxQMkg4pQ=; b=ESpq+PxubtDk00waTROJJzKZKN Cb8oYcP93ecy/dQXutoJyMhWKmTkN4Al6nmkZRcrgudTYDP41ho1iLVNPXjDRKsgnw7tcGCwor8L1 WpOW+VB5fz5Lh1/YEqwOFoOxnuTZ4oUVYXWhL4MlUn8A7owF7qy335OHQ+es3PSONqNE=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Type:Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=hHwvyKdZsKZRuH70HLay5NTrOocz1Vg8//PxQMkg4pQ=; b=ggQDa0BFGXLEgrch+G8C0jD0Tx 73Q/YHq1ExnNRGS1USbaSIQTC3FgYKj3azau8wi86pXui+bl6ERVcmE1ByPEJhP7HqxEL7tslvK+N ZG1sSfAPaCtrcowj6dZxhK1k845oWjUW+AQAHi5BdLcGBq1jsdT6G1uBS3Oc1605wr2E=; Received: from exchange.fintech.ru ([195.54.195.159]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-SHA384:256) (Exim 4.95) id 1st4TI-0007Po-24 for linux-f2fs-devel@lists.sourceforge.net; Tue, 24 Sep 2024 12:16:48 +0000 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 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> MIME-Version: 1.0 X-Originating-IP: [10.0.253.138] X-ClientProxiedBy: Ex16-02.fintech.ru (10.0.10.19) To Ex16-01.fintech.ru (10.0.10.18) X-Headers-End: 1st4TI-0007Po-24 Subject: [f2fs-dev] [PATCH 6.1 1/1] f2fs: convert to MAX_SBI_FLAG instead of 32 in stat_show() 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: lvc-project@linuxtesting.org, linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, Nikita Zhandarovich , Jaegeuk Kim Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net 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 } -static char *s_flag[] = { - [SBI_IS_DIRTY] = " fs_dirty", - [SBI_IS_CLOSE] = " closing", - [SBI_NEED_FSCK] = " need_fsck", - [SBI_POR_DOING] = " recovering", - [SBI_NEED_SB_WRITE] = " sb_dirty", - [SBI_NEED_CP] = " need_cp", - [SBI_IS_SHUTDOWN] = " shutdown", - [SBI_IS_RECOVERED] = " recovered", - [SBI_CP_DISABLED] = " cp_disabled", - [SBI_CP_DISABLED_QUICK] = " cp_disabled_quick", - [SBI_QUOTA_NEED_FLUSH] = " quota_need_flush", - [SBI_QUOTA_SKIP_FLUSH] = " quota_skip_flush", - [SBI_QUOTA_NEED_REPAIR] = " quota_need_repair", - [SBI_IS_RESIZEFS] = " resizefs", - [SBI_IS_FREEZING] = " freezefs", +static const char *s_flag[MAX_SBI_FLAG] = { + [SBI_IS_DIRTY] = "fs_dirty", + [SBI_IS_CLOSE] = "closing", + [SBI_NEED_FSCK] = "need_fsck", + [SBI_POR_DOING] = "recovering", + [SBI_NEED_SB_WRITE] = "sb_dirty", + [SBI_NEED_CP] = "need_cp", + [SBI_IS_SHUTDOWN] = "shutdown", + [SBI_IS_RECOVERED] = "recovered", + [SBI_CP_DISABLED] = "cp_disabled", + [SBI_CP_DISABLED_QUICK] = "cp_disabled_quick", + [SBI_QUOTA_NEED_FLUSH] = "quota_need_flush", + [SBI_QUOTA_SKIP_FLUSH] = "quota_skip_flush", + [SBI_QUOTA_NEED_REPAIR] = "quota_need_repair", + [SBI_IS_RESIZEFS] = "resizefs", + [SBI_IS_FREEZING] = "freezefs", }; 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 */ }; -/* 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, }; enum {