From patchwork Thu Feb 16 14:56:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?5p2O5oms6Z+s?= X-Patchwork-Id: 58118 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp351949wrn; Thu, 16 Feb 2023 07:08:51 -0800 (PST) X-Google-Smtp-Source: AK7set9izMkTyJGOtkarhEZ+ISZnJy4zZsVGWmYXw7PUZORBTikRFk6o0YbpYhr7Ejso548BBKFy X-Received: by 2002:aa7:c983:0:b0:4ac:cf29:1a6a with SMTP id c3-20020aa7c983000000b004accf291a6amr5785057edt.20.1676560131449; Thu, 16 Feb 2023 07:08:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1676560131; cv=pass; d=google.com; s=arc-20160816; b=Lol/ZfjB73tXmBp8UzzgCWBNNvRQ//eEaSE5tEAhNMOLxaBfCGVdQO1gu1ijAXkcxZ 7sZkRjIpe8hqOKBdAY7sIF/ak/66I9Bng+IIY2ioPc7RpLnD2lxrXzwVNcy1GSp2jh1b ZgBEv//7Elo+GuIHVv+fXhpAOyQg4OVZxAD7PsumdnmiKFCgEEXiX8MO16LoRQRqG6UK 75OJ4Fs2whw1NoYyd1wA2KNm1RiTKIDOw1fTmkP1KlUWsVH28ChYNDAJ+HGnpEW2bf9s x32GwjlTqT+ysZQ/AEbh9thvASVLQc9meryuHKXHQhpVGoK/7COZyh69UIdBV+ao6KqR 4DAg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:date:subject:cc:to:from:dkim-signature; bh=RQHbNpcMJh3MOvgeTQA8bvKfy6mnW3VY6ldmmLIrzys=; b=sm1zLnU0Z0SPKz6u0dClbNNxXH+IbRB6aM97BPCnv5pWP46VAfldciB7Kxih0KoFOU Qb0NXhGsbRrSpBc3NxfIF5LbITYGfeyWgt78z6cJtmy7gOTM5/OI+0VzKPkQvDQ6kPlH z2+KuyQNxcz7dYYKItOLJnxBZB5qyPm5ID3I7XEPdMGsAWHjyo3AC5pd/vNkdLfJ1WcC QEqJQAw2TJn0/tU9A+XY8/3o8dc7ooMvuUG8IV3EP4f8/Is7ebBJhVPFIxwcKbLXkKVB eYCgxRe0WmoOXeCFKXd5040Ud97q/l7e7RrW210vOXJwT5TUTkSTJ3+9nZB8icvGhB9W GAtg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=oIqLi+zc; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u10-20020aa7d98a000000b004aab40d7a3csi2497962eds.138.2023.02.16.07.08.24; Thu, 16 Feb 2023 07:08:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=oIqLi+zc; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230303AbjBPO4t (ORCPT + 99 others); Thu, 16 Feb 2023 09:56:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229911AbjBPO4r (ORCPT ); Thu, 16 Feb 2023 09:56:47 -0500 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2128.outbound.protection.outlook.com [40.107.255.128]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23C1A5456B for ; Thu, 16 Feb 2023 06:56:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KfCoRKDjNwZkf/AGFMA+ujEIbsb7Ry2/g0h/aRPpUdAnTCh8iDypIZGMuRTfZrjxbKwzs2h1uRON+wBy8/x8k3GNXlhqmomDULL7fVyb77u232+VVfE604C/4i9kuf2bYG7iBgvEJNSvZ4LClRbC3FRL6RJ7VhdhFflpjvgROVrxehCB0XV1NPNl1MEwlMEyVT3a6Q9gphatrl+LrW26BUcNQ+Pli96UM2Lyx98At8AxAqSBTQBWfSasW0NMv/viDzCmu/sSHukaKj7HwfiAySvc0ZUdPDVCT4uDfMe/hSfcPUpSoFSDzvO+B1K3pFew9z7kU9SH5Du/IcqcVfNO9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=RQHbNpcMJh3MOvgeTQA8bvKfy6mnW3VY6ldmmLIrzys=; b=I/faMSVCveVUFG7fvyPR5JfpnK0F2ANGXeHdyD8/lNr4qHLe01cZjuVZi0f5M0be5uSuNk0T9ZPPKw6LA2DlkO6JVhNpddmO22Rrnrr48Hkxq+3+2CtXaP9s3k2Rn7qeDMCh2I8Kh1Nl28qUsN+cwaEJmjFs10u3f7LgKfhZhCB8cFggMt4R97mje25XJLykT2EAzYygAt4qgjlwM+16SsNFWYvWATaagUEPnlQneSur9APw8iFJA277sG5S57OC5xBr2Knq/E+dJJae02yqCq7fxjA/XP17E5f5eRBOvcIwgicWixh7C/w5P1LwydewTAoBav5tWObUUAZtftovbw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RQHbNpcMJh3MOvgeTQA8bvKfy6mnW3VY6ldmmLIrzys=; b=oIqLi+zceOLgnULKHul8WdVYGhKaOEduPCs8dUEZCucJNU4/BfmDbIL8OCn4G6SYvMr4vFUk9qsiEEQn9/ws8lHFPhGRPvZhV/lDsfqKaYgYf8i/vZkGCoNi3cG1MQZWSwBx/COIJ1nswVmH0jHB/v8UFnUrlut5CWkom+ekAmrKMykuDyBfzdqqGXSWzEKZSS0nPjC5M/fxJbR7tOuPQpgHGN/hD6qqXO/dR7EZ1y+/5DKOl7pDt3+M1MR6iqwkcgpn4AShj43Y8j+wDuE4SjTw4/h7v16tKcuLYbDMl/jlLXp1izWGtgBHpPzqDrAM7xZIvWNVBqLYuk83sh00mQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from TYZPR06MB5275.apcprd06.prod.outlook.com (2603:1096:400:1f5::6) by TY0PR06MB5104.apcprd06.prod.outlook.com (2603:1096:400:1b8::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.10; Thu, 16 Feb 2023 14:56:27 +0000 Received: from TYZPR06MB5275.apcprd06.prod.outlook.com ([fe80::a2c6:4a08:7779:5190]) by TYZPR06MB5275.apcprd06.prod.outlook.com ([fe80::a2c6:4a08:7779:5190%3]) with mapi id 15.20.6111.009; Thu, 16 Feb 2023 14:56:27 +0000 From: Yangtao Li To: jaegeuk@kernel.org, chao@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Yangtao Li Subject: [PATCH] f2fs: convert to MAX_SBI_FLAG instead of 32 in stat_show() Date: Thu, 16 Feb 2023 22:56:17 +0800 Message-Id: <20230216145617.27150-1-frank.li@vivo.com> X-Mailer: git-send-email 2.35.1 X-ClientProxiedBy: SG2PR02CA0004.apcprd02.prod.outlook.com (2603:1096:3:17::16) To TYZPR06MB5275.apcprd06.prod.outlook.com (2603:1096:400:1f5::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYZPR06MB5275:EE_|TY0PR06MB5104:EE_ X-MS-Office365-Filtering-Correlation-Id: c3f12e81-288c-4cc1-e5bc-08db102dfab1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 04ZdL2WpDA2+Ug8QhJTud4EhKc/iBp0JxHFapXne4at4ZQau6T7nSAyTGklpO+rh8QQ4lOl2GzCWQtEA+yQtA3fPd15B1Mi+3HurxKs+vNVsI319J+fs1Mt/vQ27f7XrBFgMvCOS3c+b17FxMotUdQLjt9YvOnnx80QxNuIyod+wrMMA64EcfOgZg1Lu14k9NH6gLoVsCWDQ4xl+D6tNWwUIfE1O6FsHy2qYTZHkUYMa40MEEEtGkVrfrGUbdjPxNhXRsdpflRjj5HbWYSGWn2xkdfy7hPjoKOQF9GEEocVK6dxd0QAl/XTcaxzH+p3b9qTIRrGODRkVy1AdHGHnLMdrGuuyf7iKT9/8r2dcsT48je7BiKkJSpH2rlqNBvEh0LyjG8pEMwrt5iAtlsDaEVuEMnAGWrJLZR/LP69GJNHgGGzn1zYREkSWdqnAHlGP4ihneNjThtJAidvYQWDuFUs3XH5hhv/aErEhas5etIDRLu4+8+cMDVaJ/uu334QupXp+N80VZ8RwAm+PIF6y/DhXT6lnrKhopmh+isJPOUIhmvtpZtVpXoz5cwUcnEfgHLtE10JaDwcBu9quXFcPppqn8i9NBrULAMEMpHiREBy/BqyzDJHdHe7rPMw6ZBzDbgyoY5bSeFTohL3vXqHEEAw2dhAS7PAMqI/E3P4ShKFTvvvR+m21DgoVLH8u5vK/s/r79HJ1e1Q0+8Gt3TWIrQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TYZPR06MB5275.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(376002)(346002)(366004)(136003)(39860400002)(396003)(451199018)(107886003)(1076003)(186003)(26005)(6506007)(478600001)(6512007)(86362001)(6666004)(2616005)(6486002)(52116002)(83380400001)(316002)(66946007)(8936002)(5660300002)(8676002)(4326008)(66476007)(2906002)(66556008)(41300700001)(38100700002)(36756003)(38350700002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: nbGc5asf3DzXSnl4magDcosaKnPFvhXWqPWZgRoAH1Bcon9iE2JCr8V+lWkvLxc/1xJHDJbv5vR98Bii8BbiCpIMKDsn1z0s3OxuKcL8kDICs90h0d/Q05vv5qE6yKDgDyLHOeropu0kaPbayGykpN/5KUtviCjBX+czO31rr3pK7e4WFdeFx0fxo6DdxX7QFnBY/YSQ9tj35UG2BOlRx2A8CQf7kHpzbCJhxBZu40aIi4YA9fnBQeU+m+tnO+q10xHddQ/B0p8V1xlPn42Rgryoq6z61NXGO8jc+ENKwVtq7IGpAcsmgo/aoQE3tK3wjwloYoRacFODMlGRWWMCwTBevOmdtTCaklAtvVTndRFTALJPqcxj8vUvvtKIp/OOJrMIYZ+3fMUSJCq/NIK1m/mtvIEz3lqAyi8WIyQbTVjL+CMSmGXsN1jRnDofO3CawBsgXFAq0unn4d5JLp6E4vBhWlZ7FE+Tp4SlHb+nj6tSm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LDYVl3US3M8yfrTff2KH+Tjd4qhrZ8G X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: c3f12e81-288c-4cc1-e5bc-08db102dfab1 X-MS-Exchange-CrossTenant-AuthSource: TYZPR06MB5275.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2023 14:56:27.0167 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 3Mko74GjDBXDXIcxdMPaTgL/DRZh/iZSgn+bEk88ILAPIlrpaP3BIk5djzBT+CwaPPJlDdRFaN98NbxGHILyww== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY0PR06MB5104 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758000716074632831?= X-GMAIL-MSGID: =?utf-8?q?1758000716074632831?= BIT reduce the s_flag array size. Signed-off-by: Yangtao Li --- 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 30a77936e3c5..ab3e9cbd53ee 100644 --- a/fs/f2fs/debug.c +++ b/fs/f2fs/debug.c @@ -336,22 +336,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 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 const char *ipu_mode_names[F2FS_IPU_MAX] = { @@ -384,8 +384,8 @@ static int stat_show(struct seq_file *s, void *v) "Disabled" : (f2fs_cp_error(sbi) ? "Error" : "Good")); if (sbi->s_flag) { seq_puts(s, "[SBI:"); - for_each_set_bit(j, &sbi->s_flag, 32) - seq_puts(s, s_flag[j]); + for_each_set_bit(j, &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 21596e0266ba..e24180c0e4af 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -1293,7 +1293,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 */ @@ -1310,6 +1313,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 {