From patchwork Thu Nov 24 06:40:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuezhang.Mo@sony.com" X-Patchwork-Id: 25334 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3227912wrr; Wed, 23 Nov 2022 22:49:47 -0800 (PST) X-Google-Smtp-Source: AA0mqf75i8emZAC6AOZM3SxnBtLT66R9xJ1GmOSgI9zPeQvEzKGchow0e0WQ/kyW0UfFmKghn9AA X-Received: by 2002:a17:90b:3d0b:b0:218:b258:f5b0 with SMTP id pt11-20020a17090b3d0b00b00218b258f5b0mr19031999pjb.119.1669272587049; Wed, 23 Nov 2022 22:49:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1669272587; cv=pass; d=google.com; s=arc-20160816; b=LxPMs6ksxvja3koLgHBW9/X0haOicCvFzWb4hTpgfX1YWYkQUB33XvmInOOpase5Zw GgotFN+L8Zk8oTri+nntX53jj8TWlvTm45U5cArnDR60iNbJer3Jhh336QwLY0l73jLz AK1jzsMXCQEV459fEBCsU+Z85cXnGIyGVK91PiE5fFJOZKGiLbEtOWR9wLhESayAhvHI TjRGZ82G2pPysWX3rjY/S3JC+26CofFfreqxRGPhAu8Y9TlF8VEOGRT90x3msf12QU7A P4qnVti8yQ6+j/669e+wsJS5kILUVl5QdPI32FVl77Kf33P5PIdy76YVWZ8d6WZmYzVQ 8crQ== 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 :content-language:accept-language:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature; bh=wIX8Tc1UFkB+/p/X0Mj7veETRAIdZTUGHtiCNC1GTS4=; b=Pjq240nP1yi1TLY/pRDo1b6jxb0c/B/r3WTG4CiaKsb2KgTAm8CvA7/lgQ+Wk5EFqJ ot7UX2xRRRj5xh8Q1WkdTRRiK0VmsnbulKR6M1PYWFIX4Lgtc8+pjKnwzsnc2nYOdnaF IDEc0mO/cTKOtgZR1gVJa6iP3EfuEOHG+QL4rZn8dQP0N+PcewwwvmskWPEWpve277Hf CVTW6uK7UxlbRUSW4GVzQdVKaWquqnM7A4KXMmgphHTmtLUyQnET5td5MRINdjbfps8+ CrTRYIvFC4B1saXdjbY0uCP2SK1CJ3213sNqulVlW94+glahL946H+VA9LJaXZ9hlvEt eUjg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sony.com header.s=S1 header.b="jtx/FBTn"; arc=pass (i=1 spf=pass spfdomain=sony.com dkim=pass dkdomain=sony.com dmarc=pass fromdomain=sony.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=NONE sp=NONE dis=NONE) header.from=sony.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y63-20020a638a42000000b00473d2c2c06bsi524573pgd.423.2022.11.23.22.49.33; Wed, 23 Nov 2022 22:49:47 -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=@sony.com header.s=S1 header.b="jtx/FBTn"; arc=pass (i=1 spf=pass spfdomain=sony.com dkim=pass dkdomain=sony.com dmarc=pass fromdomain=sony.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=NONE sp=NONE dis=NONE) header.from=sony.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229525AbiKXGlD (ORCPT + 99 others); Thu, 24 Nov 2022 01:41:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229680AbiKXGkv (ORCPT ); Thu, 24 Nov 2022 01:40:51 -0500 Received: from mx08-001d1705.pphosted.com (mx08-001d1705.pphosted.com [185.183.30.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D881DAD27; Wed, 23 Nov 2022 22:40:48 -0800 (PST) Received: from pps.filterd (m0209321.ppops.net [127.0.0.1]) by mx08-001d1705.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AO6OH5r001748; Thu, 24 Nov 2022 06:40:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sony.com; h=from : to : cc : subject : date : message-id : content-type : content-transfer-encoding : mime-version; s=S1; bh=wIX8Tc1UFkB+/p/X0Mj7veETRAIdZTUGHtiCNC1GTS4=; b=jtx/FBTnAzSoUIphrTXVr/bbJzYDYRRgIFucXU5Tiq6ITf4MozX1g3K8ivX+cxohVwKo 3HgV+mfE56c+/aBTNBW9W3gRhEAJkIJk6SM9wMiztC1d8pwTpUJRJjA9HVFVs4PLsBqo gTCX9m4zBmeNGCIr7IL6s0YFjJ478Om8vpNpHaST5PumX6b5zIUcZgnTcRacd5YoZtHu kDmJrN2XbohzKgqOouCUfHumH9YXC9v2pCNDH4vXCGYkpr3j2VqeMQTvp2Nmdk2afN7+ Fr0ubl89ctLT/iqgzrRIiUEjVc+0tiDhMBTijbEcwx477OhLZmz8WnZSYPq2icErZkf/ LQ== Received: from apc01-tyz-obe.outbound.protection.outlook.com (mail-tyzapc01lp2047.outbound.protection.outlook.com [104.47.110.47]) by mx08-001d1705.pphosted.com (PPS) with ESMTPS id 3kxrb94t31-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 24 Nov 2022 06:40:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Uq12ZB52w1zaoQH6onPLRT4KWU5F7EdW4dXA+FsimsRSbSPU1ODwy+NayStD5Y+Y6LwgQiapT9pZlI1qHLxpPD+7CJpg8A6FYbbKXblGXi7Kj1sWRgJWtzHAM+677kHK1C0q5+OilWSM8yGWu5hNU+wgWP/nFZ3Y41+rYW61xOLrVtTfu0Eq5wUlyN6eizMxLOcq2fbgxAbGIpPcRpaX7DH2CNpBpAIXArIT84247Xk7h01NEU6Vgks3ZxFordjXtSB20DWWAK0ntYtr2XUhEvoVKJAyvA5L0o7MrKenjlWQG/oSStzgGiL4KVkLERRdTbq5zmnFmqpl9wp7YDtwEQ== 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=wIX8Tc1UFkB+/p/X0Mj7veETRAIdZTUGHtiCNC1GTS4=; b=eHb/a2E6eBnVvFgFIlKpg9m6v+Azl3WnbcbGvWWGnLTm6v2a1a26zk9Wm95hELDDRWTDHwg0Q+DuCMScxeCcSuv32KR9nGh9Y6c95XaflBBr8M97nQRto7D/vrXGSzuS7yKBnONmLqLMGMt6JmYfditG2gZWfmKg7LXitDkXEVL88U2r1ureDPV9UTyVZRolcX+Dbp0njVfUD0PppuglYuRiYf98mty3Sdc3TMPK3K1Fyg+OscK91nq7UycvvF5wdT52A3R8d6tiN5FZBvBodma2kiyP8GueQXHdhSBwEc2uKcVEH/Vyq/rxH+CEql0G61MKn328d0Zu8YNAXzy2dw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=sony.com; dmarc=pass action=none header.from=sony.com; dkim=pass header.d=sony.com; arc=none Received: from PUZPR04MB6316.apcprd04.prod.outlook.com (2603:1096:301:fc::7) by SI2PR04MB4425.apcprd04.prod.outlook.com (2603:1096:4:e8::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.17; Thu, 24 Nov 2022 06:40:24 +0000 Received: from PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::708b:1447:3c12:c222]) by PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::708b:1447:3c12:c222%8]) with mapi id 15.20.5857.008; Thu, 24 Nov 2022 06:40:24 +0000 From: "Yuezhang.Mo@sony.com" To: "linkinjeon@kernel.org" , "sj1557.seo@samsung.com" CC: "linux-fsdevel@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Andy.Wu@sony.com" , "Wataru.Aoyama@sony.com" Subject: [PATCH v2 1/5] exfat: reduce the size of exfat_entry_set_cache Thread-Topic: [PATCH v2 1/5] exfat: reduce the size of exfat_entry_set_cache Thread-Index: Adj/yZ7/ZJx2fxByTueAE189lTyjlA== Date: Thu, 24 Nov 2022 06:40:24 +0000 Message-ID: Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PUZPR04MB6316:EE_|SI2PR04MB4425:EE_ x-ms-office365-filtering-correlation-id: 0bf6b9a8-5f3e-48d6-2629-08dacde6c40e x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 8niHfsphtpCfT7FGnEST3eWyynL5/9N60AFAzS4PZYtJqgJPgl0GQybKi6sg161g0qVo7+abAFUGBAJ2I49a0Gti6qDVEc50NECZAN+EyAtWKE9ZhsbMeiAJb/ANEDNvdLUMH3hXOJm3cZLp00ed9XyFX5vzxX3/S6DcanRJkRpeK4muWa06si4yTKEgYTJaot+2CtdyIDhMd7UZWsYg95N1OSw0ca+Vj9QDSjmsWKIkJykyBNHj4DAKyG5QZvSsI1x89Kbx6RQpXfuCHekepOITnQ0Fq0NBWbbYp9rEKgPZVUVdc3tuvptCFM0UGVOps0521qiQavWGjvh8N6xJPECVElg7PoNe+UmCsuOvylaMLR1594BkDevBvlg3Eyat+20xW7gt5uUjeUD9ADnhQIzYHRh1MjkzYP01onTKRLSnxw7LDsUiF303p890sLE9cgAoVf4cfvEqgS8c2qJkwUkJjPXF6vPJKR2lEX8p+2/yQa4GWhlPUbC8DNWjbn8mqaCq7GjBJsqFyHX2o2LE8G2x4AjfYcIbvscB7LC39VTruvul50cBINNkT6i4ra/mIgcqKVEAirFEz60UhJ93aqJU8V2LrqO204XxPA6aprH+wXNp090OPcPHpikQnB4+gEDKQbKbnhBIdNEXCw4xsR90kxGvCXijJQRaD2shB8WmhpZWHJi4wyOnySJsflrrkzIv/iK+v4Ybr2u87/QrRA== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PUZPR04MB6316.apcprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(39860400002)(396003)(366004)(376002)(136003)(346002)(451199015)(41300700001)(8936002)(478600001)(54906003)(4326008)(5660300002)(316002)(66556008)(66476007)(66946007)(76116006)(52536014)(66446008)(64756008)(8676002)(71200400001)(107886003)(2906002)(7696005)(6506007)(9686003)(186003)(110136005)(122000001)(26005)(38070700005)(38100700002)(82960400001)(86362001)(83380400001)(33656002)(55016003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?wKJ6vzFjI7A1/QgAzkFWOHWbV0MM?= =?utf-8?q?bdAMQy/ytTymOOyBjcwChwVbzSgzC6pKXN+ml+1vQQYIC6dst8NmIv1Ka88RLrtEW?= =?utf-8?q?m7ONxHbtUvF7aWR00HhfBQfOguvs5PLnYzZ5WoXWVkXwxt3ubfm7kpj0ggHBW1Ohk?= =?utf-8?q?CBp6/b3A3IQfwS7mdRVNCY8Pu9yoL+KXBpaUq2RCwl2l+9TATy3SnfzVojxkG92cO?= =?utf-8?q?4mJn1qJ8l+q4ZDIHyKrNGkWYrneWvScRj/+bz0/HdYfJpWWVNqerjmI/VEwYgTngb?= =?utf-8?q?L73wpNGDSJ/tdakml9mUVdCN31g3xroWcncf6mu48N/FdeFhceZRu/u1oaWpiXIGA?= =?utf-8?q?/rt7gztY2KXaq4QbVO8C0WFT08p2qq7dXNf8Bn7Xvpbzp7EO63TZAgv2qgX5zk2Tb?= =?utf-8?q?WY63OY0ZNP102785Wz9SNSj2gaydRAURGyOxQ+K5WugIKXDRXHf21cIf1KdEZNehk?= =?utf-8?q?1T2u+PUtaafdAL+vx9sG6aKVtEZa8x7TKPHixYk7QZ9/QaIUlnEC4aYHEPzZU8S0V?= =?utf-8?q?+pGll8Kt0ELYqPvnmAk1rFg1FYq6cjpyDBQSgj6bAuy6G4RZknNQqLhJSmbG5bXgc?= =?utf-8?q?FMgMkIVfWujh+KgEAVTLsuB9zZa0B3iRptHjeeGI59fEp5U5Hn+AUYejzM2sKHThc?= =?utf-8?q?OTU0heLnAOFtNqL0BzHu79psxL8LTvzRHy29zb8fW/ip23ES5qjFBM5DrQTRWzCsM?= =?utf-8?q?AurhZYuBUNmeGAwCoBdRFECgogV3vLDOV0Wy5X1Lqyrp+B6qKOJj23slIR8Py271k?= =?utf-8?q?avdQzjrKCR1vqfsqp11kcg34Y/oOq44rUd+DBjGUWMTzyOBC1RsVHAcos89EeyaBj?= =?utf-8?q?Ff8sBp6Ojs2VPNfsD74OSLCj8JPBGqyCt8Kyael4fNsCN/xYSJLB8nUiH6J8knMw2?= =?utf-8?q?73PYFVanuDy6dk5Xk9lEqnOg+dzCVn6uIZbb1ddwdCl1DkJyuPtUt50W8Ak5lg/H5?= =?utf-8?q?Zi1/gsnI/r7N6U/c0LoRtAd2UXQPJ+iA8/5JjaRyywTtzSXsNojZHQVjcnonDRyan?= =?utf-8?q?jyz8RCO+k5XStHxbTm78SD14pGPo9ibQtYEaTeNRP2BTDuVj5/zDARgrDVMsBjO4T?= =?utf-8?q?QL4kz0VFMhZiaunlD4yKUntE+cHBIKlm4/62/sRXu68MoWqDFut+AOQojeAMxFwWe?= =?utf-8?q?66c5dtzzg1QVD7tlBsGRQUpDjySvfbUwqDfq+4QOVKAckYCEIekPikIBiIPtkXKMO?= =?utf-8?q?Lp1vBhDTe3DS4R0Bfc1zBv7PbF2p4aumzNkHFR7IzL31D+SIAKhIxuyq2IjGTunC3?= =?utf-8?q?qzzWoJPvI0Kk4zg1aS6MlBR8XetTOuVbdhePcLpBQIJojsVc9/vS1GgPy53owYnkI?= =?utf-8?q?htD545LtT0PkV+dVQPF7ZcB7ACnpifnsnRY7QHmhOPJInh4VqgstKW/yxy0X6Bm+n?= =?utf-8?q?lHg/+9lqmUZ7TmgBWCAlFNaTo1SOHomaQj4shjOF9lJpHXgy3l7XPUlBiZwpfpxSa?= =?utf-8?q?Aynha3Awg3uuL0vnSrpG8w5+JcDQ8ObLchfuiribtOkhqnG2hl71I8yJFfbQDMQg1?= =?utf-8?q?GlztICjCZsnz?= MIME-Version: 1.0 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: kCaCHYa+LR+l5i5vDkuCZqc3ezmgHoxlj1WBX9WdSTPdsx1oc6nqR45h3fDZtn88HDjeFqSDxbWhi95mQC/YxdPJELbfBsJoHh4/awc+nS5rXqzio8jM6aa1pb6lw8BI+3AyYc4t78pfQBvcMooYZ0hOiujBI+4WsH1bJtDbKN7ZO7Nk4XLy4P8vCzNehg7/mMHJXhIrQ3qmqfjLV9KvM1QnlOZLEfSTMUpS6TSkcmPCLFa4LVNJ75R7wydRekoCSNwW09wg2yS5DBQz7Sd6hRrcaZiYi/abogIKWx1fx5spZ8TSCcTFqPS2xfktvedpU3LuVHMZBd9pZO556ehC+bxydqOMwOHrL8s9SBVRZlSF+hZnNxiMX1G57+fSa1sVcuU8z5lOIvhklL9P7TaCCcthaF5yG3i2KSn0/Xyv+bSIzMIVWyPBx5A4ocQzQ3PfwzKwKhU75uvNbcABYVTyeEgV6sCSt11FDp3noLA7ErLEzQhvq9dlZ6wbse6xxkvQgG+zg/c2z5h82QTKdiiaLp7GRCmr74OURhdMAc2dYg64jJDDKS00bqKA4cQ9qFS3IPuGzNzqkGuI5uQgX6havOrXL4I/MjDMbikOwNzLHfWNO655K40u4HHpNfPLy2jvMzJk/KhW0Hjd3OYAD/so3e25MXP2I8Wdjb7/dmhC8mWixm8rm9WVv0bGubXxlNjoP9oLLcQeJ3ZVakO/a2J/t0s0B7nYqv3GGqEtvfhiNRWbrQbVSb3raQxeyxchq/krkv/gurB8yCGRj7SwJOR3rxJ0FVKj0a2Xq1wc/VnS76MpzOGm4gtzgSmLCUsJGR+YPnqL0gamBfD6tllXobTgSXZwNKeTZa7y3pIXdQmwAQeQicGbEmW62pY0SM5efu7o X-OriginatorOrg: sony.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PUZPR04MB6316.apcprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0bf6b9a8-5f3e-48d6-2629-08dacde6c40e X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Nov 2022 06:40:24.1624 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 66c65d8a-9158-4521-a2d8-664963db48e4 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: wuLJLDTRCJtvo82xcZvB4/8nt58fcefY4UZiPZpTyEr9hr9WBS62t+s1i2Xjz8cERScS5G7U3r3lpuJolwlIuA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SI2PR04MB4425 X-Proofpoint-GUID: ELW1dhsxZXR2tZ7Y-KoLyvFXVq2shLTh X-Proofpoint-ORIG-GUID: ELW1dhsxZXR2tZ7Y-KoLyvFXVq2shLTh X-Sony-Outbound-GUID: ELW1dhsxZXR2tZ7Y-KoLyvFXVq2shLTh X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-24_04,2022-11-23_01,2022-06-22_01 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE 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?1750359172327117847?= X-GMAIL-MSGID: =?utf-8?q?1750359172327117847?= In normal, there are 19 directory entries at most for a file or a directory. - A file directory entry - A stream extension directory entry - 1~17 file name directory entry So the directory entries are in 3 sectors at most, it is enough for struct exfat_entry_set_cache to pre-allocate 3 bh. This commit changes the size of struct exfat_entry_set_cache as: Before After 32-bit system 88 32 bytes 64-bit system 168 48 bytes Signed-off-by: Yuezhang Mo Reviewed-by: Andy Wu Reviewed-by: Aoyama Wataru --- fs/exfat/exfat_fs.h | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) -- 2.25.1 diff --git a/fs/exfat/exfat_fs.h b/fs/exfat/exfat_fs.h index a8f8eee4937c..af55018ff22e 100644 --- a/fs/exfat/exfat_fs.h +++ b/fs/exfat/exfat_fs.h @@ -9,6 +9,7 @@ #include #include #include +#include #define EXFAT_ROOT_INO 1 @@ -41,6 +42,14 @@ enum { #define ES_2_ENTRIES 2 #define ES_ALL_ENTRIES 0 +#define ES_IDX_FILE 0 +#define ES_IDX_STREAM 1 +#define ES_IDX_FIRST_FILENAME 2 +#define EXFAT_FILENAME_ENTRY_NUM(name_len) \ + DIV_ROUND_UP(name_len, EXFAT_FILE_NAME_LEN) +#define ES_IDX_LAST_FILENAME(name_len) \ + (ES_IDX_FIRST_FILENAME + EXFAT_FILENAME_ENTRY_NUM(name_len) - 1) + #define DIR_DELETED 0xFFFF0321 /* type values */ @@ -68,9 +77,6 @@ enum { #define MAX_NAME_LENGTH 255 /* max len of file name excluding NULL */ #define MAX_VFSNAME_BUF_SIZE ((MAX_NAME_LENGTH + 1) * MAX_CHARSET_SIZE) -/* Enough size to hold 256 dentry (even 512 Byte sector) */ -#define DIR_CACHE_SIZE (256*sizeof(struct exfat_dentry)/512+1) - #define EXFAT_HINT_NONE -1 #define EXFAT_MIN_SUBDIR 2 @@ -125,6 +131,17 @@ enum { #define BITS_PER_BYTE_MASK 0x7 #define IGNORED_BITS_REMAINED(clu, clu_base) ((1 << ((clu) - (clu_base))) - 1) +#define ES_ENTRY_NUM(name_len) (ES_IDX_LAST_FILENAME(name_len) + 1) +/* 19 entries = 1 file entry + 1 stream entry + 17 filename entries */ +#define ES_MAX_ENTRY_NUM ES_ENTRY_NUM(MAX_NAME_LENGTH) + +/* + * 19 entries x 32 bytes/entry = 608 bytes. + * The 608 bytes are in 3 sectors at most (even 512 Byte sector). + */ +#define DIR_CACHE_SIZE \ + (DIV_ROUND_UP(EXFAT_DEN_TO_B(ES_MAX_ENTRY_NUM), SECTOR_SIZE) + 1) + struct exfat_dentry_namebuf { char *lfn; int lfnbuf_len; /* usually MAX_UNINAME_BUF_SIZE */ @@ -166,11 +183,11 @@ struct exfat_hint { struct exfat_entry_set_cache { struct super_block *sb; - bool modified; unsigned int start_off; int num_bh; struct buffer_head *bh[DIR_CACHE_SIZE]; unsigned int num_entries; + bool modified; }; struct exfat_dir_entry { From patchwork Thu Nov 24 06:40:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuezhang.Mo@sony.com" X-Patchwork-Id: 25332 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3227593wrr; Wed, 23 Nov 2022 22:48:38 -0800 (PST) X-Google-Smtp-Source: AA0mqf755E+tiJreMLi39MNcrHZF7696CAaQ0BDYk53mhkQkKIh5GjmTCGMPqsRQXM94DTRFkWW2 X-Received: by 2002:a17:906:be9:b0:78d:3e11:1036 with SMTP id z9-20020a1709060be900b0078d3e111036mr27258816ejg.76.1669272517928; Wed, 23 Nov 2022 22:48:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1669272517; cv=pass; d=google.com; s=arc-20160816; b=FPdLBB75IcHq9O8OnHkx9Czln/DUGkyuzLMBbI7hAe99KSHjZkOA4+r7aWOY8uaD34 RE1RAucaVJS/NhuAjjqwPvpu1ThRv9QI1gMi1SI7v2LM9gurTFWROhYIqG8DjgY8UW4z qkFlBTnoajLoY0g4Fd2gB6Xb/BAAUo6dG3lSPQX4HLRfXqJU4bq/jAOAN2Qma/ByMZAK 4+eFWRSAhULKn/m+5rGJ4kqGOwfg8Ytw5tXlmoR7mPyQ/UoKd35Xcf0XqPEyFJtAxwzw qvF25yJId/dMow9RIJu+/zsOGq3YMmWNr9vVRiHo6g7CzZiLNPQxz3PXDOB+L2UlieYn SXfw== 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 :content-language:accept-language:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature; bh=pJVCAmP0s0O5+5cQJOmo9S9CUSSws59MxuYtNmRRfww=; b=wJgQGJCUX3FoaPU9c4UGy9nbXU7SZ8j4dbXZXw7uX/nTRpWfT1eGLlmqxPdOn0woiS RcB6zwk01Ii0zFgSdCtXsJyDLXsSpXde4eSwFM1Gr/d8C1C+KL9FHvYG/pPTsEsbx7rQ 34ACJ5uHt5bn+9mYi325/TigOfzMrTsgEMVWUfv+FVjwV1jlluyURtJyby2CmgCcSa3a 7sakEiSoBCOjJVsT6oLfCib4cBnoi8eNjqApSfHHK3wGd58f8n17NqIZWFRm/t8UWNRN h8nBLSxF0QNWFlroaeiZ3r1DBhLJx44zZ8oKk4JdSQJxQEo+DbSGXIpp8+eEIFNgix/h BIOg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sony.com header.s=S1 header.b=beIr8b08; arc=pass (i=1 spf=pass spfdomain=sony.com dkim=pass dkdomain=sony.com dmarc=pass fromdomain=sony.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=NONE sp=NONE dis=NONE) header.from=sony.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id us11-20020a170906bfcb00b00771d781fb88si150413ejb.411.2022.11.23.22.48.14; Wed, 23 Nov 2022 22:48:37 -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=@sony.com header.s=S1 header.b=beIr8b08; arc=pass (i=1 spf=pass spfdomain=sony.com dkim=pass dkdomain=sony.com dmarc=pass fromdomain=sony.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=NONE sp=NONE dis=NONE) header.from=sony.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229729AbiKXGk4 (ORCPT + 99 others); Thu, 24 Nov 2022 01:40:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229552AbiKXGkv (ORCPT ); Thu, 24 Nov 2022 01:40:51 -0500 Received: from mx08-001d1705.pphosted.com (mx08-001d1705.pphosted.com [185.183.30.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 661E5DAD17; Wed, 23 Nov 2022 22:40:47 -0800 (PST) Received: from pps.filterd (m0209323.ppops.net [127.0.0.1]) by mx08-001d1705.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AO4TqwG004002; Thu, 24 Nov 2022 06:40:37 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sony.com; h=from : to : cc : subject : date : message-id : content-type : content-transfer-encoding : mime-version; s=S1; bh=pJVCAmP0s0O5+5cQJOmo9S9CUSSws59MxuYtNmRRfww=; b=beIr8b08nm4ozljbQqbiWeup1QeYEVii+BdjOnAwNkXa5jqMOm1sBimZBqZrjdKOL30w lyUy6DWP8oFMoi5Lyz26YIe7iTo5mqVhSvS+7mRCvAz4BekTxn/iXIwqpzrIV1crs2Hy J6idPeu0QmanEBQ9VPdFMfIAgqHyO45rF4a4gizo1I7MEKPdyvkZbtRuW8Sb3TUksA26 NVBxhfqJdN1W/EUePt/iT7rwgKlVMxnM0tyoNQ9fH23nZokg5JH9dvIhTL1XvY5eqynY BVCGJM9tRq505YWLr0Ql98KVFkqw4h7KfsIQoVxLsv5YW2vAtO+HdsmnvPDJqQX3ODE1 /w== Received: from apc01-tyz-obe.outbound.protection.outlook.com (mail-tyzapc01lp2047.outbound.protection.outlook.com [104.47.110.47]) by mx08-001d1705.pphosted.com (PPS) with ESMTPS id 3m1c0a95n9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 24 Nov 2022 06:40:37 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c80e7hI7MICrJKRIeO6HP3hgIHIjb2aYF8I8GDepvKGrSriRQuOfCgpUic62fbUbT9KKIwWTFCHzjltw6ornuAYHlmru+wUvs2iE/lcCSfUM+eJl2iz14j3QMG7sagwxDf+tCYWMK3HIQbn+r7VUwPUeyTZSllXlHccMwdesWWDofTFAta1agDodSgaRz/VkaXguIzgfny34eLuRalGv4x08xV/awzfEObb+rJHLDhnqSywsGMz7kfKnUdQxj5TayVjcf9VMSclovZ6MP+tKqm2nHSsbt4HZbLrIFzAIhNmptnLLBv6MxnKbpDYnRYBQ+Vk74Tv22Ka/9tNER1mk3w== 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=pJVCAmP0s0O5+5cQJOmo9S9CUSSws59MxuYtNmRRfww=; b=VtOTr+j+LfovsXsMFGrIiigwAj1c7QEt+RpT+rdkdc/JfZ5Qr1K24ibSYpkEOOLEtDzp0o//ZYHGCruMQIs678gbsqngMAOhBUzgmv+mMyO0QE/3r5t5tp2BQxSdcEVmkRXzr073JsKDqw8Rfj9LWXn7oBWiHOSwMpeqxpADUEkfG77Hw333n9Z8gCY95v3DcqWFA45qeEu0U714unpWJ6Ur88Up8Mxa+Akr9uz5LVI8cRni064VtRYewd/+RkSIfLmjvfa8+eERuCLk4I66dDuXN+KcoEdh2wJ7RqY2AA5lgqYPzvIoMCwP425rNhKye2WzyrTm6yaOlQuI9vx2fQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=sony.com; dmarc=pass action=none header.from=sony.com; dkim=pass header.d=sony.com; arc=none Received: from PUZPR04MB6316.apcprd04.prod.outlook.com (2603:1096:301:fc::7) by SI2PR04MB4425.apcprd04.prod.outlook.com (2603:1096:4:e8::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.17; Thu, 24 Nov 2022 06:40:31 +0000 Received: from PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::708b:1447:3c12:c222]) by PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::708b:1447:3c12:c222%8]) with mapi id 15.20.5857.008; Thu, 24 Nov 2022 06:40:31 +0000 From: "Yuezhang.Mo@sony.com" To: "linkinjeon@kernel.org" , "sj1557.seo@samsung.com" CC: "linux-fsdevel@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Andy.Wu@sony.com" , "Wataru.Aoyama@sony.com" Subject: [PATCH v2 2/5] exfat: support dynamic allocate bh for exfat_entry_set_cache Thread-Topic: [PATCH v2 2/5] exfat: support dynamic allocate bh for exfat_entry_set_cache Thread-Index: Adj/yf3EdbTZ4lxGQLaYPoSH9Dr5Mg== Date: Thu, 24 Nov 2022 06:40:31 +0000 Message-ID: Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PUZPR04MB6316:EE_|SI2PR04MB4425:EE_ x-ms-office365-filtering-correlation-id: 83912b38-a64a-4c54-275c-08dacde6c850 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: eyYdtDe8Z9MaRIY7evzEYyQoKYLiGoQQ8PrVldRWs+FQSPK9ExtcMob4xR+AezfKqQJGemmzV0KGG9MSrmM8STT/1d3Xf2CVHv82kduevuJaKxSGHLr0dSIfxWx9JD27u+2jE+1sgI+cqI2fCVUaeH/lYdk140ERoOuesltZcIRSTG7rcXilzO/VW9IWaFmukiPKF05Z49NtwBSmn6RC4AIYy8E8vjMltzkccsEbgNu2B/NH3eO2jAWOOyoNW8kZIczLSAMO+DzdxuuChEG/Wrw0FkypohEHUZbq3Xw6Co2EZLCC4hTDf+08IgBla9q4t6NcbSZLenKIJH4eqRVu4HnSTUKPCw7ogN38PWyD6Y4Tb7JlsbAs2uXtfwae4UDR1N11M9udz48KPo7nGe+9E97NJaeKpRaairaQprpupJ2ouhVsBiaMu3ln+HJEcYDzP9ndkuojDrm2EO2DFyOCmCWjQUR95D2vlpewanPI8W2qvK4vSn/lo7nRpkzVJ5dIsTzJYpE7xFxYlXh7sJMh/6QQ94vmi4pCpmFdKPOQp028+fJRxcnsVKFyzO1KxYocB/9JvV27mfEFfqzh7rlCsFsJUmIHVCRmxsUSNBe0lxaGP4XYEszV+6qNqw8/sNqvXCHQCtDHFevc8FDfv829vLN+jnIeO77ILCf5TqK8588mCsLJd0Wi0ghRgqQVt7KLAjjsLL06/38erxz81ZDiFw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PUZPR04MB6316.apcprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(39860400002)(396003)(366004)(376002)(136003)(346002)(451199015)(41300700001)(8936002)(478600001)(54906003)(4326008)(5660300002)(316002)(66556008)(66476007)(66946007)(76116006)(52536014)(66446008)(64756008)(8676002)(71200400001)(107886003)(2906002)(7696005)(6506007)(9686003)(186003)(110136005)(122000001)(26005)(38070700005)(38100700002)(82960400001)(86362001)(83380400001)(33656002)(55016003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?R4w/F/EDNVkgaDSA9cCJWa3NAtu6?= =?utf-8?q?5a6EzEcyrzT/koas0PWINUS8UMAvw7DsuVhr9u9FX7o6jzgWmaQ/0JOSoSGFUnNHZ?= =?utf-8?q?j9Ufz39oY4xHWHiIRYuppTS4Jg5NtvVEJ3XFTIB8rqofKP0C+WydMqq81SuT9pdwT?= =?utf-8?q?xVlnuOZiPOUYvFLm1vmqWrlxL3gD2lk2daVSNJ+FOTSx3NJrCWxmbFmYXM3icTNGG?= =?utf-8?q?EAgE68by/OKdY6V0kH7Tg0jsUCD2aH1lkt2NUgqAtPavsY+KlUQluftXcK1Gz3UbR?= =?utf-8?q?6bxLW6QPJcWL2Xp9F5vIfbQ5aAaRqvNwyjYVfgS0m3u/i6xtUa1p9NS2airj4ScK9?= =?utf-8?q?I++MgLLVBuIVoaMpabUEzB47KyS0POrJ22Jd7V8ZcHrp6ivQJf5qq05K2q0saZ6uz?= =?utf-8?q?PBvLFNzIeha1aoB3DSMs6fybNtNIgs6ayp/XGWl7+YBJ+WyvuVOLTJiIyl4FYr4FD?= =?utf-8?q?IzKnyfx6STYHluBYAzftkf7hUcSiRmCPlpHQzahrk1izCMGQ5NDxR/T8QQNFnEg1q?= =?utf-8?q?InXLcUCU6gtqfAlazUkYhdlLmBd1yNblgQ4U9hzxqOcE8lGL7olrqcC31K5tSH//Z?= =?utf-8?q?mCaT0gR4BXyurHeIIUA6tY8jw7nDTyLTkJcFrvjUc2sv1HFlYxiK+xMCv6QvRC++U?= =?utf-8?q?5xsHrRRbtdAccjv+ggu8vRfa2VWghcvtnyVRrHVcBBjlnxkC7dDM4bZY8c75J/5vY?= =?utf-8?q?GmrcAV7pXEahPQPlNXYSTASjOgGFZFpqVXP7G2gn55QRdRelKX0QdtlBrCWCTT2iB?= =?utf-8?q?T5P7KcCT8Az/xQ/1BM3Ag5+ImkBTNPeYSOyPQRoBzt5oYVZDXtjsZ/PVBwvpOGPbk?= =?utf-8?q?5jUQbWgvd7aZ4+MhcB5jKQesJIiOjG8wzsvCoNgKiaI6g2z4wkGAEStIj/xDFxlRN?= =?utf-8?q?MSmv6XWODYEqtyuo/el1UobyszzLZLHG4gbwy5emR34Z8wfSPdcXUir8cF/S6Sciq?= =?utf-8?q?EUDv6ARcIjCElrj1NhF29mbs9Y6nfugsD0DzrD6m9f/LFuTQg6Wzf0b0J63krY3IS?= =?utf-8?q?2/lSKYoX0/OzScOWKf/jCEiPehGXbx7TEztjqTvHACCT6lltveh9gFZ6mscSHO0IY?= =?utf-8?q?dm/7J3i1aYcdTNLGbdgASvhNLOpsERg6C4XE4yNoot8bqTElJL8BgbxK1/d9aYc+B?= =?utf-8?q?SgTfo74c9eFAlOhMmkHo+hIpbuRH2t7ZfpzCT/tFEbOLyFDUlRgIz5cWJZ4WDunsG?= =?utf-8?q?abDCYaP3NH430gaZFQDpjhDQ7ozLC9HXpHC/LJsS9mr05tEU8BqI74Pp19+75OTYJ?= =?utf-8?q?Y6hrWgcASLRD3s1+la0JGsVrCHsk7H2EkLWocZJkosZRKV8su1zrhPCAbUofTyc4V?= =?utf-8?q?DHsHhO52DIoUlgmXjBatNqJyvtu/QStKTB4z9k5GXXUQsZzd5j72h3FhTJmOo7gBH?= =?utf-8?q?GgtmY8PvxdWDqdEFRoghPPVV5eKePQ9nlYBWQS66viAsTbIYQDdDcAtXpC22iRL5y?= =?utf-8?q?LGjx1ym6VsFHPZpSKV2dn/vad9TTeIeI5JYCSgfptOBmQ4ugIayyeI/ie3/29I9Uf?= =?utf-8?q?jGf/bAsp7mqz?= MIME-Version: 1.0 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: SCit4Jp3R29+J6ukskENF3aB8Mfzuc9FQE+X6hw+x+OaPEGCuHByItVXLRN53i5WmNyZ0eVyYL9zh894kV+enSGkw373j0GcuN5Q5NNc+GWsM3EXKEg167+U4FYFwBwPJyWiEA0wq1FDgqcyOXC8XuRj8UKJOBZAntnYXn90FYl5XbWUXGoS2ZOdpecmllvpMHqyFNJDVFNuAQyXYvhMOUQY470icRhIkg797GzlaFNUlIAATSrt9dTG673WQ9QhpKuJtoSqLgz4YSqIrOZc/QkoaBIALpSRssyRYo2wNlub5J/t/vdmY23zFbsA87StuhbjjYIExYVbQ8sFa5f7SqHscXB7L5N/caRQtu7v9RfmlgN+NxatsLieqneU3SkUZaCzJpS8L+xvDofIs9eUdTdxI29cqa1VZPdh9gFmKqxvqs4aXef9/5MzPFkUVbhI8+AdIDwoIp8Ird7Iyd5Tk14RmTm+E6WXs6LzI8gTUcfKxKHVBThbVEiaaJazFwSem4+FwJb8Apb2GsDRFoT9nlGk8YV6W4vB8KoTVVkd4bh6EFrl0NvNMQuOAwDiqxd8yCkV0VWUonbzB72qFFH+twV8h2deGi9dwAjhX8Hzu46Tpk4euHARaWn/c7FUzLmN0ySjYBBDA69q9eokS0yAyI7JTCvt+8i3QMYIN/md9uuCl6V41vO4y3f3b5/ZZydHQ1+uKPST9I4qq0LC89ynIsudh1BLukdcmxngR3wR9DQzC0hcSeyI61HJlFCV7g8XkWCnKb3iLBw2jFuLffJpVpe1sP+DZa4vz103B2pbNzzXZrtVxduFA7FdabDPM/tqN5VXjpr/5yC3dnV/uxur0WTns2z8Tl4zDNDunts5WT7MFf7y4Bwb4IpKOe63VhGs X-OriginatorOrg: sony.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PUZPR04MB6316.apcprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 83912b38-a64a-4c54-275c-08dacde6c850 X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Nov 2022 06:40:31.2589 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 66c65d8a-9158-4521-a2d8-664963db48e4 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: SQVrjfBOva3e5nRP8mHu3azsa2E+f1OLaMCz2mYGzjmenn6vF2lNmrhstliVqLUhywvD7UEyCF6Ax/80ye/e7Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SI2PR04MB4425 X-Proofpoint-GUID: IN6SF8FGayMl0tUn_DzfGR20FF4dH4Ux X-Proofpoint-ORIG-GUID: IN6SF8FGayMl0tUn_DzfGR20FF4dH4Ux X-Sony-Outbound-GUID: IN6SF8FGayMl0tUn_DzfGR20FF4dH4Ux X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-24_04,2022-11-23_01,2022-06-22_01 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE 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?1750359099498227371?= X-GMAIL-MSGID: =?utf-8?q?1750359099498227371?= In special cases, a file or a directory may occupied more than 19 directory entries, pre-allocating 3 bh is not enough. Such as - Support vendor secondary directory entry in the future. - Since file directory entry is damaged, the SecondaryCount field is bigger than 18. So this commit supports dynamic allocation of bh. Signed-off-by: Yuezhang Mo Reviewed-by: Andy Wu Reviewed-by: Aoyama Wataru --- fs/exfat/dir.c | 15 +++++++++++++++ fs/exfat/exfat_fs.h | 5 ++++- 2 files changed, 19 insertions(+), 1 deletion(-) -- 2.25.1 diff --git a/fs/exfat/dir.c b/fs/exfat/dir.c index 30d0ac43b66c..03e9c9e3966e 100644 --- a/fs/exfat/dir.c +++ b/fs/exfat/dir.c @@ -615,6 +615,10 @@ int exfat_free_dentry_set(struct exfat_entry_set_cache *es, int sync) bforget(es->bh[i]); else brelse(es->bh[i]); + + if (IS_DYNAMIC_ES(es)) + kfree(es->bh); + kfree(es); return err; } @@ -847,6 +851,7 @@ struct exfat_entry_set_cache *exfat_get_dentry_set(struct super_block *sb, /* byte offset in sector */ off = EXFAT_BLK_OFFSET(byte_offset, sb); es->start_off = off; + es->bh = es->__bh; /* sector offset in cluster */ sec = EXFAT_B_TO_BLK(byte_offset, sb); @@ -866,6 +871,16 @@ struct exfat_entry_set_cache *exfat_get_dentry_set(struct super_block *sb, es->num_entries = num_entries; num_bh = EXFAT_B_TO_BLK_ROUND_UP(off + num_entries * DENTRY_SIZE, sb); + if (num_bh > ARRAY_SIZE(es->__bh)) { + es->bh = kmalloc_array(num_bh, sizeof(*es->bh), GFP_KERNEL); + if (!es->bh) { + brelse(bh); + kfree(es); + return NULL; + } + es->bh[0] = bh; + } + for (i = 1; i < num_bh; i++) { /* get the next sector */ if (exfat_is_last_sector_in_cluster(sbi, sec)) { diff --git a/fs/exfat/exfat_fs.h b/fs/exfat/exfat_fs.h index af55018ff22e..82395ae80dba 100644 --- a/fs/exfat/exfat_fs.h +++ b/fs/exfat/exfat_fs.h @@ -185,11 +185,14 @@ struct exfat_entry_set_cache { struct super_block *sb; unsigned int start_off; int num_bh; - struct buffer_head *bh[DIR_CACHE_SIZE]; + struct buffer_head *__bh[DIR_CACHE_SIZE]; + struct buffer_head **bh; unsigned int num_entries; bool modified; }; +#define IS_DYNAMIC_ES(es) ((es)->__bh != (es)->bh) + struct exfat_dir_entry { struct exfat_chain dir; int entry; From patchwork Thu Nov 24 06:40:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuezhang.Mo@sony.com" X-Patchwork-Id: 25336 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3228508wrr; Wed, 23 Nov 2022 22:51:44 -0800 (PST) X-Google-Smtp-Source: AA0mqf6vxsxmPdySeW+oNPZlHOi0M/UYfLbYHM4lekxrhDIXH+WKbuGiaGqis43rpqCZw/f6pDYP X-Received: by 2002:a17:90a:b018:b0:214:247a:1932 with SMTP id x24-20020a17090ab01800b00214247a1932mr34410277pjq.187.1669272704010; Wed, 23 Nov 2022 22:51:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1669272704; cv=pass; d=google.com; s=arc-20160816; b=Th/xe0pTHOSf64q26L/FkJWJnhABjOQQLSrWeVs/dS/3JnieOTIW2NsknL7TYXzWPe zA1b7nCA4ltXpZdh0cvg3XUgJ/m7YdQDpBytOfooePlMEfoMtAjmerO1NtlfFH4+pRcF tB6bQ7Ln0Spu9hb983WeVxBzljaF2ne+NcKcwlDyxSo7E74An5o9DmpafyzyciE76sk5 DldBWapAcTkmRcdOQmO++lWuMzQN4BqYJ7Uv7Avjtnqn0URpHQZAB+FG7jEkQVwcCkLx EyXQWyMpJr3Cj2sXz2n2ungVfEpKO5ibax7JfssK7WTJAplMGxolDhqFQL/G65R9gGbV 4hQA== 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 :content-language:accept-language:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature; bh=4u2VKImAFFv09aIunLnKbzEBJZa0tpGKhdfbX0Ei/9I=; b=HzpyXf/dZrLli+uz7xu0PzRGQCE1ML4bCinmWuLAIfK3T597S6LazLd0qrje8qYIw6 tTeX1WsyQc+V9nBh/71GBGYjLo0Mfuu9GJgHJ6r961MZO3hySy0A7eTKKdOpD9srjISG qCJijDnXmD0F0eTip/GlZcnG62oPlCkJGBkvfcagHqMO/sPR1u19W28XkvymoBKhBjgM fPa4HZ+WcjbQ12/bU1BqxxJNBHDUTsW+x8+imISkJy+mSVnOLVKPPrierKmzZ3tmuGB0 rXVV7Vh8tH0wem6Dfww88X4JLUUhbw+W+DUnhHM3KjMTQU1oIvuHMNH18ulx1bsDZD+M uRWg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sony.com header.s=S1 header.b=IAHt9v6h; arc=pass (i=1 spf=pass spfdomain=sony.com dkim=pass dkdomain=sony.com dmarc=pass fromdomain=sony.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=NONE sp=NONE dis=NONE) header.from=sony.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y63-20020a638a42000000b00473d2c2c06bsi524573pgd.423.2022.11.23.22.51.30; Wed, 23 Nov 2022 22:51:43 -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=@sony.com header.s=S1 header.b=IAHt9v6h; arc=pass (i=1 spf=pass spfdomain=sony.com dkim=pass dkdomain=sony.com dmarc=pass fromdomain=sony.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=NONE sp=NONE dis=NONE) header.from=sony.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229758AbiKXGlN (ORCPT + 99 others); Thu, 24 Nov 2022 01:41:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229724AbiKXGkz (ORCPT ); Thu, 24 Nov 2022 01:40:55 -0500 Received: from mx08-001d1705.pphosted.com (mx08-001d1705.pphosted.com [185.183.30.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97B06DAD12; Wed, 23 Nov 2022 22:40:52 -0800 (PST) Received: from pps.filterd (m0209320.ppops.net [127.0.0.1]) by mx08-001d1705.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AO60PRB030928; Thu, 24 Nov 2022 06:40:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sony.com; h=from : to : cc : subject : date : message-id : content-type : content-transfer-encoding : mime-version; s=S1; bh=4u2VKImAFFv09aIunLnKbzEBJZa0tpGKhdfbX0Ei/9I=; b=IAHt9v6hNJlFEnZXF7bVFXMF+tqvxU0nGRQEeQedpjCR+OZxp82khuLn2h6HbjrxYarl LpfiaiQyn31u6qbG8/Ii3S5d8qQbV9HeBY8Ch0UKA1MSb+YnSWLlpQIiNd57NxSX6uHM 5AqHEY2EeTlDHPib7C0qls0vDZE0tsA1cQ4wX9J1kiRib9TlsRpU1LOvE3w2XLcymMrB gm5KtLzq/BGFIVYssoYMa+OdGr0M1Q3iqOavA9lkUXZY0y61+EbP3KBb+TZ5EWK4GrAB XxodyvWmcRNteOIqOYs6xbB2Tj3nTQPSYwSaAWIVjp8gIGAgHYm00CtpALDERQhDDuJx pA== Received: from apc01-tyz-obe.outbound.protection.outlook.com (mail-tyzapc01lp2048.outbound.protection.outlook.com [104.47.110.48]) by mx08-001d1705.pphosted.com (PPS) with ESMTPS id 3kxrbxct8b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 24 Nov 2022 06:40:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XspQOXov/SlJOjlVjfJ0uCU4CaZkdmbPR3OFN7NiyhKcXwA4WixhauNO1cpKAPXT8SVUUxpR6gRn3I365XJD8OhH2Nix6WNkDw64nRIiK6nWVCC51TzF9yWNr9SwH2wZ7rr+00zbHaWdAUKPrf11Irs6mM2pArxeKzff/uzRoWdxCIApBmUYh8kD7+cxr+SLCIhoXCZojkREm617+TJtf9AbuIOF+HodW9Gmg32hiTk1eLyaXTvoWAXwykj3DySwAxOwoMoC60Mwz1eyPw1JFKnxXnyWu2s7S6dd6e3qrU8VFOdBlEcv2W2SU2t8od060qebOnESBM9kcaLYwQ/FKQ== 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=4u2VKImAFFv09aIunLnKbzEBJZa0tpGKhdfbX0Ei/9I=; b=CzjKTMDi2oaSk9kZHhr5EADWShEen+dbaxVSZxYg9qTO7iFEaENDOqYACeFYRMO/jRmil9YY9N/SP/pmMaHFBR52F04q2O8aLo1+yQXJxkgjr2A1Vorx3+YmufoqQf2JikOeh50FzQX0M9A9RBey0YLPnCHFhCON0YIBTDA86AinSDHhqciWG65Cw3KqukXBLArjg1U6OYI96vokkmbh48TiEOy8zYO1fajxGPF7vi1f+aie083VNkk2FCKQiDU0zTYPIAW1O77iJc7sSk7qPwQ2qqZpdhpcs41DCzS1lYGZ/yusDlLYySRwOydAJYellYr3vCaTjf6f8uH/4/CW3w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=sony.com; dmarc=pass action=none header.from=sony.com; dkim=pass header.d=sony.com; arc=none Received: from PUZPR04MB6316.apcprd04.prod.outlook.com (2603:1096:301:fc::7) by SI2PR04MB4425.apcprd04.prod.outlook.com (2603:1096:4:e8::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.17; Thu, 24 Nov 2022 06:40:35 +0000 Received: from PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::708b:1447:3c12:c222]) by PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::708b:1447:3c12:c222%8]) with mapi id 15.20.5857.008; Thu, 24 Nov 2022 06:40:35 +0000 From: "Yuezhang.Mo@sony.com" To: "linkinjeon@kernel.org" , "sj1557.seo@samsung.com" CC: "linux-fsdevel@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Andy.Wu@sony.com" , "Wataru.Aoyama@sony.com" Subject: [PATCH v2 3/5] exfat: move exfat_entry_set_cache from heap to stack Thread-Topic: [PATCH v2 3/5] exfat: move exfat_entry_set_cache from heap to stack Thread-Index: Adj/zcEFMGFoM64XSySw11PDtCt1JQ== Date: Thu, 24 Nov 2022 06:40:35 +0000 Message-ID: Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PUZPR04MB6316:EE_|SI2PR04MB4425:EE_ x-ms-office365-filtering-correlation-id: 57f2b521-2c26-4a99-1782-08dacde6caa2 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: OVhrEvEV6YSoJjf+vINMdPKWuatMMoTYN0krojKtVaQsXjm6LA3G4aJkfNC6FhV10RiPs0OeOYvTPn3QkvhPiHLFnOaGMI4PHbuA+z1UGIP+FMADHkgeR+KmFtGAIoG5BUuIPCfCQeJ78xcCHvrvoGPphT2qu/2OkhyvuwqM7gg3LPC2UigmLmmmlAon4nqbZt3b2A3UnRpalJKq6EC8vKsESHeZAhnhuutkHHnZdfsjAruj/09ncqyFwoKvu55jfnpAso8g4KWcA1jnkGKv4gN8DBAOMftDukYiRigzFKDkr+nbJDRoxiUrigPj6GI364uLtF2GQEobkhPOqfVy4MiZnOf4ViVg56KwyhYU/vt86s2MCzZTyPXL1/+rTFYEv19KHyMMtsxjtlr5K7zDGQBOhn1mMisuxB9uBQC7ngm/mrvhlmyBFGhLsVmZdPAuA7681sUJxJptc+lzA2eC8/F5Slt57O6YhhkTbx7fVW8I4aLOdJvOaUY2wzAQhzVK2JExn+UnxHYakeBqRklqTxpLIx/lfL8486QkSBsJg127t3NL6H3I6bv87ykXvOtJoK1iBh9ttWzGTn4n04SeVow2dfTswLHlzflwy4bxfH4B3qyxPa+Q6qiKxTBjS1xx6NtEfrPM9OTZqSHwMZZO1nyGgTYBbMYPHzcW7a28oHl/bXg1jwV0UnGkac3eATWUza3MPE43+10KDyW2u58zkw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PUZPR04MB6316.apcprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(39860400002)(396003)(366004)(376002)(136003)(346002)(451199015)(41300700001)(8936002)(478600001)(54906003)(4326008)(5660300002)(316002)(66556008)(66476007)(66946007)(76116006)(52536014)(66446008)(64756008)(8676002)(71200400001)(107886003)(2906002)(7696005)(6506007)(9686003)(186003)(110136005)(122000001)(26005)(38070700005)(38100700002)(82960400001)(86362001)(83380400001)(33656002)(55016003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?crkWGBElfEEqOEDmO3YO198/atFM?= =?utf-8?q?HZX9bMfFYzR15sl0ITnBfOWSyyw/prwysTjhydyvTiNTEpHb5SFIovtxzoC6K+HtA?= =?utf-8?q?uqqGdsMK+F7vDzAtmfUJI7GIpPs80HppfZzQa/6VUMAvibMnU0ahdtPYWkt3jTBaV?= =?utf-8?q?eDKCcIhVyn69MaALzO9+VbiPOMBGF6J9ZLT1wA5Rew8N2hQZx9tGqyp7nW3J6lJdd?= =?utf-8?q?Ffp/SLlsG1wa+M3+67qSicri+vmt5n/OzD7r49Y/H/UCEhVCDmP9RymXsOrqJBeq3?= =?utf-8?q?WC8B4HpFo5fxrMwMy+zDZVOqFgkIsiXwG18iBWFuzoud2PAaTTnKFqJb4rqu79y5D?= =?utf-8?q?dpD298n6NRWsS6FkIALQE78D/VlhBD6KwU5Tdbk2pZj8l/kdckIGht7B/aAMokiUu?= =?utf-8?q?tiX4foWsdGrxsZQUff9nzM3eQ5hXwTZJAtxbD72GVsKiW0HobIp5zLO2Mdlt2F93S?= =?utf-8?q?hJ4eDSkj5uhpp8KYzlD3roVbUWAwPMAhbRw7SSnnSpbjOt+TlwJleUJYU2uQMxmCM?= =?utf-8?q?ULsH9qZUC8v6sRnRA4KVSLQy38yWQfoqOaodM3J06nvtMMrJKBzFCrQk6EYt2I7e7?= =?utf-8?q?B0VPkOn4dl6TbULUPT4IedOhOjfy7iAxBKp8FpU5O/4hnecSPiyRcflfk9EKurK28?= =?utf-8?q?+grZ/qDRY9kUihPrQiUBo9UgkOccU44wVF/RlWw/s4GxQYvoqsP+/OMmapVRizSLq?= =?utf-8?q?HAzfDscBHW2B4YZQBSUd15rrIgGwwBlqM0TkxzTpzp75c6r7b+jM2UkKUq/aIQ8Cr?= =?utf-8?q?7lmxhck9PLhLpBCnA5nKE7TS7WHMr9LdPqujbHkySdctrFIkKTDjViVr6dojNatY9?= =?utf-8?q?ZrnRIE5SCImBWQ/YVg4VT3VwBYXc5ACCY83R669ZOHTZv279xTlKC+24B3oNdpt8U?= =?utf-8?q?EzXGvlHmCS+b+SoiUqF4BpnmZsdUnWsuY/gjUlTXNRPsTKL2sJW+Iues3egqcOfmh?= =?utf-8?q?px/xC9RaEflZakJJII1TUCW8cPl6vMxE9ZOBFDb3NBAHcEP5vVHjEoh5Dy/a86GWM?= =?utf-8?q?Lq14HKlIj0sCgjkhQl8doeqrmGH/wyu8lakV1itFbbItlaMDv4dyA4xgJGiycEvtG?= =?utf-8?q?LdbBNNLWozEpnADV+LU21WFq7xx/3UmCdnC5Bl9M+UrVNDMQmhGUilvBTwqfdaBgQ?= =?utf-8?q?maAUaY4QiFf70c1OzfZdrUtQKOd7IyxjTvc/8M50zcz0oJsDEh+DoEH8lvcZgCkpQ?= =?utf-8?q?I1LNruQz3BAvTSoL7PjhR74G/fI64KRKMs3SUS5zZiI2FoKrO4aLF8VG5VFT6seOA?= =?utf-8?q?VvgmcU58Rs8xr6BbjI29mUuNWWNA9Jp9kIHU4HuEFgJcQ2V14KeYna8qrlc/TumaD?= =?utf-8?q?cncg12B1XbXd+IU0O0E2YG/x9cHAJK0gODWzhaQejTNObDIOYpfHmXrBTqkwb9ANi?= =?utf-8?q?WVKp/D2jVBb1By85njNHt0bTV2FkH5PYYyjOpxqeSIG+PBOIWusoRvVryAF5pYg1H?= =?utf-8?q?XeUMW5mld+227OnylyJ1f4CiUQZsYuFxBHxA7FYt+Pw+0ZL42Wocb5eKj1MvN6w2E?= =?utf-8?q?3g9uJV+nCcsv?= MIME-Version: 1.0 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: VUolqFfNPn8iyYmVuRsyyUTDrDgt6sbiAbfcipWtjP3HKsDqkxaGislJdbCpfRn5KpEExmjLGoIWHJ6kOrGP2o1DDbJ30WdZIOVv6axvXgOV9SW23NmVzy4mnfQL8J7K0qlsjeUiTIAY2gu9yIP98QnolYhSVrV6CGRJlmeqLbrckjBshu5MQfrRN/vwVaIO871R3IzqzT0TYTOHdPMZzbpreukr6Rt9wjMEzsMZ41jZmqy54+fdKxIVGRCE6fKw0gUGm4rAqYnNHwZBlVu32Z3D8HTulUEmuUgCqpnNRNeqZFN1mMWD7LDHYfDwyDMjLaxrZTABwUMu9CuJoOooWtWu2KjV+cT1PCFXAiziFpQtM8PcJR1xc4WfY+tp56SCqwcap/RI4Md/z8rwZ7kv4u6eMudacDSWZlbAC1On3e+ELTpT1pAvJ8MyuaUpmoqi6ByRAH3wteAy0FPIg1E2LtTAJtHGTeeEXJW0O+BJtnopB6+DeZdK+/9SlrIT7b/ud6O+MWznx2ACSqkQor6OKpa2gb5m+GbWDIT/9U1rpft1St7HUlM7E7b6BpO7+jq32+EozKnzhU6XRFkPygbwvXwrGZbhqGBsa8zb0yHBmTCk7xlOpTE/RsBVVzCWWQxYdD030leKDtrDTEyev1Qh1HrYqFu5bZl3XyxfadYU7P2gqkXou3GW/TKdUtH/Er7r421QZeVDNhNFcYyYf7TCpdgoH4vnBal26t0H1nXfj0nSfX8A06axKeSV40nksqGV61aKy+AnSkiv0iqCDHuIoZozCqmQ15rlYVIgFJQUnc+OOfmdqnKUYR5IohpSdNBK1fRt2sBjisTPY9wV3gVSzs4Mg3Nh7YenigoJUzPSZCrQYN4XhaXffeLgq6oH7Btl X-OriginatorOrg: sony.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PUZPR04MB6316.apcprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 57f2b521-2c26-4a99-1782-08dacde6caa2 X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Nov 2022 06:40:35.1670 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 66c65d8a-9158-4521-a2d8-664963db48e4 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: argSsIi2m1GQ8J/5otGPNuOzQ+re54yYow4N8h5S5Dcy1c0quz/6ZUb7JfkDjy3B02RpbwLNbNEYuK3S1woA3w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SI2PR04MB4425 X-Proofpoint-GUID: R6dxHZ5F402yQOiHOFIheE4Ax_T33jY7 X-Proofpoint-ORIG-GUID: R6dxHZ5F402yQOiHOFIheE4Ax_T33jY7 X-Sony-Outbound-GUID: R6dxHZ5F402yQOiHOFIheE4Ax_T33jY7 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-24_05,2022-11-23_01,2022-06-22_01 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE 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?1750359294694301618?= X-GMAIL-MSGID: =?utf-8?q?1750359294694301618?= The size of struct exfat_entry_set_cache is only 56 bytes on 64-bit system, and allocating from stack is more efficient than allocating from heap. Signed-off-by: Yuezhang Mo Reviewed-by: Andy Wu Reviewed-by: Aoyama Wataru --- fs/exfat/dir.c | 35 +++++++++++++++-------------------- fs/exfat/exfat_fs.h | 5 +++-- fs/exfat/inode.c | 13 ++++++------- fs/exfat/namei.c | 11 +++++------ 4 files changed, 29 insertions(+), 35 deletions(-) -- 2.25.1 diff --git a/fs/exfat/dir.c b/fs/exfat/dir.c index 03e9c9e3966e..a3fb609dd129 100644 --- a/fs/exfat/dir.c +++ b/fs/exfat/dir.c @@ -33,10 +33,9 @@ static void exfat_get_uniname_from_ext_entry(struct super_block *sb, struct exfat_chain *p_dir, int entry, unsigned short *uniname) { int i; - struct exfat_entry_set_cache *es; + struct exfat_entry_set_cache es; - es = exfat_get_dentry_set(sb, p_dir, entry, ES_ALL_ENTRIES); - if (!es) + if (exfat_get_dentry_set(&es, sb, p_dir, entry, ES_ALL_ENTRIES)) return; /* @@ -45,8 +44,8 @@ static void exfat_get_uniname_from_ext_entry(struct super_block *sb, * Third entry : first file-name entry * So, the index of first file-name dentry should start from 2. */ - for (i = 2; i < es->num_entries; i++) { - struct exfat_dentry *ep = exfat_get_dentry_cached(es, i); + for (i = 2; i < es.num_entries; i++) { + struct exfat_dentry *ep = exfat_get_dentry_cached(&es, i); /* end of name entry */ if (exfat_get_entry_type(ep) != TYPE_EXTEND) @@ -56,7 +55,7 @@ static void exfat_get_uniname_from_ext_entry(struct super_block *sb, uniname += EXFAT_FILE_NAME_LEN; } - exfat_free_dentry_set(es, false); + exfat_free_dentry_set(&es, false); } /* read a directory entry from the opened directory */ @@ -619,7 +618,6 @@ int exfat_free_dentry_set(struct exfat_entry_set_cache *es, int sync) if (IS_DYNAMIC_ES(es)) kfree(es->bh); - kfree(es); return err; } @@ -816,14 +814,14 @@ struct exfat_dentry *exfat_get_dentry_cached( * pointer of entry set on success, * NULL on failure. */ -struct exfat_entry_set_cache *exfat_get_dentry_set(struct super_block *sb, - struct exfat_chain *p_dir, int entry, unsigned int type) +int exfat_get_dentry_set(struct exfat_entry_set_cache *es, + struct super_block *sb, struct exfat_chain *p_dir, int entry, + unsigned int type) { int ret, i, num_bh; unsigned int off, byte_offset, clu = 0; sector_t sec; struct exfat_sb_info *sbi = EXFAT_SB(sb); - struct exfat_entry_set_cache *es; struct exfat_dentry *ep; int num_entries; enum exfat_validate_dentry_mode mode = ES_MODE_STARTED; @@ -831,17 +829,15 @@ struct exfat_entry_set_cache *exfat_get_dentry_set(struct super_block *sb, if (p_dir->dir == DIR_DELETED) { exfat_err(sb, "access to deleted dentry"); - return NULL; + return -EIO; } byte_offset = EXFAT_DEN_TO_B(entry); ret = exfat_walk_fat_chain(sb, p_dir, byte_offset, &clu); if (ret) - return NULL; + return ret; - es = kzalloc(sizeof(*es), GFP_KERNEL); - if (!es) - return NULL; + memset(es, 0, sizeof(*es)); es->sb = sb; es->modified = false; @@ -859,7 +855,7 @@ struct exfat_entry_set_cache *exfat_get_dentry_set(struct super_block *sb, bh = sb_bread(sb, sec); if (!bh) - goto free_es; + return -EIO; es->bh[es->num_bh++] = bh; ep = exfat_get_dentry_cached(es, 0); @@ -875,8 +871,7 @@ struct exfat_entry_set_cache *exfat_get_dentry_set(struct super_block *sb, es->bh = kmalloc_array(num_bh, sizeof(*es->bh), GFP_KERNEL); if (!es->bh) { brelse(bh); - kfree(es); - return NULL; + return -ENOMEM; } es->bh[0] = bh; } @@ -905,11 +900,11 @@ struct exfat_entry_set_cache *exfat_get_dentry_set(struct super_block *sb, if (!exfat_validate_entry(exfat_get_entry_type(ep), &mode)) goto free_es; } - return es; + return 0; free_es: exfat_free_dentry_set(es, false); - return NULL; + return -EIO; } static inline void exfat_reset_empty_hint(struct exfat_hint_femp *hint_femp) diff --git a/fs/exfat/exfat_fs.h b/fs/exfat/exfat_fs.h index 82395ae80dba..2ffe5792b1a9 100644 --- a/fs/exfat/exfat_fs.h +++ b/fs/exfat/exfat_fs.h @@ -490,8 +490,9 @@ struct exfat_dentry *exfat_get_dentry(struct super_block *sb, struct exfat_chain *p_dir, int entry, struct buffer_head **bh); struct exfat_dentry *exfat_get_dentry_cached(struct exfat_entry_set_cache *es, int num); -struct exfat_entry_set_cache *exfat_get_dentry_set(struct super_block *sb, - struct exfat_chain *p_dir, int entry, unsigned int type); +int exfat_get_dentry_set(struct exfat_entry_set_cache *es, + struct super_block *sb, struct exfat_chain *p_dir, int entry, + unsigned int type); int exfat_free_dentry_set(struct exfat_entry_set_cache *es, int sync); int exfat_count_dir_entries(struct super_block *sb, struct exfat_chain *p_dir); diff --git a/fs/exfat/inode.c b/fs/exfat/inode.c index 5590a1e83126..cdcf037a304f 100644 --- a/fs/exfat/inode.c +++ b/fs/exfat/inode.c @@ -21,7 +21,7 @@ int __exfat_write_inode(struct inode *inode, int sync) { unsigned long long on_disk_size; struct exfat_dentry *ep, *ep2; - struct exfat_entry_set_cache *es = NULL; + struct exfat_entry_set_cache es; struct super_block *sb = inode->i_sb; struct exfat_sb_info *sbi = EXFAT_SB(sb); struct exfat_inode_info *ei = EXFAT_I(inode); @@ -42,11 +42,10 @@ int __exfat_write_inode(struct inode *inode, int sync) exfat_set_volume_dirty(sb); /* get the directory entry of given file or directory */ - es = exfat_get_dentry_set(sb, &(ei->dir), ei->entry, ES_ALL_ENTRIES); - if (!es) + if (exfat_get_dentry_set(&es, sb, &(ei->dir), ei->entry, ES_ALL_ENTRIES)) return -EIO; - ep = exfat_get_dentry_cached(es, 0); - ep2 = exfat_get_dentry_cached(es, 1); + ep = exfat_get_dentry_cached(&es, 0); + ep2 = exfat_get_dentry_cached(&es, 1); ep->dentry.file.attr = cpu_to_le16(exfat_make_attr(inode)); @@ -83,8 +82,8 @@ int __exfat_write_inode(struct inode *inode, int sync) ep2->dentry.stream.start_clu = EXFAT_FREE_CLUSTER; } - exfat_update_dir_chksum_with_entry_set(es); - return exfat_free_dentry_set(es, sync); + exfat_update_dir_chksum_with_entry_set(&es); + return exfat_free_dentry_set(&es, sync); } int exfat_write_inode(struct inode *inode, struct writeback_control *wbc) diff --git a/fs/exfat/namei.c b/fs/exfat/namei.c index 99e00a36c029..8d72527dfb78 100644 --- a/fs/exfat/namei.c +++ b/fs/exfat/namei.c @@ -604,7 +604,7 @@ static int exfat_find(struct inode *dir, struct qstr *qname, struct exfat_sb_info *sbi = EXFAT_SB(sb); struct exfat_inode_info *ei = EXFAT_I(dir); struct exfat_dentry *ep, *ep2; - struct exfat_entry_set_cache *es; + struct exfat_entry_set_cache es; /* for optimized dir & entry to prevent long traverse of cluster chain */ struct exfat_hint hint_opt; @@ -644,11 +644,10 @@ static int exfat_find(struct inode *dir, struct qstr *qname, if (cdir.flags & ALLOC_NO_FAT_CHAIN) cdir.size -= dentry / sbi->dentries_per_clu; dentry = hint_opt.eidx; - es = exfat_get_dentry_set(sb, &cdir, dentry, ES_2_ENTRIES); - if (!es) + if (exfat_get_dentry_set(&es, sb, &cdir, dentry, ES_2_ENTRIES)) return -EIO; - ep = exfat_get_dentry_cached(es, 0); - ep2 = exfat_get_dentry_cached(es, 1); + ep = exfat_get_dentry_cached(&es, 0); + ep2 = exfat_get_dentry_cached(&es, 1); info->type = exfat_get_entry_type(ep); info->attr = le16_to_cpu(ep->dentry.file.attr); @@ -677,7 +676,7 @@ static int exfat_find(struct inode *dir, struct qstr *qname, ep->dentry.file.access_time, ep->dentry.file.access_date, 0); - exfat_free_dentry_set(es, false); + exfat_free_dentry_set(&es, false); if (ei->start_clu == EXFAT_FREE_CLUSTER) { exfat_fs_error(sb, From patchwork Thu Nov 24 06:40:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuezhang.Mo@sony.com" X-Patchwork-Id: 25335 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3228356wrr; Wed, 23 Nov 2022 22:51:14 -0800 (PST) X-Google-Smtp-Source: AA0mqf55p+O6vPJzpwfsgqlSWTBHHiU5syTr03D3a4oRqQ5McjiArDmOfXmqkTrRnS4oHHyKxCca X-Received: by 2002:a05:6402:1aca:b0:469:701b:588d with SMTP id ba10-20020a0564021aca00b00469701b588dmr11027252edb.384.1669272674245; Wed, 23 Nov 2022 22:51:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1669272674; cv=pass; d=google.com; s=arc-20160816; b=GfqnvHQaes2znKLnKQI1WHVmrdJQPkZL3nq0/S8n+UejbUe3YbMf/AR/LH1uEYaIEv 1nNJ14fdXfXxclUO0YBClV+PmePJmqPJUS4zOFOPdfewhQ4A61SbSM4etkdQrHJghBUv DtjaHeO3Zjp5YFoF+89TBbGgwcc6QvKVfRQNZsk2OiAlJvtq8RjitK42dZrx2AZQbHyR FyYJlvrnjpxITLcwE5vehgfttkf6UAPMN8cDGYYVVP63AMFWPn2uWLfN2De6OT1mKEEN 1DOnaFqdMMYODNU4vSya0Z92S1cpFNq21FPtztmROPClQkquQi+zmqSt6V/vwTkGMOpQ 7Bew== 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 :content-language:accept-language:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature; bh=xKKeZR6+SXGUXOimF0GeERuS7BNE4wQS3IqZd9D2IJ8=; b=DFow0x55nT4kEpq7AdzwZoAsQapgD0vcYrq804kfXbqFyjR9gmslcbIvPOnJA6fpl9 niGqQ6TEzJL/DNKt6La32l7cPKATV3oyyPMSUue70Qbi9mjfxi243nSl1w0T9p4WicyT lnxRAT/LegfaTHo7+J9ZGoTQqDxqJz3WgdWFzPRBHfP35HF3z81qIyKl4vubgrp5rMeh uCu9ESBtK5oHEPvlNZVrLcPJu0/CjPDDHQ3Yu9Oay9+FVEaSBJCTRhYYIpFVibtdvGgf JiDx7NScOVMqeH5eQwmirKlWOGBUnCeGIBmseq+kqUp4aE56XsEo8ZdJEVfKjaE1p/gy 2MvA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sony.com header.s=S1 header.b=p+6bY9cL; arc=pass (i=1 spf=pass spfdomain=sony.com dkim=pass dkdomain=sony.com dmarc=pass fromdomain=sony.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=NONE sp=NONE dis=NONE) header.from=sony.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u26-20020aa7d89a000000b0046883aeffd8si218460edq.278.2022.11.23.22.50.48; Wed, 23 Nov 2022 22:51: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=@sony.com header.s=S1 header.b=p+6bY9cL; arc=pass (i=1 spf=pass spfdomain=sony.com dkim=pass dkdomain=sony.com dmarc=pass fromdomain=sony.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=NONE sp=NONE dis=NONE) header.from=sony.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229774AbiKXGll (ORCPT + 99 others); Thu, 24 Nov 2022 01:41:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229750AbiKXGle (ORCPT ); Thu, 24 Nov 2022 01:41:34 -0500 Received: from mx07-001d1705.pphosted.com (mx07-001d1705.pphosted.com [185.132.183.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49C63E14E6; Wed, 23 Nov 2022 22:41:04 -0800 (PST) Received: from pps.filterd (m0209326.ppops.net [127.0.0.1]) by mx08-001d1705.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AO6WRUH002142; Thu, 24 Nov 2022 06:40:46 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sony.com; h=from : to : cc : subject : date : message-id : content-type : content-transfer-encoding : mime-version; s=S1; bh=xKKeZR6+SXGUXOimF0GeERuS7BNE4wQS3IqZd9D2IJ8=; b=p+6bY9cLsuAK27uPAhoagIkDthV5QdkTr/3G+e9zZD8gwt54cdrWmP0bc+7X328tB/P7 cPyP7ctoV7QAhst9zQ7u2R9Vg+OWIYaXQ2lTmgNvYHcZdcASeoRg1KegqkilhChX8Ddg iCBGrwz+U3NJ4di8UefBQ/8aTQaaPeLvNRLKK3IwQIbb8r/iPIaF69sBNG5OqYaQx2JZ TzHvgy4UMxc97Y1sKfWo2T8nyIAFyAUgH58BlQggj2mrZa6Y9VqYgrTsU+TV35h6d+J3 lDp87zRQfEkfHNcR9mP9cwtTUCxuSsK/YM/Xy4KDpuWDX3waESdmcD3/uuVeInZRw7k9 xA== Received: from apc01-tyz-obe.outbound.protection.outlook.com (mail-tyzapc01lp2042.outbound.protection.outlook.com [104.47.110.42]) by mx08-001d1705.pphosted.com (PPS) with ESMTPS id 3kxrd5mtxk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 24 Nov 2022 06:40:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fszdXAvc8b/a2/p/hsDHTvE3JgZ/kZoVQvBB66JpuxasbhpOgQiccdmEATWJ4IPQCIlFmEoIFIGTv10bGrq3ssa36QE+YixbUmdF41BRcKY1k7sC9KNa9P4TxGhwQctrB8/1Sh30OZTPeEYdGyTHVaouy84IoujOy55Evl5kB+nbcBSJztTyVV4Z4kizHyEGObc85zWFwASfmuu73c30yCXAGw1EFsse84+I7sItUmWZe96LJN6pCvspRnAKJ/ao6mx6jELLmC0vK9erhn3FZCk/mdVVatTHjZACe8KW97A9nHaLqyItypj8XOkT0ovMRnyL9+Wzgip3lemIQsuvXw== 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=xKKeZR6+SXGUXOimF0GeERuS7BNE4wQS3IqZd9D2IJ8=; b=PR5CfzZ4PhbFL4RJ2HA0rn/KLfVFBf+KbBiTv8ozOfsA50wmDX7rwy0wmgo0tZGkO2lzPjiwbOBF4nH0ao6LyjuNy8csr9f88lEYO5JeB37Z8mIoZMYBxolh7KBw9egYl87MckQ664egY0H+bAT1AFk2vnGHkNMzvX1opSySECA+OcBkkcDl8aGJHJVmIP7VOcG0+m674fkHlNO4AMLzY9dGXX8YOZ0/RYehBjgIXOaiF7Ww9czbsHCil2LRFxR6BmHhDHjXWgmDFRTaEPBkORqFWAxV7JwbQwnjooLXR9OFvZPj2xeXBnR/G8I3T4/aIwuG74f2h6awSD2FHX4wKA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=sony.com; dmarc=pass action=none header.from=sony.com; dkim=pass header.d=sony.com; arc=none Received: from PUZPR04MB6316.apcprd04.prod.outlook.com (2603:1096:301:fc::7) by SI2PR04MB4425.apcprd04.prod.outlook.com (2603:1096:4:e8::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.17; Thu, 24 Nov 2022 06:40:40 +0000 Received: from PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::708b:1447:3c12:c222]) by PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::708b:1447:3c12:c222%8]) with mapi id 15.20.5857.008; Thu, 24 Nov 2022 06:40:40 +0000 From: "Yuezhang.Mo@sony.com" To: "linkinjeon@kernel.org" , "sj1557.seo@samsung.com" CC: "linux-fsdevel@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Andy.Wu@sony.com" , "Wataru.Aoyama@sony.com" Subject: [PATCH v2 4/5] exfat: rename exfat_free_dentry_set() to exfat_put_dentry_set() Thread-Topic: [PATCH v2 4/5] exfat: rename exfat_free_dentry_set() to exfat_put_dentry_set() Thread-Index: Adj/zhk3xAnUZqh9RdCn2jEE9Dr+8w== Date: Thu, 24 Nov 2022 06:40:40 +0000 Message-ID: Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PUZPR04MB6316:EE_|SI2PR04MB4425:EE_ x-ms-office365-filtering-correlation-id: dbea7db0-c004-4aca-ba01-08dacde6cd96 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 5SgMZfZR5mvN7U7ghU2GyB7f6VbvoUHQdiXQCLMkDv/iZfdbwX8lVdKicXNBPqJ/0lLeqCDscQWXqKz9G4cSNfLTjC4xb0pB7M3NvfV5iagkchTdWleBlVc743fZecoobvnmxL0mMjlim7x00+LBGuzfThL9krMqvmPAIN6xKvnBOPsKuv9Cc1OSaVDKxNbocVAG6TvhBAohMuYUIi2rMK1TfMa3tUJWUh9OVoaDC5lUne7fR7FoemKCTSLrctSZSpNpVW5t8mfqpSY0praZphaPw0F0ILdxwUHXEXkByOviZr1OhEzZUzjzWE4rBv4bAxST3qaZQP4MZXcVWxS6DXTO8SnnWYy31J2LOc/AtfFJ61JzesnexVjn7SVIqhu7V/wCmyErbnKpiM6OGeVDkIHZoqthY/W7+HMuAvbTTImXTwoLNzza5jqT9uoIdu5Of4qH9hNf0dSy0ByXH4JDw6ReaImxKbCeP6ASI3a3T5R6JxMh6Rafis1qRJMg768eujWZ95TUkKNXNjbRNTj9jrVKtsmaHzUzWRFhCp61u3sCaN6pkXN5TcBHPut4JyGZPVmSwTHBAbbgvLPnTSvnjjwa+lPVXJrDCIzQ67VjTIxQmD6rMfsCq96ZfOLWbw+wteqMbs9dQsvjCKEYy7KfiHKbvvI2qCCZao6YmTh8Z0DLOubDAEr1aE/weGY0v1Iiabg18TZOlmUDBNzeINxmXg== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PUZPR04MB6316.apcprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(39860400002)(396003)(366004)(376002)(136003)(346002)(451199015)(41300700001)(8936002)(478600001)(54906003)(4326008)(5660300002)(316002)(66556008)(66476007)(66946007)(76116006)(52536014)(66446008)(64756008)(8676002)(71200400001)(107886003)(2906002)(7696005)(6506007)(9686003)(186003)(110136005)(122000001)(26005)(38070700005)(38100700002)(82960400001)(86362001)(83380400001)(33656002)(55016003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?LH2cXk20skcyjC8ZVpxP5sGa+3cE?= =?utf-8?q?JYTzDRix5Kh8LZ4peKUT0wmiZYsSPOUkWPNS+faLEx4QqEO7bowCq9S7GRl8HUm2u?= =?utf-8?q?7DX0SyQ/Nb0oeA8dlqOwQBCy5jMelqjOCvzN10L2GZvvEnpVJQ44HK9cuCBfrBclZ?= =?utf-8?q?vcLTDBWy9gZ+ow5ypNGzv55B2NASWTmq+EuaH/JiDQLM+UuDot9rTCaRXt9II9XOU?= =?utf-8?q?icQ6rjnxBDFgMRU/q+iA6VXEEbyzyjuvZrNev7LO0pMN6eB99Fsf6x4bEIgrLm36U?= =?utf-8?q?mVVYL8mHw5nhuknk7EL4Jio/YAKXfXzqN+HL+V2/nSwHgBriAFQ+f3OhFzPVLu62f?= =?utf-8?q?o2rIN1CTSfBMavDM+2NLomM69N3vonUdZZIPiiQR7DepOdraf+3UtHxVvPJDVLGjC?= =?utf-8?q?TNZxUOVvGqzlj9WuRbaA4L8+6G0Ti23XFLVZXdXc4zZV0FV+MHTDsRkVar0Q4Zopa?= =?utf-8?q?Hz+9uWAcUfO01gG23nhAX/D/VTmB1/NyS6O1zB5nJNb63CKVPjSZEjYqUnJx8yPN+?= =?utf-8?q?BbicaFXkUq1tsw9PWiwE9d4L1C3w6ZRTSXvn6V4Ue5nQPHZoQbsvoYDoQ2K4ncHeB?= =?utf-8?q?GP973NsLs95b1sNVOjJx9e0sIov2aXJ0b9R8V8Ljf6adtduikrzoHAy7a8s1+maoN?= =?utf-8?q?wga97Cbw4Snw+4gBzQhy2DczwQ6JQBuMGYzEuhLLxFNzcf50kAd0dJ0KH5fJC2hmy?= =?utf-8?q?4Hi1QaYQtmEV6XMHuS7QVhxiDkjRsNAoScnkKaCLBKuQMW6SOgAj3hbj1jOFloLs3?= =?utf-8?q?+lNoqFyU4Xt9CMSTr7GVYkyi+T766WY6YP25orPh5IpOIJRP/xnwcpcdFiLddfwG2?= =?utf-8?q?1K/u6+BXZV5auFTdPaCmZkVoZsDAEOG4EltHLpbJBPvN/z+IZdsmDLpGmLBfjHctd?= =?utf-8?q?N7AAU4JMKT7l27D12q42FFY1lNmVnZrwJm4yx+sxCCjuuu//2G1s1Rx4xSNKwYgGM?= =?utf-8?q?sUmw1ynd5CBXpT+Y4iVMAToZ8ww4JL0+1qzTzVIU/INsvR9kn/1+79MGOjlIS5ETW?= =?utf-8?q?tEV0naesy5/FPLIBIbMTUFlSA0w/3W3Bz96UR0jxgU6nbmgLTiMs1VJzvJ871GAVG?= =?utf-8?q?GoDxdpnJ+qe8Ijs3isQhZrfBFD4zRqZtT5ahYR55vfbbhaNrqrc1rPK0w3+Tq6hhQ?= =?utf-8?q?NgZrvIjw4QcB7dM5Lt+gXIlkboF2xMpxBCMGaF0u+jGQiTSmdJC3HdSe0NTdARCBa?= =?utf-8?q?HzfFELnv8xqa2laG/PwIAsw9JON1ZKD8yfG0DR5t3bTFsW0DvnQsrVRvTTlVbFaDz?= =?utf-8?q?iNjRY1nNKLtLYjR3E5Uw4QQoXe6CFZBlpuObHi9SAGUMX99mw3SK26pAArYA/x9Lp?= =?utf-8?q?0oRFtgCt7jAOLs4fbX43KpO+z3dzZPY5brpPDTtv5tLOHPr8mKPVa045VhKqWLkQa?= =?utf-8?q?/0AdLIp5NDrHdAOXul9jMRB0m0mVZTCEFCMz2fwRhnB/0W+snPGA+4fi59mEkGGoM?= =?utf-8?q?+P/dzSB5jLNjSF6imY1rIwW0MWwlP6WMk41q7HZymadhX4wPJk06f+qPY6iOShVG1?= =?utf-8?q?IqBQjbi2ZOTA?= MIME-Version: 1.0 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 3Gj2Xju+4iJNP5D5F4viA8bfOCMFr+7bK95Uk51BWNs+vhiWXQ0brkR0qZS1gAOa41QuWQ2FMY+0jV9B2dOTKxml9XoEZkqlgFt8GuHZYUTbb0MQC/zYRo3/NqBg1SG5kVUr8GFXd8cvRQgGYE/z+LQANcR6hQ2n1QznBfPwE5S2mjC3Fn6Zhrnr7kHxQtneGsC98YzD7IKL3tzmEIg+Abyi7oZbJ0MdqaGo+XEfEN+B8/k+K3eiIPrTxokIJEtlptUpcYgAcUQyy2zKX7JwWd6Vp4nLL4AjDxV0AQ2Xn6yVMdfAJydLh4PFmh7n9zjC2TPrxZoTe72y7Yvh6nHbQRvlXFAL3CIh+2WsEyDBsH6ppwxmf7ZCdppeiJ392fWBThN3hMQ/psv0qPK50u8zr3QTQea59SItgTB2MIt7D5pjNwaT/LDqBXIrRXD+Ub6yC24q0FiVRR50fgbBKRrUtbG/f07nBHopvZRR5Gr/zr66h9PSZjc86Rf7gjvEEgOS3E+JK34YxwPKTEkURDZNvjE+1JQvOprKJMZx3iNDE3OoR5jHZt7ZqHGKaeBW30hm4exde0DRKZ/QVDwB617OhwX2feQ0abMaT+BQXUBkqwudTwpVKUmgevncSYjVlc3r++uT+vfMcQAXTYCj0Ims5f79AS8gAlUrNeEop+XHpH9noTEIV+/lM8mzgsKrjfszOQj187fpzdu0PyLhrFs3017SPAtHtasja6CdDzSqAYQc/GbRROn9vB9B6h2ZpKWDjUZHMLrxye/ZCVaamZ+vn7i0+xAT0g7cUr/C/6lPFVLLcnRGbK9uBFJMPQAx4vQCGwIT8FfXknrUgsm74CDMUTxxhvyRw53RPJksFx+j98UEfGPhdiIb6QFAGYv6llxO X-OriginatorOrg: sony.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PUZPR04MB6316.apcprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: dbea7db0-c004-4aca-ba01-08dacde6cd96 X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Nov 2022 06:40:40.1101 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 66c65d8a-9158-4521-a2d8-664963db48e4 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: vRZQJx1mwaPjRVai3kn/Ck4v0llp3kQ6qPElqCSAYAoIcpEpD57+QAo7xrITQppmrt0/ZCJV5nuNwWAA694bMA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SI2PR04MB4425 X-Proofpoint-GUID: PpyTMHDIQlcsQcAQ0utRvtNjeZqFq74W X-Proofpoint-ORIG-GUID: PpyTMHDIQlcsQcAQ0utRvtNjeZqFq74W X-Sony-Outbound-GUID: PpyTMHDIQlcsQcAQ0utRvtNjeZqFq74W X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-24_04,2022-11-23_01,2022-06-22_01 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE 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?1750359263465628822?= X-GMAIL-MSGID: =?utf-8?q?1750359263465628822?= Since struct exfat_entry_set_cache is allocated from stack, no need to free, so rename exfat_free_dentry_set() to exfat_put_dentry_set(). After renaming, the new function pair is exfat_get_dentry_set()/exfat_put_dentry_set(). Signed-off-by: Yuezhang Mo Reviewed-by: Andy Wu Reviewed-by: Aoyama Wataru --- fs/exfat/dir.c | 16 ++++++++-------- fs/exfat/exfat_fs.h | 2 +- fs/exfat/inode.c | 2 +- fs/exfat/namei.c | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) -- 2.25.1 diff --git a/fs/exfat/dir.c b/fs/exfat/dir.c index a3fb609dd129..a9a0b3e46af2 100644 --- a/fs/exfat/dir.c +++ b/fs/exfat/dir.c @@ -55,7 +55,7 @@ static void exfat_get_uniname_from_ext_entry(struct super_block *sb, uniname += EXFAT_FILE_NAME_LEN; } - exfat_free_dentry_set(&es, false); + exfat_put_dentry_set(&es, false); } /* read a directory entry from the opened directory */ @@ -602,7 +602,7 @@ void exfat_update_dir_chksum_with_entry_set(struct exfat_entry_set_cache *es) es->modified = true; } -int exfat_free_dentry_set(struct exfat_entry_set_cache *es, int sync) +int exfat_put_dentry_set(struct exfat_entry_set_cache *es, int sync) { int i, err = 0; @@ -860,7 +860,7 @@ int exfat_get_dentry_set(struct exfat_entry_set_cache *es, ep = exfat_get_dentry_cached(es, 0); if (!exfat_validate_entry(exfat_get_entry_type(ep), &mode)) - goto free_es; + goto put_es; num_entries = type == ES_ALL_ENTRIES ? ep->dentry.file.num_ext + 1 : type; @@ -882,7 +882,7 @@ int exfat_get_dentry_set(struct exfat_entry_set_cache *es, if (p_dir->flags == ALLOC_NO_FAT_CHAIN) clu++; else if (exfat_get_next_cluster(sb, &clu)) - goto free_es; + goto put_es; sec = exfat_cluster_to_sector(sbi, clu); } else { sec++; @@ -890,7 +890,7 @@ int exfat_get_dentry_set(struct exfat_entry_set_cache *es, bh = sb_bread(sb, sec); if (!bh) - goto free_es; + goto put_es; es->bh[es->num_bh++] = bh; } @@ -898,12 +898,12 @@ int exfat_get_dentry_set(struct exfat_entry_set_cache *es, for (i = 1; i < num_entries; i++) { ep = exfat_get_dentry_cached(es, i); if (!exfat_validate_entry(exfat_get_entry_type(ep), &mode)) - goto free_es; + goto put_es; } return 0; -free_es: - exfat_free_dentry_set(es, false); +put_es: + exfat_put_dentry_set(es, false); return -EIO; } diff --git a/fs/exfat/exfat_fs.h b/fs/exfat/exfat_fs.h index 2ffe5792b1a9..324acc57d029 100644 --- a/fs/exfat/exfat_fs.h +++ b/fs/exfat/exfat_fs.h @@ -493,7 +493,7 @@ struct exfat_dentry *exfat_get_dentry_cached(struct exfat_entry_set_cache *es, int exfat_get_dentry_set(struct exfat_entry_set_cache *es, struct super_block *sb, struct exfat_chain *p_dir, int entry, unsigned int type); -int exfat_free_dentry_set(struct exfat_entry_set_cache *es, int sync); +int exfat_put_dentry_set(struct exfat_entry_set_cache *es, int sync); int exfat_count_dir_entries(struct super_block *sb, struct exfat_chain *p_dir); /* inode.c */ diff --git a/fs/exfat/inode.c b/fs/exfat/inode.c index cdcf037a304f..a84eae72556d 100644 --- a/fs/exfat/inode.c +++ b/fs/exfat/inode.c @@ -83,7 +83,7 @@ int __exfat_write_inode(struct inode *inode, int sync) } exfat_update_dir_chksum_with_entry_set(&es); - return exfat_free_dentry_set(&es, sync); + return exfat_put_dentry_set(&es, sync); } int exfat_write_inode(struct inode *inode, struct writeback_control *wbc) diff --git a/fs/exfat/namei.c b/fs/exfat/namei.c index 8d72527dfb78..57510d7f58cf 100644 --- a/fs/exfat/namei.c +++ b/fs/exfat/namei.c @@ -676,7 +676,7 @@ static int exfat_find(struct inode *dir, struct qstr *qname, ep->dentry.file.access_time, ep->dentry.file.access_date, 0); - exfat_free_dentry_set(&es, false); + exfat_put_dentry_set(&es, false); if (ei->start_clu == EXFAT_FREE_CLUSTER) { exfat_fs_error(sb, From patchwork Thu Nov 24 06:40:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuezhang.Mo@sony.com" X-Patchwork-Id: 25333 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3227899wrr; Wed, 23 Nov 2022 22:49:43 -0800 (PST) X-Google-Smtp-Source: AA0mqf5H5x9tUt4s2AlzqJbr1FzmE6F8WKc+D15rAMhhzvJ9rmohPDsWbZluQc0E/22Jt41/H1g3 X-Received: by 2002:a17:906:eb17:b0:7ae:87ef:d9a6 with SMTP id mb23-20020a170906eb1700b007ae87efd9a6mr10817982ejb.397.1669272583178; Wed, 23 Nov 2022 22:49:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1669272583; cv=pass; d=google.com; s=arc-20160816; b=ismycw239EYm71CppHuMvctGrUhvr1auxkHRQTMr0BwM/JPCtmRUWHfJwkiGtdwgcc Hkc9XYgsf49KN+ZcwN/EHPJrqvtj4yv+Ir/hgWIW+ioIsHrc1nKqOK9a3wdzH0NKcE7c wErr+sBLxswcSYCYEo7hUrj5Y/nSBiXTCfAg1m59QYAC9LE7tYOHkL04hvPlxiofyTYF cdzrlh5KWwK5XOrDVN/Fj+RUysnZm73Jkm8gUE1fKuhMFc7ctvaoKoDJpA8bET+jz8ti F7RhQLEGZUHi2qE+wGuwj/t4ASLuX91RZ1RX5TOVh3SA4rNLF2G+U4MFlRjdIpOEvOXE pE5A== 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 :content-language:accept-language:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature; bh=qwkyQki8XUKo4GmkKpTwouFfBIBxxOz+7oReYTJNuJg=; b=UvcD5LbGvHpojVe7ifoozXWF6ls46p5wOSCf7A/F6woEtaa9JHnGOTl1OZngb5X80w sinvfJSHyDzKEJ90hZIp12ABoWoP1EmDT3zsqImOGMpSsT3+idffegDLucCDUOB8blG0 FPIE+fcQk4R0RTEiuGDhUBLxhECCIcAJVnmrTVA3iFIGBaSu44gU52CFCoyZd//esBCe jLi7d+tSYwyAQzzaOceRlCOWPHli9P5MHiglUErxa21P8/6K+DqCSoMdUBr2FJ/HhibT vVg6pORvKwWp3jEp1b+oo7it0YJmz6eTYE4qlrLx3kVVqOmbKjVCDBxnUwcmWxL/u+aK QIkQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sony.com header.s=S1 header.b=mbU0HVAF; arc=pass (i=1 spf=pass spfdomain=sony.com dkim=pass dkdomain=sony.com dmarc=pass fromdomain=sony.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=NONE sp=NONE dis=NONE) header.from=sony.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w10-20020a05640234ca00b004627d582888si352900edc.24.2022.11.23.22.49.18; Wed, 23 Nov 2022 22:49:43 -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=@sony.com header.s=S1 header.b=mbU0HVAF; arc=pass (i=1 spf=pass spfdomain=sony.com dkim=pass dkdomain=sony.com dmarc=pass fromdomain=sony.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=NONE sp=NONE dis=NONE) header.from=sony.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229754AbiKXGlI (ORCPT + 99 others); Thu, 24 Nov 2022 01:41:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229704AbiKXGkw (ORCPT ); Thu, 24 Nov 2022 01:40:52 -0500 Received: from mx08-001d1705.pphosted.com (mx08-001d1705.pphosted.com [185.183.30.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10DFFDAD3F; Wed, 23 Nov 2022 22:40:50 -0800 (PST) Received: from pps.filterd (m0209321.ppops.net [127.0.0.1]) by mx08-001d1705.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AO6OH5s001748; Thu, 24 Nov 2022 06:40:32 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sony.com; h=from : to : cc : subject : date : message-id : content-type : content-transfer-encoding : mime-version; s=S1; bh=qwkyQki8XUKo4GmkKpTwouFfBIBxxOz+7oReYTJNuJg=; b=mbU0HVAFA3ALZTmPyjxowi9O5adSmcR6ehEkofBoEfNWRGH3oiCNvnh+yTOXbrdBf39a /xAcuV5sE/6HlzjnmCbn9sWhdpPNwuaAStXI4TwYTqTZ+m1+k/+S+I9udShsV9wGdeHn Lv+T2xRUTDSmMvvUZNwO744YE2X74pP2NkvMuFOW5EiJm8XBmTJsQKQxG1imu/3eRCM+ UC+4POEVGnDzfKfA0AwWZfZvOnec236Mi1ePZ4DgwhcVd0nfLU8xsMpOIMSPRWpecjBM Z/1ZQ2XWgVv49XCoxN8KsAJfnxhrKFHuF9VHWoh6hOyxr10nWrL4mVLFJMNT3KTKHX+G NA== Received: from apc01-tyz-obe.outbound.protection.outlook.com (mail-tyzapc01lp2047.outbound.protection.outlook.com [104.47.110.47]) by mx08-001d1705.pphosted.com (PPS) with ESMTPS id 3kxrb94t31-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 24 Nov 2022 06:40:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l0U2acbBoizVOlPIqiuTn5BGjtJEU8uywgqUUcf6Km8W+1Y2ohWv0WwS95rDHnCTkNfPApUUh8L1OHpC97snIvr3wInBFd1bWMSCGleXxoh+FsoM4FFnWPEWEz/aiQ/NyYotMTzgC/JKKgrsJC2aaNHsUT3BfLN0Swq5I5HJKQxKmj/yVZ3ZZblU2CiyR5X9HhTLAWJaVYwyltmf5Hg92QlKj85Mieak/34XyFE1BWWQUO0eKUIq5iaNdXp/B3Z0myCa+MTH/Dw3T2XRRiVp8K1gxZBT+SvQlF4yILM2OK3Mbm6aiThNhog4IHQ4TuHzutSsqpIRf6WdDr57uTSRMQ== 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=qwkyQki8XUKo4GmkKpTwouFfBIBxxOz+7oReYTJNuJg=; b=aJHQ+R5VHUaDyVDbz5/uIkauN3eapyGCvPccXOJr351RAfjqHul5CQKpsTj9D3RlhFWxfQ+9aFH49x7p0ZtDDWrQE3SWIzep3+SLOQJYgBAwyX2ee8Hyn7+2KH9ht7P2MaQfI7k4sToLqWJDOVaZVoyX4lNe3Xkdoyk8vJ1jPrH3C1jhNW/FspksDZKWpkjfknde7bHvjGxnFEt7VFBS2H9iqlfcu6ywQX2HZgJ1mNuCv9TJ+xNcrozENpDc/53p0CcZoTX/9mt8EeUvjK4h8u6xC6+YCDuZHqIxSURN2AWDwdKSKNiPpGSTk7EZNd5dXKswQUQs4s5ujS+faHD/zA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=sony.com; dmarc=pass action=none header.from=sony.com; dkim=pass header.d=sony.com; arc=none Received: from PUZPR04MB6316.apcprd04.prod.outlook.com (2603:1096:301:fc::7) by SI2PR04MB4425.apcprd04.prod.outlook.com (2603:1096:4:e8::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.17; Thu, 24 Nov 2022 06:40:26 +0000 Received: from PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::708b:1447:3c12:c222]) by PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::708b:1447:3c12:c222%8]) with mapi id 15.20.5857.008; Thu, 24 Nov 2022 06:40:26 +0000 From: "Yuezhang.Mo@sony.com" To: "linkinjeon@kernel.org" , "sj1557.seo@samsung.com" CC: "linux-fsdevel@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Andy.Wu@sony.com" , "Wataru.Aoyama@sony.com" Subject: [PATCH v2 5/5] exfat: replace magic numbers with Macros Thread-Topic: [PATCH v2 5/5] exfat: replace magic numbers with Macros Thread-Index: Adj/zvsgGNVBvInHQtSPjlm/TwV6nA== Date: Thu, 24 Nov 2022 06:40:26 +0000 Message-ID: Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PUZPR04MB6316:EE_|SI2PR04MB4425:EE_ x-ms-office365-filtering-correlation-id: 85537ed8-ff4b-45df-0031-08dacde6c59f x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: i9M+w3FY8mKXeKSCMUm/VIib2nGZRbqnUrA8WhKUKfcB+rx8xgz5fzFkvnxg3ZKsagdu1M9daOAtWaVSCbq13MugJpv4PfLXfcoMozxdCYawzXmJrOYktudMIKMFobw4/V61H2YilQa+xHt1WOiI5kC3evG2RmIeXU/j+4O3bpYt6shUt2jWa+Ax3Jz1qwMF7soLtwe21E4iz3QkT/1uVoViM+YGTQrgMBLN27OMsXMfkTMBaMphbglqqXW5AdmbyKfViSF5mZS6O173q1Auq71eFMg1EhL6fIbPg7BLLCBiplVWSKT2DUDk2+edKoBDGOC/pC3kdTSRZhV6cliTozUWT9jvQYmkLwCqZBVQmgn8RZY0FZpMUhP80iB7ygmX1Lpo1x0FxfHj93laLgJGfpspQRZz91T1ErHdXvxkSsyFBVC8HedK2ifexJcoahbppeXyOK7LhxAqKkiRgRnLwM2uwCya2Ov2rDiX8wxwX3l1TXZot8GeKJh48vbXWKvcT7dt5alyhf9AtUQOhLYhJlLjIiyFZcBi536H+JlZEIW7pBvpfV/VhpJxTCRbUmnjbOjlFRZLvg4LFX0NTYty2B05N5tpPIe0U2AOfo+2m/K+QVrrvBjMWcGao3NFXnwJHUFQcKmR9zQqTlbDZdphMBi/1prnmUrNTa855S6OVF9BiBnsFYSwabV4dY62Phd24uIOF+eGiBoXOL9LKNMWOw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PUZPR04MB6316.apcprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(39860400002)(396003)(366004)(376002)(136003)(346002)(451199015)(41300700001)(8936002)(478600001)(54906003)(4326008)(5660300002)(316002)(66556008)(66476007)(66946007)(76116006)(52536014)(66446008)(64756008)(8676002)(71200400001)(107886003)(2906002)(7696005)(6506007)(9686003)(186003)(110136005)(122000001)(26005)(38070700005)(38100700002)(82960400001)(86362001)(83380400001)(33656002)(55016003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?mgWzRj2f5CoHOJnGGk3BgWNFSssg?= =?utf-8?q?4fe0fAcwlIVp4pUOEx2cD1H1q6/Pbl7jDeqUuSecf4Mec7mRhv96noQHWkrl5gqwa?= =?utf-8?q?7Vmcdu3ZnCojPWQZ5IhypqA770S3mkV3Zznplcx1vl2RTFgTmGAs94gE4+BeUptGu?= =?utf-8?q?AF2OIcZ0wT987QIvh5xnExbT0e6zFxAU+clsM6vBeIl2HHLdyVyczdyp5tHp0hTCH?= =?utf-8?q?xHbeDeKPBCGqxwMVf15dCOFtdFsqV7qy+bUyN27Yn9PENQBouvEjcENsvYa+eceU6?= =?utf-8?q?EpCR7rxw9rnfWCMsm68ceBdEtmn7IlWWB5tqu/JGr3LubqlE8b1NkplpmVdNr7mkj?= =?utf-8?q?OG0+SemLVfuVJ9YBER6+jFE3eujDyCrtgr/BEfEA2/ityddmvHFe0uUAk0NIeOLi9?= =?utf-8?q?i2CZSPM45gDX2JorYQ0B2QTvZGa1oB1vGboNr8Yh79EkKwfFWhA0hL8ULwZOXJHNj?= =?utf-8?q?lc7VDrF9Xo4DZCJK2zVgBg9nssS8V2LWvg0OQjVKhC28EEFgT25GjxOWT8f7FKzPY?= =?utf-8?q?xDIQ13hjnd6AAUrY0ynKWcf/ARFbBKb1LrtwLMypseMCtF9WOi0+Ovnr9qNoOWuBl?= =?utf-8?q?cIeqkmWP/QguefeAE355P0xwHMTEYzyGiT4bRrSCjvQOYWp0+Zy0H0GizmKEPS1ZR?= =?utf-8?q?7lt5Anppv6wR4RxCXK2oiRC9gLxWaYTNqV5dztHnDqVPw5M7NqQFhcIAAd0kokvX5?= =?utf-8?q?ECa+/qioPVe71LEcCRnhPI8PPVPydVa5Fv6LNJ2ug0T1It7G5yBBju3MWTqdUpwZb?= =?utf-8?q?jAFioMiCK/G8dcZ8buXKNSLNdkpm+zMqW+ytlRJbgX1eTaa+ycDIjZQXnDMMcZz8g?= =?utf-8?q?l15dkMAEpfosTziXT1kpl6I+aYEeR0aWoZ0ueNKp4efHFgPIK9NGwfvLM6EURM8XD?= =?utf-8?q?izPysvDOLbz48zY2wBneOD56X8MjO4bCMZF/WX87eLgosD8ToaBeA692It29kRL8v?= =?utf-8?q?1xedOSb87Gaov5FIhjSrTJCqVQ5sbpsZ9RFtuOMTWVixahXaW3zPVB0JJq+v6f6eL?= =?utf-8?q?OGX6vg+RkYseT5ZUWuhOlaT39NEtPTuZs13rVD5dd7T89PeI2DmUQ/o8kilI4iCRX?= =?utf-8?q?RS9kOMaRDRXAcHbzV1HY+tVu5MNWhBXxVDBoxwY0DwXjO/9smn/Dhu8WrEmGigu7r?= =?utf-8?q?trAUg40rWIS4HtNkE11wq4/rrGAY32aafIrChHOOCJbpRLHHSiWZtc+thgtomuNGx?= =?utf-8?q?216GM0AQjPJDKs8myoNlGf3BiNChzZF3eMh5WEAAkDLYVR7cUJYJUhMscA4DNhZEz?= =?utf-8?q?mJh5+a5MZI20WspfrZAMZnurnYN4mV0Di4xa/o2Q4Xe9oUSvj1E+DBnfcKc1by8P2?= =?utf-8?q?RO0T3pt6vPCFZwUqPsNHjrBmLTSJLBXK+CGeV13/RWdosiJA+h8yWDGDt+DKdlD5f?= =?utf-8?q?k02aCNtGjCqXI69IkNS1N8DN0cRu/91nJIqYbRT2dg/0OvOh+/o3TP8C7HI6Aijq+?= =?utf-8?q?C0fzB2tEZzbMIN9q+iyeT5BaZk/pSLrIERnlYEl6sKMn/ThzPmwDh9xwYMK4RkeKH?= =?utf-8?q?/rovIbuSlQt6?= MIME-Version: 1.0 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: raLTJpJXAy3Zc+8QQ8SEWYPnUcqTGImkSV0E3V8b//z+go3WVXllt400+4SFzKXAfTtPq8mdZBij4PdWeNZW9QQ7bgTWh+oplMUbRLeKfpwBhgxaW1woDH25iQ8c7uQQapYhxyNLnlN6o1SJ38cyXiANU962hcCeRoh1cX3W4bMzsEaLL38Utq/yXxR2UrNDFLn3/xs7ZV295OyS/Vs2bbWccv6IQhg0ITRJpOWb1bawGrB8lQNKrEWIY0/hcSRgjksNbyDhQqd+VI6ZQ3DEGrk0PGRBx+rPRmkCnPezdD0CDkV6BmWliUmddvbeOzbv6lXM97uhP1rRZwDJO/d5HVJxNwUcFvBgluwWiKHWZHA5m6FROerk2Lu04UsfVm44Qv/7K99rhJxpK7aVph9+tvzp8K0UCqmnYEz7cNPjHM5JFLMkeNBZJd73/Xedn04YXhxmp0uzDFHkOypNPQKSunbRK1eJuVn3b0y6nrdTSffL51cbqpA/iLgjoaR998Erqryb+FsMkQVqeS817eUDGgloIhndZ25ouPM2fWNdLXfIQ8tFEw8s4oMmaQiS4SZbTttbwk3C1zBKPIDURFHOXZbuSI659GdQ0fK9o9dJLSQrR9hJFhdtMKIiZVAFhYhDCLE3T+fcppct08p348TX7aoXZz96tokwxvIoTKgT6Wfz371N5fEmHVoPQmyOgEAsxw+oyE308ItS4j3hii7RmCasrnPzqnswuBzGvVe80l1hpUotLAauz2734fu3zGVq6gRyk2kUk8/Xg3+a1x4sgf7/Ti1ISaFvrWSzkls8ltn2OdA3tiSvYnM01Aifou2zu34cb9EgcmmzwBUg06HdOLYoE8dQ1X/08WC2YjOCrn4cfyP0Vm45/wNKAOomsrGP X-OriginatorOrg: sony.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PUZPR04MB6316.apcprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 85537ed8-ff4b-45df-0031-08dacde6c59f X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Nov 2022 06:40:26.7737 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 66c65d8a-9158-4521-a2d8-664963db48e4 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: CD5q98V1hrYtWI1Hh7LTOadc/QhZFnIEEsqzOanZQAIkEs5Yls88ALrpiAL7MluGqYk0h4fC9FDCwoxSkN53nw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SI2PR04MB4425 X-Proofpoint-GUID: DH00IPFq01qaAT2-gQM6k_ledK9q3ztH X-Proofpoint-ORIG-GUID: DH00IPFq01qaAT2-gQM6k_ledK9q3ztH X-Sony-Outbound-GUID: DH00IPFq01qaAT2-gQM6k_ledK9q3ztH X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-24_04,2022-11-23_01,2022-06-22_01 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE 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?1750359167764535884?= X-GMAIL-MSGID: =?utf-8?q?1750359167764535884?= Code refinement, no functional changes. Signed-off-by: Yuezhang Mo Reviewed-by: Andy Wu Reviewed-by: Aoyama Wataru --- fs/exfat/dir.c | 12 ++++++------ fs/exfat/inode.c | 4 ++-- fs/exfat/namei.c | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) -- 2.25.1 diff --git a/fs/exfat/dir.c b/fs/exfat/dir.c index a9a0b3e46af2..c05493fc9124 100644 --- a/fs/exfat/dir.c +++ b/fs/exfat/dir.c @@ -44,7 +44,7 @@ static void exfat_get_uniname_from_ext_entry(struct super_block *sb, * Third entry : first file-name entry * So, the index of first file-name dentry should start from 2. */ - for (i = 2; i < es.num_entries; i++) { + for (i = ES_IDX_FIRST_FILENAME; i < es.num_entries; i++) { struct exfat_dentry *ep = exfat_get_dentry_cached(&es, i); /* end of name entry */ @@ -336,7 +336,7 @@ int exfat_calc_num_entries(struct exfat_uni_name *p_uniname) return -EINVAL; /* 1 file entry + 1 stream entry + name entries */ - return ((len - 1) / EXFAT_FILE_NAME_LEN + 3); + return ES_ENTRY_NUM(len); } unsigned int exfat_get_entry_type(struct exfat_dentry *ep) @@ -591,13 +591,13 @@ void exfat_update_dir_chksum_with_entry_set(struct exfat_entry_set_cache *es) unsigned short chksum = 0; struct exfat_dentry *ep; - for (i = 0; i < es->num_entries; i++) { + for (i = ES_IDX_FILE; i < es->num_entries; i++) { ep = exfat_get_dentry_cached(es, i); chksum = exfat_calc_chksum16(ep, DENTRY_SIZE, chksum, chksum_type); chksum_type = CS_DEFAULT; } - ep = exfat_get_dentry_cached(es, 0); + ep = exfat_get_dentry_cached(es, ES_IDX_FILE); ep->dentry.file.checksum = cpu_to_le16(chksum); es->modified = true; } @@ -858,7 +858,7 @@ int exfat_get_dentry_set(struct exfat_entry_set_cache *es, return -EIO; es->bh[es->num_bh++] = bh; - ep = exfat_get_dentry_cached(es, 0); + ep = exfat_get_dentry_cached(es, ES_IDX_FILE); if (!exfat_validate_entry(exfat_get_entry_type(ep), &mode)) goto put_es; @@ -895,7 +895,7 @@ int exfat_get_dentry_set(struct exfat_entry_set_cache *es, } /* validate cached dentries */ - for (i = 1; i < num_entries; i++) { + for (i = ES_IDX_STREAM; i < num_entries; i++) { ep = exfat_get_dentry_cached(es, i); if (!exfat_validate_entry(exfat_get_entry_type(ep), &mode)) goto put_es; diff --git a/fs/exfat/inode.c b/fs/exfat/inode.c index a84eae72556d..dac5001bae9e 100644 --- a/fs/exfat/inode.c +++ b/fs/exfat/inode.c @@ -44,8 +44,8 @@ int __exfat_write_inode(struct inode *inode, int sync) /* get the directory entry of given file or directory */ if (exfat_get_dentry_set(&es, sb, &(ei->dir), ei->entry, ES_ALL_ENTRIES)) return -EIO; - ep = exfat_get_dentry_cached(&es, 0); - ep2 = exfat_get_dentry_cached(&es, 1); + ep = exfat_get_dentry_cached(&es, ES_IDX_FILE); + ep2 = exfat_get_dentry_cached(&es, ES_IDX_STREAM); ep->dentry.file.attr = cpu_to_le16(exfat_make_attr(inode)); diff --git a/fs/exfat/namei.c b/fs/exfat/namei.c index 57510d7f58cf..01e4e8c60bbe 100644 --- a/fs/exfat/namei.c +++ b/fs/exfat/namei.c @@ -646,8 +646,8 @@ static int exfat_find(struct inode *dir, struct qstr *qname, dentry = hint_opt.eidx; if (exfat_get_dentry_set(&es, sb, &cdir, dentry, ES_2_ENTRIES)) return -EIO; - ep = exfat_get_dentry_cached(&es, 0); - ep2 = exfat_get_dentry_cached(&es, 1); + ep = exfat_get_dentry_cached(&es, ES_IDX_FILE); + ep2 = exfat_get_dentry_cached(&es, ES_IDX_STREAM); info->type = exfat_get_entry_type(ep); info->attr = le16_to_cpu(ep->dentry.file.attr);