Message ID | 20230121051204.81251-3-frank.li@vivo.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp587363wrn; Fri, 20 Jan 2023 21:50:51 -0800 (PST) X-Google-Smtp-Source: AMrXdXt0Rkf6CfYYF39rDuSDQZfhkKgyc7qfK0ylKDoMY90x95F0FTC6wik8dlpAgj1sG27+SFxs X-Received: by 2002:a17:902:bd8d:b0:192:8cd1:5e79 with SMTP id q13-20020a170902bd8d00b001928cd15e79mr41443252pls.41.1674280250759; Fri, 20 Jan 2023 21:50:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674280250; cv=pass; d=google.com; s=arc-20160816; b=v15nB2zmDYl0oRx+83kHxtUvrV8IEAIyoh7Awom33iLfpyfOCfEz+Fk9czsQsQ2Af3 coBkiJP5EyausKwMJg6ugRcze34FOX4e1Uoxu8aAkbymyt5hyw8PUBTzcb7SA+9JEXg8 nCH9U7kmmjr0zaiq23QBQ9MpygJIluZj1ik+FYQnIS9tHTjiqz6yrsoe0iTvTdpCfKAM jLl/40jf0eAVG7Px54aKOEg11N6PS57qXzoPFoq2Grjk1M5g9ZFiWbtrAW4kcAhve3vI 7PJTw6dBgARu63PHfkny2JzUPDJ8PGDOv+MG6hf+YuvlKBV9/LwdD1rvmDNzzsoQ6Kmh qFNg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=20mJGHcAaflykKc9Cso8rSKoQFvflxJOxP/wZgB0Hr0=; b=osxFNLxoGsY23IkxWmQzSPb1Wwccs7mP2m9Zx5+cX/XcJ69PFdngnF+Bho12hAQ+56 mnNTGBOCUsAJwlNzS5eE2jp/yYE728Lc2xmXrmG32+iLF1yPMnAWJ+uanebiFEVoayRj taf+c5cVnDLDCZftfws9UoLYgZ6kmCb5qTtUqYR1/znRpS6mnsCZzG+amWO8KojQEgBm NR1m6yE6+P9aEJvwycXUGWdmTWkS+WRR4BXCoiBY1pguejZEQA+vg7WrdxVXUeDicI63 O9F0tONYdDc+upTbojv4qaksBfNkUrH0s8CethhTEUXXzVelN3teeKlRWDRjU/3avsQb z/+w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=CBwV7XVb; 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 iz17-20020a170902ef9100b0018049a28eabsi29750512plb.617.2023.01.20.21.50.38; Fri, 20 Jan 2023 21:50:50 -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=CBwV7XVb; 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 S229746AbjAUFMf (ORCPT <rfc822;forouhar.linux@gmail.com> + 99 others); Sat, 21 Jan 2023 00:12:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229715AbjAUFMa (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 21 Jan 2023 00:12:30 -0500 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2134.outbound.protection.outlook.com [40.107.117.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D9E873152 for <linux-kernel@vger.kernel.org>; Fri, 20 Jan 2023 21:12:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dOe/QxjMi3U54+yhGU2aLGRCz7Ousk10gxwbwRL0PVaCmHGhsXBOYKmhDOb6XSgem/nmLijnBmhhMjiwGxDLV7oOJGbwZJpGFzOdDqZtIfyrzAIicv5vd9DtPZlrur3FfrzBRQg8XnzIw4uhxorExq33/rNjKMhgPiIKoHyivWzSTIDyz6mv4kOHi/GbLIZWBKNcpRn156fkC6Ids9Fxwt5E9yag0lpIFjD2fO+gt7AVmOw8nnAgclvIVT4p3Gax+j88lYKoOMFl1mJKohnsXTEFz+lPNKGKXLw20FgpzQ/xiCwp5pDaHjYeNn0gQ/0nK3yN7NsIubqqYbqen3zUIQ== 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=20mJGHcAaflykKc9Cso8rSKoQFvflxJOxP/wZgB0Hr0=; b=BZF1fyKwRH1jHmcyecTUJseAnIJ+VEMazWcvOKvLZamVOXhBgVhgLBpyU/4bLNq4KftkktY3Eg+w4K/baIXw73eWV4I9gzzk1nXcSY758QXbl23Gx5fAxw4FJ50GzfuZO12GEVrP7NQmMkm+HUfDB8DcjIO7wr5bAoXtVhADKsP5luTVOjv8AbvbYOmztXuoFU3nbyk8aPpD7VWQIFfFrvEsAO5AKEkxrYIHC4bCfCUJA6TI9qioDSLdyhIcjReOIIakGrnp1CxnBT4eZp49o5TbTc6NVZsTHxuU0Rzrb4a5nKKDx9i4QtUVdgSV2bwZIJ3OoA34thmi9J1q13pmWw== 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=20mJGHcAaflykKc9Cso8rSKoQFvflxJOxP/wZgB0Hr0=; b=CBwV7XVb3KMzNdnJH+qwOyqFZk3/Gt1txo/z6QlEGu1QYVy19NlssP3v9FW82a3saQJOtojrXsEMrUSk4R8MkZCwwq+pZOmVg0RJ1fxsLUjtQ0lehTrMIYAYzko6y+ddHQy2Kf2tORB7a5yudcALUG2VUZkVlNLUarh6dPefbKmqCvzvlWDkDFV7AyGiQRqfB0JDA0sXvgeN0ghLBO4tzZX+ugh8VLxMr1zBWvSBo8hSYSlSu/5am8Ue0+9b5wrY2Iv/kM42wGTAiSFF+5NMm/+3TXJx5iJI/lHjgzf71jFgVl4c9ZwKExAvuq6jx0GbXMOKr03wbosS4e4h9q3Tgw== 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 TYZPR06MB3885.apcprd06.prod.outlook.com (2603:1096:400:6::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.9; Sat, 21 Jan 2023 05:12:22 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::3e52:d08c:ecf4:d572]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::3e52:d08c:ecf4:d572%5]) with mapi id 15.20.6002.012; Sat, 21 Jan 2023 05:12:22 +0000 From: Yangtao Li <frank.li@vivo.com> To: jaegeuk@kernel.org, chao@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Yangtao Li <frank.li@vivo.com> Subject: [PATCH v2 3/5] f2fs: add sanity check for ipu_policy Date: Sat, 21 Jan 2023 13:12:02 +0800 Message-Id: <20230121051204.81251-3-frank.li@vivo.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230121051204.81251-1-frank.li@vivo.com> References: <20230121051204.81251-1-frank.li@vivo.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SI2PR01CA0008.apcprd01.prod.exchangelabs.com (2603:1096:4:191::10) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|TYZPR06MB3885:EE_ X-MS-Office365-Filtering-Correlation-Id: 1f8ef59a-3920-46b8-e4f9-08dafb6e1409 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gYp96CzRx0yV6mMnxyeJLIFL4vComMyRF/DGpfuEQqzosLu05SXthFIoIv4wv6jHh49CbY0OR0usonSAkkm0QS5ixx6SGe0sn/NqpuifysykGpb5lgiy7wqmoR0GF+OsuAusKBevGxQSrEzpg/Cs7TTdfv2X2kkEtomN7GIQW97QhpGNcMOoFcgebdt01Jdn+28Js25bu8xiTyBfA11fvrMoScngETNPTkUkIrw6wM89B+NblL9Dy0tnLb3msW1UXnjhx0rJUqjGT19KOmtke1meT5Gsw7gjf7n4RF7RtKncR9khEj82WQ8x7JDfa5E4dE2oxiupD/JCrtxntk6zr8llApGCpXKF27S3JNB5ZXcb2g2NpYrOF5d5P+zAnRNtojw7ZaCK6nq1Y9yPgAWPCfAXno1md1lIkGvtVjbK1zo2CjMRgAuP59qpeEmbGdDTsmrpXCPSyUXroQxnkSbnYM4Q1a4swjT7yRi/0zeG7qmML3o4yXplb9rYSDsOqgMW5nvTY7fkOh/L4LHB9umssjMnYrDVRRTO7Oy+O3H6m1Wp8bj82Gg+Q1ehpxr9HApN1rGzEWsBr11+yMamk+ghi1Jiac/P0k/RJiIqt7vT4BQracDv4RVLx+izJ64Uh0/PGaMvqp79I9qQw4VgUTZl9X6txBFLwx0xhPXKoALZK7P7nsdvVus8gcrRwYPt+l1y 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:(13230022)(4636009)(396003)(39850400004)(136003)(346002)(376002)(366004)(451199015)(38350700002)(38100700002)(86362001)(6666004)(5660300002)(8936002)(2906002)(66556008)(66476007)(8676002)(4326008)(66946007)(41300700001)(1076003)(2616005)(6506007)(6512007)(186003)(26005)(83380400001)(316002)(107886003)(52116002)(478600001)(6486002)(36756003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2S2yCjDdkwfGEmmBWeDvhyDpCRVW3+oP5wIQkAj0HAudrHoL4BYxFVNt2KaxSjPgNK4r2slZdA2f/IPnmLfxeBT/tk5e/pgXXN6Nu7twu+MBRVk9HPd29Cby6dYaB17zZ1ONBse7m7KWkURlO6aYHGk3cl1YWvWy8DAQwed/xwXwAKpNwtMUfhbyUHQhi3HsGdbjkVmQE6nIseaR/VXNDM33cqlgwk2qq9310GlFdzg7JLEdYiLLr3E3EDrTI3jq90p9lpkF5wX9ZT6eUPKzyHwIpq0MuWw7Vi6+HJn9wFg2/QwRQXR/5NMIa2X5Rhskow6uN0HXzVM/r0bS3NRWkGQffn8mDRwioEmYb0z7HQCchxDI2CmlcyFYKnQZcncwX/25RiXZ2x5o6TeFqwXVb5MkLh5X2r99eHtMn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j4nOI8mA7X2IYdpbi5eWJ4BvkKojam/tMvPNQnEy3SI/NdsGRRFx+1l7oj1BF8yaFqWNlxDwGqeSvvybUhZ/jmbxIyQAW X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1f8ef59a-3920-46b8-e4f9-08dafb6e1409 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jan 2023 05:12:22.8450 (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: 8Zu9hAQoNwwOdznphn82wsURi/PE6Sbnh1iHj/Zx0SxgSzLiCxE2fbMkhkl5qyWRc3hzM7q/RL4HyB0u8QVzRA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB3885 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755610088037663501?= X-GMAIL-MSGID: =?utf-8?q?1755610088037663501?= |
Series |
[v2,1/5] f2fs: fix unnecessary newlines in super.c
|
|
Commit Message
李扬韬
Jan. 21, 2023, 5:12 a.m. UTC
Disallow the value set beyond the range, and disallow to change
the value in lfs mode.
BTW, convert open code to use BIT().
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
fs/f2fs/segment.h | 1 +
fs/f2fs/sysfs.c | 11 ++++++++++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h index 704d27ad682d..2cbc24f64a5f 100644 --- a/fs/f2fs/segment.h +++ b/fs/f2fs/segment.h @@ -681,6 +681,7 @@ enum { F2FS_IPU_ASYNC, F2FS_IPU_NOCACHE, F2FS_IPU_HONOR_OPU_WRITE, + F2FS_IPU_MAX, }; #define F2FS_IPU_POLICY(name) \ diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c index bdc761f36310..576e6416ffb9 100644 --- a/fs/f2fs/sysfs.c +++ b/fs/f2fs/sysfs.c @@ -452,7 +452,7 @@ static ssize_t __sbi_store(struct f2fs_attr *a, if (ret < 0) return ret; #ifdef CONFIG_F2FS_FAULT_INJECTION - if (a->struct_type == FAULT_INFO_TYPE && t >= (1 << FAULT_MAX)) + if (a->struct_type == FAULT_INFO_TYPE && t >= BIT(FAULT_MAX)) return -EINVAL; if (a->struct_type == FAULT_INFO_RATE && t >= UINT_MAX) return -EINVAL; @@ -706,6 +706,15 @@ static ssize_t __sbi_store(struct f2fs_attr *a, return count; } + if (!strcmp(a->attr.name, "ipu_policy")) { + if (F2FS_OPTION(sbi).fs_mode == FS_MODE_LFS) + return -EINVAL; + if (t >= BIT(F2FS_IPU_MAX)) + return -EINVAL; + SM_I(sbi)->ipu_policy = (unsigned int)t; + return count; + } + *ui = (unsigned int)t; return count;