From patchwork Thu Jan 12 13:34: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: 42430 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp3883562wrt; Thu, 12 Jan 2023 05:37:53 -0800 (PST) X-Google-Smtp-Source: AMrXdXvFyW0LcUim77nxZnMLGgTlj29Kc9VYW5odtLnOngMQItDvakIMrJbkL/a2S1DrpmbEwwgx X-Received: by 2002:a17:906:9c96:b0:7c1:1c5:c7cd with SMTP id fj22-20020a1709069c9600b007c101c5c7cdmr70523967ejc.5.1673530673674; Thu, 12 Jan 2023 05:37:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673530673; cv=pass; d=google.com; s=arc-20160816; b=NbWI9aecHDR8ElpWl+rQcJHKppJtwIJIWf6jT7L+wBwsUMxvFAg/UimNdi6+qO8ihw U+AFqreUAMg7XQ+K+FDXXP+rp35yxua0bXr26yH28MoAQFWzktkiuMAwfZMh+zxD+smi zpEVjDc8pZtW+TI/0PIyhUaVmZ8tIDm1OXaGxpvc98mLGsC7dZKZxadiYt20oeyhO40T P4MbqIq21bYGr38004QuxvW6id+qIO4AsvvSJyKxl/2IfdzIpGhlE4GekQ/jbeMqaU9U +1kqXPFDDJb/qVmi9WLrTzHNy4+IAvUZFF34/SORj1cEjG/jF5iwWdtnJ/H/N5jgmicd rZoA== 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=3N4McwBBwJ0Ldq/+E3XFv5A9Voxj2W4Wxj5SJvVUCxw=; b=DSGjgTs23rW5vqQTkRX/ewLmAFnrDAIKfW0X1xEtxrJa6uZ1yzJoTp+b+V+XpCsLXH 8P06VwxZKACj417a3b+2gccexCx1D2ecw3a6b6/NGOjzr4Uf0ihZLiFWMuqS6cUo9Ln8 zYVcgH5PJ6XxegG8Fqb64Uc+pWXMIBZw/yfDpQT9QdSetdiiD4qp3TiiJAmX9rdfug3H cVU35VAnhgIFoGR6FdKl2jcxZgvAVM4Z8/QzfQG3QQdSOtYmzpXvG//V/45qC3EYrQRt KESAXtEmGrLcYpWlpDIpR/XCzxxFPecswwO2LrQ4q/14IdMi55OhDK7mxQR2TRyisyFg Xewg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=lYycNaoo; 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 jg29-20020a170907971d00b007c0d428795dsi19903626ejc.191.2023.01.12.05.37.30; Thu, 12 Jan 2023 05:37:53 -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=lYycNaoo; 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 S231732AbjALNfH (ORCPT + 99 others); Thu, 12 Jan 2023 08:35:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231621AbjALNfD (ORCPT ); Thu, 12 Jan 2023 08:35:03 -0500 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2115.outbound.protection.outlook.com [40.107.117.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91678140D2 for ; Thu, 12 Jan 2023 05:35:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KvN1nBL+dp4hTSC5Vnvv/ZRDGBs6TtWZYS5jWo2P2Qod4IqXXmgxNeYY7UAhA7ZA02Sp1tcECglEVyivFDIxzRJv8ACSrAdUYlrbToEOjr/JPV1lDrj3ewWn6o66hZtb1/d5195i0C6nK/FqfTaqsL0KVOPemWgfMrNQVoDdnwum5K1p1VAPczyZw/VQz68RmAlDmTbruu2iiIgAnH7MLzys9nX9Bhq4N6bqRHWG8Nfpgfl04Zmc0tiV3ftNG88OhfAMYOST472HDfClUobO82tUdO2eivpundgMfY6ZtZzvHA6AP8JY2l82Ks0wQoF6BMnr5y+kzeGsv2Wt6rFdUw== 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=3N4McwBBwJ0Ldq/+E3XFv5A9Voxj2W4Wxj5SJvVUCxw=; b=ZULkDeR5qOJHTlC6d9hdW/zs1lABqVZ3yLillmerl/zr0lRmeUfcRLQ/CR0ERTv7kt3h3DcJmrxNuQ8Iz2AIOXPkqz5FRngVbS+hUGrBdeoFTs6eqmSkPEjEfduE4b4rf+Q5+W4sYg32zU+s5NrYLXoHKm2pnumHKYjiIIe5PR/kmlBlM55Vx8mY1Y7hbiPeBzbF3PrDn7Ys1qcvYAhc3ZxVpo9H76L9peiPB0fpsun/c1KJqxRfwv0evZHeR4gOm7XzvCBFCZYLFS5VDlxhu7huBfgHegCl07t6zBmkOeWHAXk1qSQT52N8zyv6eiHAPmqcSSqOelwzw4+1Jc8L0g== 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=3N4McwBBwJ0Ldq/+E3XFv5A9Voxj2W4Wxj5SJvVUCxw=; b=lYycNaoo460Z1eixrgdlHrlkyZqMsuTyNngOkc7q00ilAUrRgryERMJpz0qTMYRuH4bN3Hxh0SlMraDRu5DV4ElTsvbSF9mX2tJxIvKAbCiKTYIPeyw9w00ScR3XfZqL3oSo0blWDJEJm57bpOBL4giuyBrP/vka7cIdt3GCl49ooEGYBxmDi9Vn+O/rdEAqbS6Psz3NebSXrI8Samx9PL6g1fbJ0EtKjEvKGFKQ/byxCuZJJQ14Q717BTRYui7AReJ128aSSzkXNngGn73aBuVwSJsh3iAbXsbsCKnpSsqmZ4iV+Oji6OwYzcH94wqZeJpOIFgbMFmVmFSGSp4POg== 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 SEZPR06MB5072.apcprd06.prod.outlook.com (2603:1096:101:38::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 12 Jan 2023 13:34: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%5]) with mapi id 15.20.6002.012; Thu, 12 Jan 2023 13:34: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/3] f2fs: clarify compress level bit offset Date: Thu, 12 Jan 2023 21:34:43 +0800 Message-Id: <20230112133443.16713-1-frank.li@vivo.com> X-Mailer: git-send-email 2.35.1 X-ClientProxiedBy: SI1PR02CA0027.apcprd02.prod.outlook.com (2603:1096:4:1f4::18) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|SEZPR06MB5072:EE_ X-MS-Office365-Filtering-Correlation-Id: 6bb7626b-d84e-4f6c-50e1-08daf4a1cbba X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ck69Y/AaFtOjv3GRmblzQpZZmQpKlmn1ofr947F+WDyfnQYUmQ0DOeavRZAc2AOMtVin5BZmLsGKvYQhV1JRJHoRQNBLHKFs9hyBvdNw5YOhGXYFnj0SkF1rvxR1aeoo+X9V3eeDrQgYkhX6Djm4PZw2kzmghECDrND6z8K7gm2g9lGL4dHTgpsx6JJayF827Ei0YqivXxOnrK+Xm7kSlEzdqf0pAvTJuuPjUd4FtqSg50pxj7/apZOZQJNxOzg/YFnmV2D6DCbtKjB78x1rhevumAviuJhEqPx2qGuJakbNIF2In7NMuwNr5iYX8K+1izjodNZE2yW5Vy7kUHtewkAikLmEt1v6hbvHxzufAzDrDf/3CF0B0vFZzL7gKPo08IJQpYAO8JTfEALa4GuXFuymONFp04aIZ9fHmgp8gxsExq/OGXIg9RV3pN6UQz7To4jvnTBDNrq5KrZxdZG8FO5qhHC6gl+WfeHgUFfwwlDl/htVh6ejmYq271QYKYBAbinZdBDbQ6greNlQZ9kWPHzPBWBHCrrk56SBga9PtuiKTUksZlKHudMIh1MEv6Bi+ZKCqGc/nTRqFdEFzInw1WNKpHpCn+j7yd+p0K4hrVhwQytPnDIdEes/qp01U3dZo833izAj3ySABXujNaNj3PendxV9VUCU8TnApXlz/v6VPLSXXNZlxWFL0W27cH3p+nV7jannCagdshpn+J00CA== 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)(136003)(366004)(376002)(346002)(39860400002)(451199015)(107886003)(6666004)(478600001)(6506007)(6486002)(86362001)(2616005)(38100700002)(6512007)(186003)(52116002)(38350700002)(36756003)(83380400001)(26005)(1076003)(66946007)(8676002)(8936002)(66476007)(4326008)(66556008)(5660300002)(316002)(41300700001)(4744005)(2906002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4gS8VeUaxomS43b7xGK7DKBgm1WYmumFXdaZQ/ynaZ7KpON8ZiVGDMywo53bE45Cg1aJXrq7vyNWz2yNhI+PyB/8MpfSo3fY1rmJSphdt2cTXqWCme24hQTtFNzElBnK03svavEw5j5E9onqt9XYYsomOvSyGNcvFZ16UhjPLxFcngtNqVeZ3og5otQgKiOnPWvetiHRHguZRaSGbU4eEpEZR8HuBM6+KBE1NZE+CNZrTrhNRgePBcE98GPkpgb2199lNBJ78k7B8PeKBs0JEXBAwrOQMY5BEKDhRQnFbfDP0Q0IxFUBa5iEYmFwXykS0voBzjA1ygKMzgd6u3I/0NmFK1fNsqstpkJSIffmBVnJJU/fVr4IKh1NdJvy/Urolw9HQ0smuJNHyGlDagxlGC70+AKjBPmjbvFuQAuUwUAinmFiDyIMSV3WyrTqmwXdigB7EASNwTrAmhqsfSKG3z+1gBErjxH+x24aYgd/lqYkop06sJUzyOV4waaAOh6nkJSvQdY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3Ldl6B1W4oIcHurN X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6bb7626b-d84e-4f6c-50e1-08daf4a1cbba X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2023 13:34:57.3587 (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: zPsJbmsM8YOnS46uJ8CYs58XJnectd30NnljRCUWcuSodbgI5nmmxZAD/slvVec6lFzUOe/lap98/go96r/x5g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEZPR06MB5072 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?1754824099320704635?= X-GMAIL-MSGID: =?utf-8?q?1754824099320704635?= commit 3fde13f817e2 ("f2fs: compress: support compress level") introduce compress level, which macro(COMPRESS_LEVEL_OFFSET) is 8, But use wrong comment about compress level. Let's fix it. Signed-off-by: Yangtao Li Reviewed-by: Chao Yu --- include/linux/f2fs_fs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/f2fs_fs.h b/include/linux/f2fs_fs.h index ee0d75d9a302..1701f25117ea 100644 --- a/include/linux/f2fs_fs.h +++ b/include/linux/f2fs_fs.h @@ -315,7 +315,7 @@ struct f2fs_inode { __u8 i_log_cluster_size; /* log of cluster size */ __le16 i_compress_flag; /* compress flag */ /* 0 bit: chksum flag - * [10,15] bits: compress level + * [8,15] bits: compress level */ __le32 i_extra_end[0]; /* for attribute size calculation */ } __packed; From patchwork Thu Jan 12 13:35:03 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: 42431 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp3883574wrt; Thu, 12 Jan 2023 05:37:55 -0800 (PST) X-Google-Smtp-Source: AMrXdXu1b6sXR+9FalXH0KYx8mSCFMkDlS8iWWnul03fE8cN4v12ud2ZnfHY1miaUCn5hoxvMDgn X-Received: by 2002:a17:907:7e9f:b0:7c1:7d81:d2a8 with SMTP id qb31-20020a1709077e9f00b007c17d81d2a8mr79399554ejc.3.1673530675588; Thu, 12 Jan 2023 05:37:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673530675; cv=pass; d=google.com; s=arc-20160816; b=Gk5TIvUEVT+cMfS+rwZpt4sHr0WjMALgCuWKUzeHastfKck40pLTHJBBMp5q81ZNGn /HIpr1KAm7EaEcH4mqgXVjFVjtnZE2FtvyzpdB3KluGzIKDivdbbJ4BIothbIvNtF16q V5vfNhXKaFV/RfC4iPrnr2MN0O6QULys6Cpe4bveEwOFLwGmu5zrrs/9OClGNTR0MPCx 0r62wn+MwVyoSuU2kW7GOzM2lSkhHu3WcbnhZgQ/iHq2DNJqC5/2QQJThto4oD1xF4qf yhutzFr7SeT9Zknn69Fr0aeaxkjKJaLLwwKKsDbNuXQ28XdGLYzodC+7C4DgAAy9ZuIy uLOQ== 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=jBoxDRRiNObZbWquwZAPXj1shSi9v5yIgx0Kejvjy5o=; b=Sg18/tIHP7NnZ/d0POZGOT4417tgPCHF0HX3i5oEsPZv9Rx27gQzfxkf9du9KiXPPQ xq80b4DXnRNMT9aztbZm38D1jHehx5/0071rPpMHLu2HLcZOmjl6dKbJmLAvDEBRAncX YQnau+cVePNWfEkhHSWlzXW02n2J8WhjyUT8bVHCSs53Kq1rfmnzTNtIeV8TPZ6rwSww mgLdXXV3ilBvNLH9x5gBmM6o3RqTf2Laico3PZwQ8zKt/obrV/Wz/0p3aa9CCdZ4+oTQ w+PnloNLxOe+Hc9tb5r8lceL0EgMjbkbzDzidpbVkuyknMc1Y6klQKONF/9kErti9Xfr xeBQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=QfNubbFm; 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 xh9-20020a170906da8900b008552e7765afsi8898585ejb.936.2023.01.12.05.37.32; Thu, 12 Jan 2023 05:37:55 -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=QfNubbFm; 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 S232334AbjALNf0 (ORCPT + 99 others); Thu, 12 Jan 2023 08:35:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232317AbjALNfW (ORCPT ); Thu, 12 Jan 2023 08:35:22 -0500 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2106.outbound.protection.outlook.com [40.107.117.106]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B52E3FCBD for ; Thu, 12 Jan 2023 05:35:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E3Iq50GI18yGgwoz6GfM87dLA9qaV63zc/BGCFQtgEatK7OP/zUzNYKjxRzU9nCTyx13tx3LBEyDr8pzyDgAYZ543LZtFdIVFB87ZiK/NgnaAYd3DJGrZDcyO9ZInddJaEWVZi2wNNbR7J7+BIG8Zv492PDoe8YDZK7nyHjtDaIkaB/HHSD+KfoTuErVsSO0E1yZDpnzCtyb24euWORRiCk4o5EhAm2DUbV1mRB4vNG89QouDQKXySX4bhzahNimrbWXjx7iVIU1bk9OPhrd0SsGYjkNrXx5KY2/ijhNd8TQI9U1q4K+GATX1rZywY+539NrlacWXeIz6QD2/dKKhQ== 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=jBoxDRRiNObZbWquwZAPXj1shSi9v5yIgx0Kejvjy5o=; b=KIArNDbQbtm7bV6dCMnVCK4wpgvsQl22Moij9BfSIIU2yaOTNVs01Vgp2gEIzwA/akBD3IcTjv9SUl1waepz7YygvgqLGuXDLPt164VhHIw8Y2qIxiekUwiCHkx8Cx1isXVChC9HtB+eYGGkvB5US2USiDjGNtvyRq+Pwj9MP8KyBcI2AbZ2IGvRYe/OJ/p+DH6yQRplEZJMW1XN6CISq91oewQTkB03XabClHOzbgm0Qx4WIGwG2cewM0jhAMFtEuflmTzmoCRg/+rrNbHzeOVhmbgkyd3kUURWycl0x+4X5KyCG7qcCqtGvgoMO6eP5pB+bcphSErJD+Q6xx3YnQ== 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=jBoxDRRiNObZbWquwZAPXj1shSi9v5yIgx0Kejvjy5o=; b=QfNubbFm7B7WmH3LlF+SVHPIDJ4oocLQvy4Jfmm3KVPJcv4C6o97eLMA9Ouw+I8+POcOn9M98w1sD4V4pNqE7Jt5FGlQtZ4aLBuN92ErLk1p0HBL8ZV5cDnVd+6H9foZ/sP2lp94jLWEklAlPYFxTYZTLlSkh3V3ybbsrN3ssfmdz6puVs6SEGS2KRIll9aVgy7W3hwJijZro6WxuRnzDbnLQi7b6WgrrTNgSmi3F68v9JgUevAiwl8370uMflNSvPBZQkLF7PJxwOLZAoP3iVV0MVDrPz+pchOyT7qKK6yifQUJ8B1AeAkpz0fV6P8rGLxG8Im8S597N5bTskPIQQ== 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 SEZPR06MB5072.apcprd06.prod.outlook.com (2603:1096:101:38::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 12 Jan 2023 13:35:14 +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; Thu, 12 Jan 2023 13:35:14 +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 2/3] f2fs: add F2FS_IOC_SET_COMPRESS_OPTION_V2 ioctl Date: Thu, 12 Jan 2023 21:35:03 +0800 Message-Id: <20230112133503.16802-1-frank.li@vivo.com> X-Mailer: git-send-email 2.35.1 X-ClientProxiedBy: SI1PR02CA0058.apcprd02.prod.outlook.com (2603:1096:4:1f5::9) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|SEZPR06MB5072:EE_ X-MS-Office365-Filtering-Correlation-Id: e8d41b34-1742-4662-3eac-08daf4a1d5cd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2k5miotvS21Xl5q9r4k+qbmfJpqefDDYs0CFnUk6W2rDJL0EZesZUxh4QIgmcoCfeZxZmkoPY6RZNb6wS8QRiLXnmzVAiKnRRD2F1garY4Zoa4Dp8qnhJqO8kZ6xiPqRp1G1X60KkfzvkMMPg2VTW/TekoBsjh0S8EgS/Ah6nct68gACs2Cw5JOQXPgpLlXu9Eugl/vMyOCrtMOY6NDTXPdaOd9/2mQhGpE+DtEpsvF3E/jYHtgz9fbUlx8VFVmZN4MezZuphPB37LKlgpfpEI9JHygq3gVSyQ9hW2az8QezEqCtdJUGQE7T16WxUNYrqZKID/P8t1aDcsZcqb9bDEW4pNwVRIKxpFct4MaZgCa9wZ7/u8DcgXIgG/s5Qawik+2rpIazKmSlQf5uwof3mp9LvTijU+NFByaFvcKkRQhw0McGpOYbFvZb3HMFJPgZby1bxvZIOKD+RU8MOMu2zfSmSivCIvzXhOt4da3qWQvDDmMGv/p7TX0ANWrclEIz9IJLIdVy5vdZpUjxH7bztR43j0CA6yiFMPNndAB9YdgEhYMFQ4hXX40tOrVJn8Y/Q30Y6HAJtK3KgDWUNMGyZN/FuglnTNV3ZzR1geuS0m70JPrHkJFZBfcOvfwJhzDtrpA5FA4P+2HN8PwCDuv10DCgpNuXUavjs4OqpFtXP724jw5WmtrH/xDb9871UdYxX3MM/yLkc0mk8KSeQIFqxw== 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)(136003)(366004)(376002)(346002)(39860400002)(451199015)(107886003)(6666004)(478600001)(6506007)(6486002)(86362001)(2616005)(38100700002)(6512007)(186003)(52116002)(38350700002)(36756003)(83380400001)(26005)(1076003)(66946007)(8676002)(8936002)(66476007)(4326008)(66556008)(5660300002)(316002)(41300700001)(2906002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: M1CCMffZIu7xzE7e+NmZk246+cez6X+JwPCbSPo8174KC0tguti6FX3YX/7WkVFbDXweeodwDobrJIjyGty+zvepq3rywpIBfWRCg52OgyZgjQenrOQibOLQeHdSc5pWaxj7tkrQRhLo+VDpKCrOG5Zp3LcN+vySy92C2UG06AphO1BsChNDmSF9o2iqtUGNoSKegTMcBjK5Iw7Wxlmamf2DZoEfeqNm3tKDbyey1PZQL8hl78fIypOQSibQX3e+ddtH58CNmg6CtybepjofPdShN+HAx1Mwc3z2azmJMvPGkDmlxOHnS2zYDoakJ/Evs9SqdAx2CWtcU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dpItqisJyrdXUIelEVLdTFguwz1p73MrkBA9P0vnEalmS9jCTnwBtUlBT7oJVNrvOV6zu2bFBh37jIDHNj+GCYgDywf+0NOOB7VCyFfq1JYjY6BNG8anLSQCkf32ABytFPxJHyPFW80cciQRdi8oSl1V8BuT9Bw9TNgQ8Ns9fPVVZ+GurlpnEQCGc0W5mcveTWrZyj X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: e8d41b34-1742-4662-3eac-08daf4a1d5cd X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2023 13:35:14.1506 (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: 67czQ1ZJxQ0zSlTLiI9e8XT7ukO1dDL+OeJ9Bi8W41KCXnUvThnx676ggvMP7QG9ukEIk704o7/fH5pP2D6xUg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEZPR06MB5072 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?1754824101519841753?= X-GMAIL-MSGID: =?utf-8?q?1754824101519841753?= Added a new F2FS_IOC_SET_COMPRESS_OPTION_V2 ioctl to change file compression option of a file. struct f2fs_comp_option_v2 { union { struct { __u8 algorithm; __u8 log_cluster_size; __u16 compress_flag; }; struct f2fs_comp_option option; }; }; struct f2fs_comp_option_v2 option; option.algorithm = 2; option.log_cluster_size = 2; option.compress_flag = (5 << COMPRESS_LEVEL_OFFSET) | BIT(COMPRESS_CHKSUM); ioctl(fd, F2FS_IOC_SET_COMPRESS_OPTION_V2, &option); Signed-off-by: Yangtao Li --- fs/f2fs/f2fs.h | 8 +------- fs/f2fs/file.c | 41 ++++++++++++++++++++++++++++++++------- include/uapi/linux/f2fs.h | 21 ++++++++++++++++++++ 3 files changed, 56 insertions(+), 14 deletions(-) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index f3c5f7740c1a..c2267f44bcf8 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -1501,11 +1502,6 @@ enum compress_algorithm_type { COMPRESS_MAX, }; -enum compress_flag { - COMPRESS_CHKSUM, - COMPRESS_MAX_FLAG, -}; - #define COMPRESS_WATERMARK 20 #define COMPRESS_PERCENT 20 @@ -1521,8 +1517,6 @@ struct compress_data { #define F2FS_COMPRESSED_PAGE_MAGIC 0xF5F2C000 -#define COMPRESS_LEVEL_OFFSET 8 - /* compress context */ struct compress_ctx { struct inode *inode; /* inode the context belong to */ diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index f5c1b7814954..719706ef0d46 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -25,6 +25,8 @@ #include #include #include +#include +#include #include "f2fs.h" #include "node.h" @@ -3910,12 +3912,13 @@ static int f2fs_ioc_get_compress_option(struct file *filp, unsigned long arg) return 0; } -static int f2fs_ioc_set_compress_option(struct file *filp, unsigned long arg) +static int f2fs_ioc_set_compress_option(struct file *filp, unsigned long arg, + unsigned int cmd) { struct inode *inode = file_inode(filp); struct f2fs_sb_info *sbi = F2FS_I_SB(inode); - struct f2fs_comp_option option; - int ret = 0; + struct f2fs_comp_option_v2 option; + int ret = 0, len; if (!f2fs_sb_has_compression(sbi)) return -EOPNOTSUPP; @@ -3923,8 +3926,12 @@ static int f2fs_ioc_set_compress_option(struct file *filp, unsigned long arg) if (!(filp->f_mode & FMODE_WRITE)) return -EBADF; - if (copy_from_user(&option, (struct f2fs_comp_option __user *)arg, - sizeof(option))) + if (cmd == F2FS_IOC_SET_COMPRESS_OPTION_V2) + len = sizeof(struct f2fs_comp_option_v2); + else + len = sizeof(struct f2fs_comp_option); + + if (copy_from_user(&option, (void __user *)arg, len)) return -EFAULT; if (!f2fs_compressed_file(inode) || @@ -3933,6 +3940,21 @@ static int f2fs_ioc_set_compress_option(struct file *filp, unsigned long arg) option.algorithm >= COMPRESS_MAX) return -EINVAL; + if (cmd == F2FS_IOC_SET_COMPRESS_OPTION_V2) { + unsigned int level = GET_COMPRESS_LEVEL(option.compress_flag); + + switch (option.algorithm) { + case COMPRESS_LZ4: + if (level < LZ4HC_MIN_CLEVEL || level > LZ4HC_MAX_CLEVEL) + return -EINVAL; + break; + case COMPRESS_ZSTD: + if (!level || level > zstd_max_clevel()) + return -EINVAL; + break; + } + } + file_start_write(filp); inode_lock(inode); @@ -3948,7 +3970,10 @@ static int f2fs_ioc_set_compress_option(struct file *filp, unsigned long arg) F2FS_I(inode)->i_compress_algorithm = option.algorithm; F2FS_I(inode)->i_log_cluster_size = option.log_cluster_size; - F2FS_I(inode)->i_cluster_size = 1 << option.log_cluster_size; + F2FS_I(inode)->i_cluster_size = BIT(option.log_cluster_size); + + if (cmd == F2FS_IOC_SET_COMPRESS_OPTION_V2) + F2FS_I(inode)->i_compress_flag = option.compress_flag & COMPRESS_OPTION_MASK; f2fs_mark_inode_dirty_sync(inode, true); if (!f2fs_is_compress_backend_ready(inode)) @@ -4221,7 +4246,9 @@ static long __f2fs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) case F2FS_IOC_GET_COMPRESS_OPTION: return f2fs_ioc_get_compress_option(filp, arg); case F2FS_IOC_SET_COMPRESS_OPTION: - return f2fs_ioc_set_compress_option(filp, arg); + return f2fs_ioc_set_compress_option(filp, arg, F2FS_IOC_SET_COMPRESS_OPTION); + case F2FS_IOC_SET_COMPRESS_OPTION_V2: + return f2fs_ioc_set_compress_option(filp, arg, F2FS_IOC_SET_COMPRESS_OPTION_V2); case F2FS_IOC_DECOMPRESS_FILE: return f2fs_ioc_decompress_file(filp, arg); case F2FS_IOC_COMPRESS_FILE: diff --git a/include/uapi/linux/f2fs.h b/include/uapi/linux/f2fs.h index 955d440be104..aaf7f55273fb 100644 --- a/include/uapi/linux/f2fs.h +++ b/include/uapi/linux/f2fs.h @@ -43,6 +43,8 @@ #define F2FS_IOC_DECOMPRESS_FILE _IO(F2FS_IOCTL_MAGIC, 23) #define F2FS_IOC_COMPRESS_FILE _IO(F2FS_IOCTL_MAGIC, 24) #define F2FS_IOC_START_ATOMIC_REPLACE _IO(F2FS_IOCTL_MAGIC, 25) +#define F2FS_IOC_SET_COMPRESS_OPTION_V2 _IOW(F2FS_IOCTL_MAGIC, 26, \ + struct f2fs_comp_option_v2) /* * should be same as XFS_IOC_GOINGDOWN. @@ -62,6 +64,15 @@ #define F2FS_TRIM_FILE_ZEROOUT 0x2 /* zero out */ #define F2FS_TRIM_FILE_MASK 0x3 +/* + * Flags used by F2FS_IOC_SET_COMPRESS_OPTION_V2 + */ +#define COMPRESS_CHKSUM 0x0 /* enable chksum for compress file */ +#define COMPRESS_LEVEL_OFFSET 8 +#define COMPRESS_LEVEL_MASK GENMASK(15, COMPRESS_LEVEL_OFFSET) +#define COMPRESS_OPTION_MASK (COMPRESS_LEVEL_MASK | BIT(COMPRESS_CHKSUM)) +#define GET_COMPRESS_LEVEL(x) (((x) & COMPRESS_LEVEL_MASK) >> COMPRESS_LEVEL_OFFSET) + struct f2fs_gc_range { __u32 sync; __u64 start; @@ -96,4 +107,14 @@ struct f2fs_comp_option { __u8 log_cluster_size; }; +struct f2fs_comp_option_v2 { + union { + struct { + __u8 algorithm; + __u8 log_cluster_size; + __u16 compress_flag; + }; + struct f2fs_comp_option option; + }; +}; #endif /* _UAPI_LINUX_F2FS_H */ From patchwork Thu Jan 12 13:36:05 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: 42432 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp3883885wrt; Thu, 12 Jan 2023 05:38:33 -0800 (PST) X-Google-Smtp-Source: AMrXdXv8xLscFOYe8+qzFJtuZb2AXxEmHw56TTsV/3MEz03u8QhEoOCGubeD4vv5nHnBqltahIaq X-Received: by 2002:a17:906:9f0a:b0:7ad:88f8:7663 with SMTP id fy10-20020a1709069f0a00b007ad88f87663mr86825592ejc.43.1673530713669; Thu, 12 Jan 2023 05:38:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673530713; cv=pass; d=google.com; s=arc-20160816; b=LT5BJWBByuuPbq5j2eAey2MFl1d04mW+5JcnSNaffeB0NK2phBLolP58FDUvh7CDnV /Z4xnGuS9cUcxwRkC+e8nFxwDYnhFrtlEUj3Ixxep4g3GAttpjPwnjBYA/pYtctO5Z45 4+zShwPPz7vtxfzyE9Fhtrtr8mdtS+SwW85OatI8D4/cTSxCn7rtGst7jPhT7wuHdlBs VCZsNJkVll/DSwBfgwe0f1V+s8AQZZ2aD3q4iRBV6kNwd752brrYVGK4r6XvoKI6YY6B SKnzKefzC9FqjpK6WA/RsXoURtwVQi8aQrdZGMQdJzOTLt6e2z2x1IKw7qWgwaMD7RJg 5gEg== 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=duWOs/Ix8uyKICEfM8mPMrrqsEq4KNTHqbffA8TiPWs=; b=O2Fay0DoQ5OK9ALDI5Pd4Cz5aUeIaQfs+FiwOAu+dps0NKVSWVM3zSzMqpApdmnF0T NrCnk73/T6riGl3fPxMxxSxLWqLkG7y6CwVzyOzTpDj8bsLnJHMQqO+Y1Kkn13r2xiCB kN3C5HVaaORvmUu6r75sce3G78SP9ugoN6jzlZvswMTU0T/QyLKCnWCoYC7pY47U6SbU UX6a34buE8GBeJ9LBUYcE23UXX0Rorcv5/iuA8BH6OBkd3hAAJPByD0HMYFAR20dcnWI QmKoO9YWkzV+7BX7rp1164BN7+o9uyhkqX8VkNYpUrpyRT79qXGT2O/VQs43SYMSOIf7 a1Zg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=S0YwLyDR; 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 du1-20020a17090772c100b0080f0493b9c8si19689277ejc.536.2023.01.12.05.38.09; Thu, 12 Jan 2023 05:38:33 -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=S0YwLyDR; 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 S229920AbjALNg2 (ORCPT + 99 others); Thu, 12 Jan 2023 08:36:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232875AbjALNgS (ORCPT ); Thu, 12 Jan 2023 08:36:18 -0500 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2133.outbound.protection.outlook.com [40.107.117.133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7299C4731B for ; Thu, 12 Jan 2023 05:36:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D0McbLsk0V25JRAbNBRRoWEI+7HoK0HVi/rcrweNfWQQ96CuS6+qx5uoCqvbH7dHzdxV1tAHkDUyvp8a/jUsyOC/BjqvUePuUUxsxAol2CppMBL9L0poIU9jUxqgDBmxfvxyahDqUTCyd+E1p7BKUuIf1CnL/oUWxFwDJ3QklED0IcAaftERBxQUtDOLkWt1rsttteW5QOCvEeRdFFnOsIT5tTe9OPeotIrawWtpo6sTKTxS71J8wJmo9aJDCvZfD37/dM3MSaZgbCgItanQA/sN/CVQih/GtalVrD5hddCFgAaQepBILiDe0CqRbpKclPFNIDgCKjKoQgBqr3e4Mw== 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=duWOs/Ix8uyKICEfM8mPMrrqsEq4KNTHqbffA8TiPWs=; b=j6eQqI4G8nCC3aKr6yC4JfMzIh2o4wEklo1+Cod64jVk3vdV6RBa6bq95ZoznRXA0KDsWn9SFA4UgkGc7RaqAq/uOUivQq5qr/3mO8NZ8GSwkGyGtcwAEtygmjqlaWLWtVOdIVazJDbuClB049vnWNLWYxA0c38gSJaYsVPPsIpXBuN0FZVfjrjW/TJ0a+4o0RBFBGRAFOPrfOp6OGZ/fRF6ICunuzaQKK2DbFntyu0Q3vbG0Te8SZrZPDslxii4L8uKh+ddDprwuFiSgHASJmwvM91Wm7+EizLE2NDacQ35SVTj2QbCKBFAqdFQ+b7UqGjpOx5f9PS6d5OkPVMcbQ== 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=duWOs/Ix8uyKICEfM8mPMrrqsEq4KNTHqbffA8TiPWs=; b=S0YwLyDRmeAy6DG/RJnPbp2vsaMt/Pz15HF9zifFm4Lnp5b6u9AugCWcG/GURxN5tYPpZVG0zQ6qi+ZGSC5rehpmFDiEQkOG2Xuv5gKLqW8z/hMDZHuguPhAOVV3R+HNrcIVnFtmSttD8FxQFWN19HvDmZ9pu1rer3esyHJ8bkyUtFmQ5YymKiaLxCq0fmgFW0YWbD7I76sGnTkjpfRvF0fnVUxhq1cO3O8WfrNPrbRKkrRWXC0efKfvshxcXStveZwuKIF77HfeIqEkX4reWoVWCdjs8gUMx4pljzG2G6nKsqk397QrZvJzAcFVzOZSwp3+pfDsI975qi9z2y4x0A== 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 SEZPR06MB5072.apcprd06.prod.outlook.com (2603:1096:101:38::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 12 Jan 2023 13:36:14 +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; Thu, 12 Jan 2023 13:36:14 +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 3/3] f2fs: add F2FS_IOC_GET_COMPRESS_OPTION_V2 ioctl Date: Thu, 12 Jan 2023 21:36:05 +0800 Message-Id: <20230112133605.16957-1-frank.li@vivo.com> X-Mailer: git-send-email 2.35.1 X-ClientProxiedBy: SG3P274CA0010.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:be::22) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|SEZPR06MB5072:EE_ X-MS-Office365-Filtering-Correlation-Id: 070f66d2-1999-47ad-0611-08daf4a1f9bc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WtDrrmbeiBq+B1MUGmC453aWbyEvC2WSH9p2205Y8/QFPNgS94IS03IRav448bkDgxk4KTNCvSczVxCmyh54PYiwuzLNPis0Us73RbQonEChr66btgVvi0VhnW0SX5bbgQqmAF7y3qGLQ/1ks858FjejaZNZLqaBkZ3e2w738/AZKp2h3FbDonMUKzchBq0z9N9yzUsPJvLRMvyb/BsPSY/6WVcon6/ZW3hiCSerWKS450NW9iUXwDcFwgk2QTH4iyFSsTMLSgVXenLvrD83tfnPhYiTNeza8szx4ho0Alq6yxRDGD5KulWh135djGxdySYHxSjmb4swsGX0jlolA5HCtkxoml6JzkNPiD5iVba94a0udPrn0m3VpSiRtc0OrQN24OZPA1on7TNYW/LahTwgf5REj1s4CPInJKdWnSr2Kbg0iikwnN+mQObQX5B7KeCLqb/UnqD9Sx6ZjfWb3aa3aaiUE+DLNuyHWJkGy8LtvMNVtETYVeqhBqpQG1Heq26SfGMxSaWnIkgsSXk11CFHc7D9eN0TAfCjbCs4Y2m9jBXHdJFOWoHxav2BSE3uHwOKeW4gqBxbIntIhm9SJYL4eQh0DeHEpncVTiHiBByOP3P7tmpbLqYuQCgm1ewvj7GjYTTgzWBkjRuvwmI/kW380ofyIEhqUXtfE4zm4aJW5OqzzSKDwhvyn9mkCLmUQ4yoQhlMv1X0F7JheIfojA== 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)(136003)(366004)(376002)(346002)(39860400002)(451199015)(107886003)(6666004)(478600001)(6506007)(6486002)(86362001)(2616005)(38100700002)(6512007)(186003)(52116002)(38350700002)(36756003)(83380400001)(26005)(1076003)(66946007)(8676002)(8936002)(66476007)(4326008)(66556008)(5660300002)(316002)(41300700001)(2906002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: dszGwjnXolIu0pMWhQj6Byf5Gs2ieG1lq0bHTGovf0/5S2RkwKYhrO4B9LiCcMRUlsF1NY5zolNLwlb9i3TCDp8dgi2lxsKCk89khVR799/iybiVj3f4jrt5PbZ/JpMKf0aWyQ+V6D7NXebtVnldFNREMxMOmoo1e3zyY4hdn3ztTXSQ8XcoFPwc6EI4nNvZ7uWpO1zItxQkpaGSKo2Mi1hXSeHsYX9GyzGBV4X36gmJAc4ugfW9B+vIaQiTOKYRYGzCpFwhhiz6xMyFmcYtPiIkXJEV4MC84QVUIJnDAL7O6k8beueCMzIlXFVeMSoKVeMovFwWEKEZnIF5kmqf5OW9huUGIekCCB9YwI6N3gXrqaGrRlCcDCmksdH59vK/wD9i4tAeZEZIp33Fnzped8e8/Ag2Ng+6vr6OZkY6Dvxs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TaNi9lRZTS6v+XMHYFhQpPj7AoeHs1WEEQU+ibbybkhvSSut29HcfDDuv0Wf/7wv7hzTKzg1418a/ X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 070f66d2-1999-47ad-0611-08daf4a1f9bc X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2023 13:36:14.4369 (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: 298oVOnn+GbBYEzm0vxpM1WIGjL1O4hhQMB6cMqN9tni2LrnmnuFn0fVbs3bFZ05U9mtTB4ZOZRnIseGPDZKaw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEZPR06MB5072 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?1754824142054586157?= X-GMAIL-MSGID: =?utf-8?q?1754824142054586157?= Added a new F2FS_IOC_GET_COMPRESS_OPTION_V2 ioctl to get file compression option of a file. struct f2fs_comp_option_v2 { union { struct { __u8 algorithm; __u8 log_cluster_size; __u16 compress_flag; }; struct f2fs_comp_option option; }; }; struct f2fs_comp_option_v2 option; ioctl(fd, F2FS_IOC_GET_COMPRESS_OPTION_V2, &option); printf("compression algorithm:%u\n", option.algorithm); printf("compression cluster log size:%u\n", option.log_cluster_size); printf("compress level:%u\n", GET_COMPRESS_LEVEL(option.compress_flag)); printf("compress chksum:%s\n", (BIT(COMPRESS_CHKSUM) & option.compress_flag) ? "true" : "false"); Signed-off-by: Yangtao Li --- fs/f2fs/file.c | 20 +++++++++++++++----- include/uapi/linux/f2fs.h | 4 +++- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 719706ef0d46..e011fb50ccc3 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -3885,10 +3885,12 @@ static int f2fs_sec_trim_file(struct file *filp, unsigned long arg) return ret; } -static int f2fs_ioc_get_compress_option(struct file *filp, unsigned long arg) +static int f2fs_ioc_get_compress_option(struct file *filp, unsigned long arg, + unsigned int cmd) { struct inode *inode = file_inode(filp); - struct f2fs_comp_option option; + struct f2fs_comp_option_v2 option; + int len; if (!f2fs_sb_has_compression(F2FS_I_SB(inode))) return -EOPNOTSUPP; @@ -3902,11 +3904,17 @@ static int f2fs_ioc_get_compress_option(struct file *filp, unsigned long arg) option.algorithm = F2FS_I(inode)->i_compress_algorithm; option.log_cluster_size = F2FS_I(inode)->i_log_cluster_size; + if (cmd == F2FS_IOC_GET_COMPRESS_OPTION_V2) + option.compress_flag = F2FS_I(inode)->i_compress_flag; inode_unlock_shared(inode); - if (copy_to_user((struct f2fs_comp_option __user *)arg, &option, - sizeof(option))) + if (cmd == F2FS_IOC_GET_COMPRESS_OPTION_V2) + len = sizeof(struct f2fs_comp_option_v2); + else + len = sizeof(struct f2fs_comp_option); + + if (copy_to_user((void __user *)arg, &option, len)) return -EFAULT; return 0; @@ -4244,7 +4252,9 @@ static long __f2fs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) case F2FS_IOC_SEC_TRIM_FILE: return f2fs_sec_trim_file(filp, arg); case F2FS_IOC_GET_COMPRESS_OPTION: - return f2fs_ioc_get_compress_option(filp, arg); + return f2fs_ioc_get_compress_option(filp, arg, F2FS_IOC_GET_COMPRESS_OPTION); + case F2FS_IOC_GET_COMPRESS_OPTION_V2: + return f2fs_ioc_get_compress_option(filp, arg, F2FS_IOC_GET_COMPRESS_OPTION_V2); case F2FS_IOC_SET_COMPRESS_OPTION: return f2fs_ioc_set_compress_option(filp, arg, F2FS_IOC_SET_COMPRESS_OPTION); case F2FS_IOC_SET_COMPRESS_OPTION_V2: diff --git a/include/uapi/linux/f2fs.h b/include/uapi/linux/f2fs.h index aaf7f55273fb..b42f6b322b8b 100644 --- a/include/uapi/linux/f2fs.h +++ b/include/uapi/linux/f2fs.h @@ -45,6 +45,8 @@ #define F2FS_IOC_START_ATOMIC_REPLACE _IO(F2FS_IOCTL_MAGIC, 25) #define F2FS_IOC_SET_COMPRESS_OPTION_V2 _IOW(F2FS_IOCTL_MAGIC, 26, \ struct f2fs_comp_option_v2) +#define F2FS_IOC_GET_COMPRESS_OPTION_V2 _IOW(F2FS_IOCTL_MAGIC, 27, \ + struct f2fs_comp_option_v2) /* * should be same as XFS_IOC_GOINGDOWN. @@ -65,7 +67,7 @@ #define F2FS_TRIM_FILE_MASK 0x3 /* - * Flags used by F2FS_IOC_SET_COMPRESS_OPTION_V2 + * Flags used by F2FS_IOC_SET_COMPRESS_OPTION_V2 and F2FS_IOC_GET_COMPRESS_OPTION */ #define COMPRESS_CHKSUM 0x0 /* enable chksum for compress file */ #define COMPRESS_LEVEL_OFFSET 8