From patchwork Tue Jan 24 15:33:43 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: 47745 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2224023wrn; Tue, 24 Jan 2023 07:46:14 -0800 (PST) X-Google-Smtp-Source: AMrXdXvwXvbY14X2gKFHaGodeJBV5kINyzlL9thKXLTnaHngY8nxagDmIy3JvlFz7ZUYghzvDW0l X-Received: by 2002:a17:90a:e617:b0:229:5027:c2d9 with SMTP id j23-20020a17090ae61700b002295027c2d9mr31977846pjy.34.1674575174396; Tue, 24 Jan 2023 07:46:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674575174; cv=pass; d=google.com; s=arc-20160816; b=kRWDZX39ndQhSKCmIQqKcLuNzFillM4rlm3qipM5ZVhlyjRIyqpEKRzQf94Q7xHjer BtxvqA7zncW+wwQN/gAEZVJA8SVPVfwcOizYOeLhbCwIywdQaEQMWtqkca5C2tvFZpmn xN3t5LwORlHGOzs7YLAZcnxBb6/TromvjB2AdxM3mnMvz7EP6rhH4RjxGP/z2foTGTDX efV4lHGVi5Xtt34sR7xFvaZYmEqcORVKx1OsN4hT3keo2zkwQeKndojxlo6jV0K1u70R 9eEP0E3zuD1QrMNNXBn80E1tkr1coVZSvBXUPaHLI533JchCPVm419IoATBu+8GhrATi FChA== 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=wXC+m9eUG+mzMFbxwJuWWalt4+y0c5FzY63l4SuGz8A=; b=tL+87s42OwN3C77rW4aSKpCFUvgWCDtEn4JRUbuJp6TPYvisAMAhL3DLXTkrL1oz1L 3DgyO/48oogzA5ooO13M65uWe7BL2oEzr+6AJugJJsnZBV7S8epUGFY2u5swRTVX30R6 UN76QKqHBLfXQrIaoX2kd3dySsnhyM4q7qQmrjklJR0twM9RfWSXS5yqU7TM17twqU34 x+eMf6JSJeAwnyPglM3wPrZN1BXe15FJinDur+LqqmvKFF8e5SEckQDQHBc6HaLRVNn1 qBBuJ18kb8cQKHaQciDEwiLxmpFo6BqalbaQhkYelCXbHT+gpETv/Hp5ogTDgHuQLMzr Toag== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=gfC81AMw; 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 x7-20020a17090a8a8700b0020af2411705si2724474pjn.104.2023.01.24.07.46.00; Tue, 24 Jan 2023 07:46:14 -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=gfC81AMw; 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 S235208AbjAXPeD (ORCPT + 99 others); Tue, 24 Jan 2023 10:34:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235177AbjAXPeC (ORCPT ); Tue, 24 Jan 2023 10:34:02 -0500 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2123.outbound.protection.outlook.com [40.107.215.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B32641287F for ; Tue, 24 Jan 2023 07:34:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i0TKAfMY6PqbvlhCn9LFFLEAs5BbEQY+0p9JaZfO86FL3n0rjU8vGe3UU9TetzLyT4cTc/a0tbfRJoaPk+R4RdrDPwmuyrlPEKQ7JelCUlWtllBvxWFZ1UIaT1ft5Jy4S+nNeScZDX32hsngTvj+NsWatstefBh+dSscsUeHn5wTMk2v4KOypBC3Sj6/q/iEUwwrvK2rkO6+LhnGtbAM+ST/wXw0IZNLoduGbwMbS6CsP/8JGv7IHtmoHVmESnywGy4yuM44d4fJC5a+5mRYOy989GmIAciF2IZtwwWlOxiGEzZ2RuGf2l4rSjMfXgH2mu+JtxeN840yOvrTfJ1GJA== 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=wXC+m9eUG+mzMFbxwJuWWalt4+y0c5FzY63l4SuGz8A=; b=m8SA6Bc9B0p6Y8b1BHcoXYPD7LdCzZDRIh1ic8xGAzn6xTg7ETbOG8pthKoHuu1adipfLIyt77nONQkpV/FpD2/Hwq5qW5C4vMpvxLd04RVNPwrjSa9uLmccarCteBsD2/roE/vrRJI1OZwityIySOjQ2NIgMn+zqAzYToRGHZ1kfqlynR/gBgcT5yLnKvVVg7BE/BPi/PiR+dGTcxbeFJWtHBYo0FzIoc/emBMlr8Bfq9iooQh0uhmJNKdbylpr9EkVmSVyrt/23h4DKm5723OgqGHpJP2/I1aOkqfnJNN4ZuSh1Oe205NT/H/r0o252fkhx+1bRDyvnIeJLkT5qw== 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=wXC+m9eUG+mzMFbxwJuWWalt4+y0c5FzY63l4SuGz8A=; b=gfC81AMw9a7dPtCBj28UXcwJxX8p6JiNWmhpyWXaXsBg32t1X0YDdLo0/hd5u/2oCL8P1Swnh3zBMq3XQlgne6HzSXTwrrNjTfWgj/rdI1qqzWjtjHtjhgomN4uB1KF6WEViAgbhCTDJE7k/vY1bvLP4efSaJmJZjAgIoLR4mQnczbrdqXQEmcxrSOQWRd5SESL4SPFGRYUCDyylP7SvMt/yMTMp0ub+5Dr9dKy6rG0QmKCPfH+HAZv9zzKRRymWQfc8ffamq4rYh+fUUB6u/jA/irRtAi2D7wP31XkRfcuLg0hmSKjv8AgWGpL4WkUL+cRvftODCvj8cq3M4MhQrQ== 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 SI2PR06MB5019.apcprd06.prod.outlook.com (2603:1096:4:1a3::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.9; Tue, 24 Jan 2023 15:33:57 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::3e52:d08c:ecf4:d572]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::3e52:d08c:ecf4:d572%4]) with mapi id 15.20.6043.016; Tue, 24 Jan 2023 15:33:57 +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 1/4] f2fs: fix to check lz4hc compression when CONFIG_F2FS_FS_LZ4HC is not enabled Date: Tue, 24 Jan 2023 23:33:43 +0800 Message-Id: <20230124153346.74881-1-frank.li@vivo.com> X-Mailer: git-send-email 2.35.1 X-ClientProxiedBy: SGXP274CA0004.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b8::16) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|SI2PR06MB5019:EE_ X-MS-Office365-Filtering-Correlation-Id: b6084881-f20c-4562-0f25-08dafe20683f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ehd8+5R0/wXTMxYqS8eTIG/duol3nK5o+tAJ7LtB20UXqxmQNIg+DcvC10WO/5giKHaMpOqvK+2/2gYOEB0fh5Vsp8VEm5ILb1NycmpGm4FbXhMBffzZpsODY4R0Ig8Er0FJMrJTm52gWmMz+LDO1eZyMpMolesREkLibgQ730OUzo0A7QUTTqKuUhxxyWLa5BJykeAYSepnAOB+rYyRfL4gkvFm6HfwQBWECHTs0ur1Xxdh2lQSsRF/p1ixI0WqjPxYmINof+iJTqqzXuSQBS4+KSQuLnvpdbb9Opn4/BSA0IIA2RKTP4sfaUYhUQlYwKjzfUIsJsMYEIE3Ydv8uwzI7NYIppJR3QuqQ0fdmLOMRv1InshW7aJGp/IYxXAtpyFPYxHZgonaXO/9BcZPLEqcFTjDvUa2Q4gQ8pFgMFVOb9toq24oNtRMMmKGmuAD999Y2uYhBq+cZbpXWZemdBQ2ljLkVrj8339JQjFW3qFYstfyRFVgj94zGuQsVB51wr9t2xcuvX2BAR91B8zsRKJsCQkhg288GJGlDXC8SucU2TbpkrTrLTZHGoETkIYHvuqfF8SbQbkwqXI3RNmxL/71Gg6Mf8lNqSksZfuPooVHXnEhjv56LPlxIHef3LKWJHXK6f7AZom3+i7SrhcFNU5ojOS59V45c7aSPZn/1CTtqpDrnAnPwGLW/gcTMOYh/KRcTPLyRuTuK885aeut06BYtliii+Fo8rjjJu6Z1xE+txuOpfuUpbOiy3VTTv2E 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)(376002)(346002)(366004)(136003)(39860400002)(396003)(451199015)(2616005)(2906002)(6512007)(26005)(86362001)(186003)(38350700002)(38100700002)(36756003)(8936002)(52116002)(316002)(5660300002)(83380400001)(41300700001)(6666004)(107886003)(478600001)(6506007)(6486002)(4326008)(8676002)(66476007)(1076003)(66556008)(66946007)(42413004)(32563001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Ai6EbR4W5iV+luRASWxrMOrzZJqLpY6ZKHtnqutJFN+eW1e3nRaymfrnXYCVh0PvnE+klPVmUsXrzI+4EIlrU8D/LnAJOUzBfRJgz1Pb+sLYuigPYqimWqrO3blED057S9hLaNnVKxRXaWveDjUiQLKbGwaV+UwU8NqpOMXt1VJZ7E7MOelrAuM35L9O22Yuve0yIxEVAkf31ROQhqL/Ssm79chELdNrCeqTsjXqBrctMQHRHycFaELD74Ef9s/MS9TsldHVWMylw9tUdKXEIs5Z7t2EZ86S+GBJg0OFyb1/23mIkHaUN0KoGZVkqJPqszv259ne0euTQuKeU/p5jUpipE6nvWqspB7NwxD+8ik7ta8XN9gaUrU9W4enVJ8zTR8+KMZGsqFfC7g636x4A+/1snyKLtWQe4IQWQbOLK5Whrld6x+kjd9LBKhHngILsnrE6yK4GQExMp5OQvXq+JSWR61UTLL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aur0g6C7BSdmIf3oWgOPJv/dpgoDQ65AnW3uu45iV2JC74ayIOcm X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: b6084881-f20c-4562-0f25-08dafe20683f X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jan 2023 15:33:56.9905 (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: Nd7t5/xm9sKV26iNJSRydXkP2u8ct9mbskUA6JyQmTCUNAMRmq3fkg3Ketxm77zrffT1aVVex7V/pOakxlMVnw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SI2PR06MB5019 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?1755919338246291950?= X-GMAIL-MSGID: =?utf-8?q?1755919338246291950?= f2fs supports lz4 compression algorithm and lz4hc compression algorithm, which the level parameter needs to be passed in. When CONFIG_F2FS_FS_LZ4HC is not enabled, even if there is no problem with the level parameter, add the level parameter to the lz4 algorithm will cause the mount to fail. Let's change it to be the same as other compression algorithms. When the kernel does not enable the algorithm, ignore this parameter and print msg. Fixes: 3fde13f817e2 ("f2fs: compress: support compress level") Signed-off-by: Yangtao Li --- fs/f2fs/super.c | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index d8a65645ee48..ad5df4d5c39a 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -588,19 +588,11 @@ static int f2fs_test_compress_extension(struct f2fs_sb_info *sbi) return 0; } -#ifdef CONFIG_F2FS_FS_LZ4 +#ifdef CONFIG_F2FS_FS_LZ4HC static int f2fs_set_lz4hc_level(struct f2fs_sb_info *sbi, const char *str) { -#ifdef CONFIG_F2FS_FS_LZ4HC unsigned int level; -#endif - if (strlen(str) == 3) { - F2FS_OPTION(sbi).compress_level = 0; - return 0; - } - -#ifdef CONFIG_F2FS_FS_LZ4HC str += 3; if (str[0] != ':') { @@ -617,10 +609,6 @@ static int f2fs_set_lz4hc_level(struct f2fs_sb_info *sbi, const char *str) F2FS_OPTION(sbi).compress_level = level; return 0; -#else - f2fs_info(sbi, "kernel doesn't support lz4hc compression"); - return -EINVAL; -#endif } #endif @@ -1085,10 +1073,19 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount) #endif } else if (!strncmp(name, "lz4", 3)) { #ifdef CONFIG_F2FS_FS_LZ4 - ret = f2fs_set_lz4hc_level(sbi, name); - if (ret) { - kfree(name); - return -EINVAL; + if (strlen(name) == 3) { + F2FS_OPTION(sbi).compress_level = 0; + } else { +#ifdef CONFIG_F2FS_FS_LZ4HC + ret = f2fs_set_lz4hc_level(sbi, name); + if (ret) { + kfree(name); + return -EINVAL; + } +#else + f2fs_info(sbi, "kernel doesn't support lz4hc compression"); + break; +#endif } F2FS_OPTION(sbi).compress_algorithm = COMPRESS_LZ4;