From patchwork Wed Mar 8 14:06:23 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: 66262 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp372325wrd; Wed, 8 Mar 2023 06:39:35 -0800 (PST) X-Google-Smtp-Source: AK7set9VPM5ZxJvLwG+7Qmy3UszJXFUSuQl16A/mHS7JXvmsSYYEY90KELGfJ248J+LXCeMDHs+e X-Received: by 2002:a17:902:d2c7:b0:19e:8bfe:7d70 with SMTP id n7-20020a170902d2c700b0019e8bfe7d70mr23938160plc.52.1678286375383; Wed, 08 Mar 2023 06:39:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1678286375; cv=pass; d=google.com; s=arc-20160816; b=q5d/ZywGkKrbjKebKA0nL17SyrDvju8GRESUVFoklAgA7LHXn9bBmxqfPGsP3duVTB r6dQNl25mRqn3fTVZqHMd5uWM4z+tpZ5qOnyGLXH2UC6bmoYcH7NuSk48KAk/wI6i6ql EruXJKpsmq+nq3VMjnLhI7BKpsLzegCLJMUP323FoVKaEYSQFqNGygqyqJBndL+bTQT5 sFKf2M2kjip8TfHsI2gki8vkXz+la75/a1c5k8f89MdCPL1Xy2FYf2r4edJrxuQGfRFj EVPqB31K0r6URV8wg4fmQkfXOT8KY+Z/96sHqrx6H6y7jAzC3OksHPraxzvK0tJtXYJ6 He/Q== 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=AD1P0zCuZE1mOzgafX/9VHR5R5ypvA8ZVLVRhF2+K+c=; b=rGFv99ogFU17Ii7x80cXXkht1gizZ2rfxZ1E268c2KWXf/4HuLS52IRx/eUFZ+tvJY yhDCl5LZDMounuJ7GcK7NeLQjvpAsRG8rqkX3WKbNgaZaOIPeczEi6KgDHoF/yTbAZOd vItarPk2TXdqQS5b4AWWtEybwheIg5rPkhpFWjSDHwe7tvf6ha78qjvLzcqjdBtGI+Tw s8/ZhFdbCFp0R2Sx0c58DjtjXV/J2FsAcHTWQQ91I8uOFl8zLpnadulChMlYsnAZCRGa O+qLJcfxhEQIzvvF9uVhLVSTjhA0J/pVFONgmYF4xO0dArlsqMFwJ3tWzVSQnRhkVjVa Bw9A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=U8AgldkV; 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 84-20020a630557000000b004d2621d6a70si14529843pgf.163.2023.03.08.06.39.22; Wed, 08 Mar 2023 06:39:35 -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=U8AgldkV; 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 S232131AbjCHOIa (ORCPT + 99 others); Wed, 8 Mar 2023 09:08:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231796AbjCHOH6 (ORCPT ); Wed, 8 Mar 2023 09:07:58 -0500 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2108.outbound.protection.outlook.com [40.107.215.108]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE3B35B5EB for ; Wed, 8 Mar 2023 06:06:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GsqLL0dQeJwOVnBwjP6h8fsFTv4GlCfD0OQQScZ786tBeMY1VlTQybZ39wOXvuvl6Uk1OzE678CDl5xvy5mGY/cR2UdUfhI4A67METtzyZeeyMg5CwjtVzWhWaRYCv/+QLW5zWVt/v47JyaDDx6k/0Axijp/TOdbniWRafR5rjzrAYY+6G54cQk2QBZ0YcZjHGC9QXw6ZB1cxb3xVjNrzXf8I+1C7gpKw7D/aBlgEGOQ/ncxuLsgBM7FMbuc1XlC2yy/GMgFOFEi4GxVlHRaXEL1qJ6C7J9VYfQaBCLrwtLujrjooKs909uqejvhBniIYUvfovDf14siRnaFhpQH4A== 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=AD1P0zCuZE1mOzgafX/9VHR5R5ypvA8ZVLVRhF2+K+c=; b=AGK/48C9R4fCGCBfCYk5uoljn/FnKL1u8KaqO4VgJ7ctECidjG7IBE51qzWnE9UHtKzfgUi8igJ1pQ+Bz9zrCESEt1sFVczvvoKw2kZHeu81L0yqZXY2TaMUUWDfR3bleKyxMBsyPiJX+h6xETLfsnQMZDuLIcl4+jFZcwaPC75PdFw/6bTr/pSuD09ZvLB4ovwpNk+j3DLjD++nzpPs80EETY8/hvfki/FdNk2MVyxrqnEqLwYOwtRySoyDOq4rmooAhhfCywFdNNBh9lMZHPjrXgdhgNo7DpVEhd+TxHspWr3WgQXG++havoLMR8snmsn9JbsXVMSXmveQhwjI2A== 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=AD1P0zCuZE1mOzgafX/9VHR5R5ypvA8ZVLVRhF2+K+c=; b=U8AgldkVsQ29s2sce4haB0ndpjd3D4etPN/6yr8Z1pX7rh6J2W+csZt1vQy/wJxANwNkPGr4Fa046ZckT1kQjnwCfSthSXUJeG2AT+AI7xJ1S93q3hAmadNKaCtQMQJtdqZ7s/XDmrD+988k6inYPAzwsd6YuQIyKSyXBPFEU6SvUhASM587vobw/5m78sSI3VL6E1/7HL7GAE72LsPgg54fkkyhfnSy85XlA6Hkz4bIZLnC0qWaqWWDs1echaLl7PrYrKqANqugp7XfAshNtGfMmlqAraBji5FuXO7yI/b7jRZGvkwA7aGKOUmIpIFMaA0MpFnvtBD1HTg4Bf/dpw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) by SI2PR06MB4138.apcprd06.prod.outlook.com (2603:1096:4:ea::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.17; Wed, 8 Mar 2023 14:06:36 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::daf6:5ebb:a93f:1869]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::daf6:5ebb:a93f:1869%9]) with mapi id 15.20.6156.028; Wed, 8 Mar 2023 14:06:36 +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 v2] f2fs: convert to MAX_SBI_FLAG instead of 32 in stat_show() Date: Wed, 8 Mar 2023 22:06:23 +0800 Message-Id: <20230308140623.35942-1-frank.li@vivo.com> X-Mailer: git-send-email 2.35.1 X-ClientProxiedBy: SI1PR02CA0024.apcprd02.prod.outlook.com (2603:1096:4:1f4::12) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|SI2PR06MB4138:EE_ X-MS-Office365-Filtering-Correlation-Id: b97905e0-4d9a-4a0f-e881-08db1fde542e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gq5si4ao64kmI8O+8gcgqJsqhP+aGv4Xt+MZCXxqOOlntlTXJ+OLPltAmjm+Qya4kZL/a7t9frcs+WYRF1Iv5F0H3kYAYjapfltxhac8CHgJEw+rabUYNjVw1ulAWQ96UHzY3FkyVBRuJa6JIMVPNjh+Tzq/C7E+kkSWbQ/C96VTku9NiI9xW+zL0ZtO2iI/2IVFLU8rUsq2BukY/qzfQgsrReMUglIRtwkHsuwp6KyIzavtoxwoZYRpnvQnnA/hyiaAr60JUQypj3SHc9EjEqBSnf1Yw19AsEN/t6fwbDr/YL5MAZw4XsRJO8x2xtcmAHwoCL19Hny3zq6yAJrCW5wwTogR+IGfh4yyStCIjpofsbrXMX+1FgodcwBHYe99NIAMsizWsfB3krfYVj7UgdZ/AHSDxWYesqorgoEGK8xk84eVnwnS2GQROnItQk3/QgJVDVjyqf1MEyrLs2gUjgb00a0XL1C6fgGxKLEev1Hchy3bXFnTTs1dFH7IH9zdNIdZWOXC2C9H9uAviMrsAVcpRigpuOUhvI+x8ERKCO9o8hIRx10y26xP+NmVEPEjkFfEBdU/odXq8OtexwgkBmBxw+x0b8NFtsw7EtrOwihYlxpNzUw/RnKK9ZwzfBWsRg+KZXIrJEtKsV7Lx5iqIhF5LxwE4B8rCRuxiSVdnCJIEEYTEp0kGUDNC6IcGIaHh+NhicMRqbwQRn3klaVFCg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SEZPR06MB5269.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(39860400002)(366004)(396003)(136003)(376002)(346002)(451199018)(478600001)(5660300002)(186003)(1076003)(107886003)(6512007)(83380400001)(6666004)(6506007)(2616005)(26005)(86362001)(2906002)(36756003)(6486002)(38100700002)(52116002)(316002)(38350700002)(41300700001)(66946007)(66476007)(66556008)(8676002)(4326008)(8936002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: pVsuDP3dbByLpOkksbTQNGiuWmzc4uO6ZUKs8+JYWbvuNlSv+qiLvKV7mSclj8KlEhAS91ZOJMtozIUoNhxa6k5WwaeiZ0q4jN0hBZgWUyqzKLJM+Ln5EThJ561JK1bDVQeYqsbAD0xVSaO7AwcUnmdT6je//dAl2x3xSyabUkIhAHScqgYav6yXdhETseMnZvhTM/2dEXpqKlifBD8E+UfkR0NnDQRyjed2Wnv2TJVnMLQoVQVK7dUsqaC4uJssqvzMBfnTrRlRQeM8lSsquoJWDikAEWTTYqp2CHo5YmBeEfgc4lF7wFyg+gmGV7Zin3o5JFYXNyuVbDfY3oahF1P+askMyldm0uw5JG/m0mAGQdCeNodLs+kA4F2l+g6tckpaqoahwTfkVtvGrU3cobdKeJDT3dCIzrrYPlEjyJ3uk5NzxA36Id4f+2XR9NA2v5xeu0pKZWrnRQw9Si1D0VQUzgEvQNZWQdj9xM9mqmVOfipNVcxh3+lMpcC5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JOEivT7UqGf/7ljiotSDPI10bo0ZTR X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: b97905e0-4d9a-4a0f-e881-08db1fde542e X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Mar 2023 14:06:36.0348 (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: AFAwxJx530YHdpJXLiInqIYl0jSzRvarWlBXjG0DZCFR1DHT0dlS3SmA35KQXFTWxCyZmxhnxZ/iim/AbhWpHA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SI2PR06MB4138 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,URIBL_BLOCKED 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?1759810814105770046?= X-GMAIL-MSGID: =?utf-8?q?1759810814105770046?= BIW reduce the s_flag array size and make s_flag constant. Signed-off-by: Yangtao Li Reviewed-by: Chao Yu --- v2: -make s_flag constant 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..99c7fc832ec7 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 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 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 199b1ca6b9e4..407cb35ac06f 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 {