From patchwork Thu Nov 17 05:46:16 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: 13046156 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C110BC433FE for ; Thu, 17 Nov 2022 05:46:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234754AbiKQFqn (ORCPT ); Thu, 17 Nov 2022 00:46:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229706AbiKQFqk (ORCPT ); Thu, 17 Nov 2022 00:46:40 -0500 Received: from mx08-001d1705.pphosted.com (mx08-001d1705.pphosted.com [185.183.30.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 845815F856; Wed, 16 Nov 2022 21:46:39 -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 2AH3dCjF002252; Thu, 17 Nov 2022 05:46:22 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=ynyCX91+qKXzvHhkZ2kQzl6p4NUmG408AcZXWEyV5aY=; b=nYF8kIIQjZMKaYyTwxXPV11BbSL31CZOWLuyTKGw1iKDZam008Qb5aV+rWOaOxclWbp6 Yg147F2SriJfraN5g/Ks+pE0UX0CrkjoALuKBhBioC8KDKK5vDH6QlmmpbuBAWHoTdL9 W49QbZi1GxQQvBDvMracwmtYCDKdmyyFWYAqyMhxPu2XAZrIPb9t6lGno24hWWHRGG9N VbFISsoWfz90g9zf7BhUC5i/ercbwTujxmun/PEmihFtEqBBuz3CCPYA7ZjeOk+y8i+s d6E9JNGfcZivmyKHyROgRIW68L5zUy1blKeXdiGGJXeWhqvoVAGOTHwo2Qcuf9XLP6Oo gA== Received: from apc01-psa-obe.outbound.protection.outlook.com (mail-psaapc01lp2043.outbound.protection.outlook.com [104.47.26.43]) by mx08-001d1705.pphosted.com (PPS) with ESMTPS id 3kv3jmtjab-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Nov 2022 05:46:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YsRfbZzIwq0K9UzHIx+/Zupk44Ae9KMQRKDG0kLKSd1YVR8xynYBqI4JzMuuhqfg9iXWsr5hj/2yZiKlCAETiJy+T3T+ITdZjzGdx5XW24oiLtU1qiafeCE5C4ry9PDhnq7qHp2y7qgZw7ifJMtpUWTjABCV5cJHLcSXmKViNqTt4Utod3XobGnsrDa0olP/DXkknVa/BJ21Upywva+MA1r5Tqdsu/O7di/hhy8KbP8DeKGh71mMJB4qtA1ROk0y0FZnElqw7OPLnZ0FkJ9hQv9AG6daSIKKaTToxrVy1wlsIJxbFvZ2m5UAgs72FozCD2Rdw1zZB/FUz4KORSzHgg== 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=ynyCX91+qKXzvHhkZ2kQzl6p4NUmG408AcZXWEyV5aY=; b=hDc/qUsI+BCS8iQVZt/fjUWzZV8ApY2a0QdAWz9dclUAxO5rY0wWQTFbEK55QpKMt/1rhfrDicQruxzsS4MvpTYcFDvBMirW/Ef4qAUWvsO1uPKsQOQWuPRbj2K5sRnRc/HUwBd/FxsusnIxxnq392PUhh8fBah6cPscd6+LFT/ZEc+GmK8KghSbHjHonZ8gh8iSHcBGlEeKa78fS4tC1U6AdE1GIDLud/6qN6I1rjwnMmaXSE1d1gHKr525wsuM0X3sc9E/3+zMB/7aSYMXsow9dW6wH37VmST3NU0uDGQ03xs2MHJ4EmhPyQPDfVR4E1Fh6fgp64XPxAymkc/7xQ== 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 PSAPR04MB4134.apcprd04.prod.outlook.com (2603:1096:301:38::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5834.9; Thu, 17 Nov 2022 05:46:16 +0000 Received: from PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::708b:1447:3c12:c222]) by PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::708b:1447:3c12:c222%7]) with mapi id 15.20.5834.007; Thu, 17 Nov 2022 05:46:16 +0000 From: "Yuezhang.Mo@sony.com" To: Namjae Jeon , Sungjong Seo CC: linux-kernel , linux-fsdevel , "Andy.Wu@sony.com" , "Wataru.Aoyama@sony.com" Subject: [PATCH v1 1/5] exfat: reduce the size of exfat_entry_set_cache Thread-Topic: [PATCH v1 1/5] exfat: reduce the size of exfat_entry_set_cache Thread-Index: Adj6RgjM4RrwzVx0Tk+pTmebpSgl7Q== Date: Thu, 17 Nov 2022 05:46:16 +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_|PSAPR04MB4134:EE_ x-ms-office365-filtering-correlation-id: 0f05fea6-c07e-4a3f-3b29-08dac85f0b46 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: cKVGPCfwaX3STrgz2OUEy0mk+4YXP4094nS478G0KQE4RPXi0BpR81LsuBl3sSxOJBPxiZoWAdnt/bHX/rMC0rd93+2oG+4284bb8+qSpR6PS4mIhtFtmXvDI3COfBY3sb6+zVQJm+Be4NNCL/SHzXLsGbZ7iZ+vywB22vHeHPTVtjYnctstv4nbU2DqJ3IHrWCq01NhmKA8+9rQ6Y8GJTXZBRulVT51WqJDfoGxQhm6R8rJK85fVWeNYRyGrX6pCAq7x3R6g1Dkt+9qYLGlbf1jj/TdAGEk3ockeUzj2Lz0g40ARQIE5THIPgb+eaOiSPi/sfGBHVCT5DVw3mbDzxSSrtBlpdsdJBvKzjAzsvUbGZpELn7q1G9TiR7XsuTp2PbKxAUkARlOyJYoKBSMjr6vZ/KvJLOzVwDcn9xfBqKS+OO1cvEbGru0qIxEGxDTG3FMEXUdb4khzBHhvSm0jtmQazu7XRh0jJ/x8CtIu5Ufsj1yJmeplzjtGtLFTtEDLj4f9TAqHeN3d2Iix+cnHIsNbo0PHSVbQm9T90BuncbgVpP4CpTguTrjlSiJMlEfVKUJhKZHKLRU/mRbsJ5ahbcqUSwqsuE5fW0Fry8yVxxe2WfYoebUtbh3fViTR+Qfvl0yBBYCz7VPlIUcwulDV/2QoQzkeuZ/B7wkM47rXQb0N1cxtTB+pqT/XqzIsKCQ/hxnC7Z2O+5nByJoE+ACGA== 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)(136003)(346002)(376002)(39860400002)(366004)(396003)(451199015)(33656002)(316002)(110136005)(186003)(38070700005)(54906003)(71200400001)(107886003)(83380400001)(6506007)(26005)(478600001)(7696005)(9686003)(2906002)(86362001)(55016003)(66476007)(66556008)(66946007)(76116006)(64756008)(66446008)(8676002)(5660300002)(4326008)(8936002)(52536014)(38100700002)(82960400001)(41300700001)(122000001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?/0UvkCSrixtQ0H9fa4HbLg5lIcN1?= =?utf-8?q?UC778PHfk6njnQibwDbiYxsMjLJVJAkS9tEBJR5GUbUpNXvn0BM2RhVsaL2x52CDa?= =?utf-8?q?+ZiFcq/Rp2lMSdbIFzFaeZ4Gw0SAjcML7AWCT50imbFOuNBhwEFZNuh65v1hsEa5o?= =?utf-8?q?W9hSDHyTb3rS5jGgbiB+1B0HrBa8gitO7F+4YJ3BeBj/IsjT3kQq4lPeD1SA84OpB?= =?utf-8?q?sbB1L/MDmh+7b3CGDy7ybmYNksjp+8koP89KeZNI3OKAWh0W9t5WxdSzbAH3KZgbm?= =?utf-8?q?JVAakiwoqBYKdPaQD5SYu51g8IX7pjUwz7oRQ1g6Wdk49RWkimvXg83ppgnCFVn2v?= =?utf-8?q?Kh50ucCqall0iZAXLbdv0lG/hEBLpgosWlEza3pshWDQcGCjCy6S3lkd79fgf/LEK?= =?utf-8?q?GqNMDFvktA5/xVAYcZXTuygI30bAK35z15SscjvMMO9IM2HS99vl8bbSEA+IRXKvX?= =?utf-8?q?txQetXtQSy0aeaBRb15X4c+o+WVn/8RhEDU1zrjk985ZRpDpNF5aDBZKYHzWMsTX6?= =?utf-8?q?wBWkSVTg7zyr2uP4ph68g0kDh8PXDxw+zPNqtzTuQ6rzloZzGVwmAab+ZL3vwRdEe?= =?utf-8?q?hwsej14yG/1G2Zwxc4VxFY2QLY+dBv42tls4db6h/wice3WKy+IgWdhpuKtYTUSEG?= =?utf-8?q?7TYf9bv51dp9/bBr2TIu+oYD+1U6LzeCCT/abgHx/4QnA6t+rtXHzE42wDivBrTk5?= =?utf-8?q?26lOxwUaJiyFrw1MGVkKftohNGQGC5J/bgWL9B8NDlCxV/397+HP1QHEKOBxaApUe?= =?utf-8?q?4JdK8izmu+YVhDX5S5Sdv/zIUMTDEl0N/0+GZf/DKYExhkXM3ztImu00qN9RwornB?= =?utf-8?q?U/1QFfYhcmkL78fZvnXlqktQzD6MAJthwsPe3XmfFzWV7dkbOzoYbROHfJ5fJhY77?= =?utf-8?q?15TD99YHB/Abm1FFERgvtHmQaWsCLfxIIFzY+IlThapPAKyWBVRpFGltzF+GzNAtT?= =?utf-8?q?f4Fq8isYTuypardWPZ4bdQG8L30fUotLNKL8vQ/jC3oB4c6DZxFtTih+3Yt6ij6FA?= =?utf-8?q?60yDGRqBHcdeE5dUMyEFRm7HL0Zkzod6KwzJwXdEpZ+q2HXIyhKeweuojOD7eMS0m?= =?utf-8?q?Ld4lPLJTSJtqzu8RjUnjwUdB6FrUkStKkECvB0pl7XKahWFZEZYn4bwQgOizXHYRG?= =?utf-8?q?XfRS4IZ/JjismUamgSHRH4dqK/0y+0w+38Uv6txK4GU98CH85q++jv5mMewE9LSk/?= =?utf-8?q?HwMoZp2FMHZXQDCV6r/eK8CklTsFaQnuU7ARHDV/Nmzv27DM5a/18EUGm8fB2pr4V?= =?utf-8?q?E6Ph9nvvMrrSZDAuMLeYAFXgzmTtl5/emEnr5UQKt0MfT1blhW9FgT5FF2IC5LgZC?= =?utf-8?q?rRHC6WcS8diimLY68/I6LiHFiST6IuvuyrqROtKxl7Mwe0wdHKmN98SqRk0E6WKl6?= =?utf-8?q?y7hFhqx2uScUo/tPktBSS/ukLwGBbDcaAirU0KY5WOtqIGEQDvWGkEMlUC8bAeIpd?= =?utf-8?q?PVj2QwoHrnOeLq6L16yF9/xUfucNvUPWtEJeRg4x7m0BSQLBw9QXmNCTkKPs1xTp6?= =?utf-8?q?0zw0LH4TGrP2?= MIME-Version: 1.0 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: bnbr9+7D6b9C//hJ/PgTPK+HKFHb0xLCTaNC7uCp0ySWz+7Bt3gnUDu0Xr5rHIr2oyGOz7S8cQ8Lri5T462VWTMj//fLMvWpn3jiywAPquD4qtWC4C8i3/cjAuyNtTP007IxF99hIfY5vtxP4xcsHX46/8rClCRBrCfW3/3P0xRWpdflKBCVCDhBhAy/S1pAtB+NMtK4fFbuo4LsfN2TNI2jXzn/iYbd/0lzr69IYDesqvFbnc4nb8MgvY6DYVUSTrDcGeHPiLAU9TYJ4lIu9OSL7IsMseXMkwlHvMO7KdD2awpkaX+me3HGhlh0C1x+O07UD9m7YbpNu33f6GJKU9Z4UBebCCA2wFQyoa6nEnUpT2ZgJ988s8JpeB/hSDZWfKWJoxKrpyqwx7/D+Gkqdf2Nj7i22MWthhhOs+VtjbCIXSihV5is/cMhrMOFpO/C0+Zg4DrYxUJUScVspzATyGyeNRuItEyAjJdhDqFM5MD6V8Xm87aTbLyPtaHk1YdjgOgJcmxig5UQXg8VV+JZxY02hgD2eQSxSighkFWKJ3fU7xXfzeZboivgxfwTVKVR7JdyOVUC4/vnbC6WxLGX721+Sx0m5N6LEV6/wBoOWtuBXDy4VRp6yvlZ3QN8//y4wMttm8yfIrpNI+111JhPbc4WK3t94ltyWYEUJML0FrYtr8467s9z3VRzLLsemJyIacM4nC/XXtBHpQJb578cGAWNEOVBTbEbfrejXbkFfNonGMBz1UrXPtTnyVrwWRuHDGwFXQGEAJrXtuco+ySgN6vCrlMZJp1djjDIOUovQ5xzKUd4zCs4noFYt8EkspMkctzgk7i3dFHMQiVy36GSHGnce1JGA+VxFc7KbyMZBjF9BQShxxEk7nq+VV2ejIL2 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: 0f05fea6-c07e-4a3f-3b29-08dac85f0b46 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Nov 2022 05:46:16.2634 (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: tqdR1xgG3CUIzKMjUnUh3hUJObxDQPk6pxKCd6PpcSq22evCnR9E3/9nRx8Hzm5EP3wlWKy0Aa0BQswNsaZn8w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PSAPR04MB4134 X-Proofpoint-ORIG-GUID: qH7KW5O6m-y3xKEaRKlogaOXXF6BOZMU X-Proofpoint-GUID: qH7KW5O6m-y3xKEaRKlogaOXXF6BOZMU X-Sony-Outbound-GUID: qH7KW5O6m-y3xKEaRKlogaOXXF6BOZMU 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-17_02,2022-11-16_01,2022-06-22_01 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org 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 | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/fs/exfat/exfat_fs.h b/fs/exfat/exfat_fs.h index a8f8eee4937c..7d2493cda5d8 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_FILE_ENTRY 0 +#define ES_STREAM_ENTRY 1 +#define ES_FIRST_FILENAME_ENTRY 2 +#define EXFAT_FILENAME_ENTRY_NUM(name_len) \ + DIV_ROUND_UP(name_len, EXFAT_FILE_NAME_LEN) +#define ES_LAST_FILENAME_ENTRY(name_len) \ + (ES_FIRST_FILENAME_ENTRY + EXFAT_FILENAME_ENTRY_NUM(name_len)) + #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,16 @@ enum { #define BITS_PER_BYTE_MASK 0x7 #define IGNORED_BITS_REMAINED(clu, clu_base) ((1 << ((clu) - (clu_base))) - 1) +/* 19 entries = 1 file entry + 1 stream entry + 17 filename entries */ +#define ES_MAX_ENTRY_NUM ES_LAST_FILENAME_ENTRY(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 +182,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 17 05:46:56 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: 13046159 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5872AC433FE for ; Thu, 17 Nov 2022 05:48:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239142AbiKQFsY (ORCPT ); Thu, 17 Nov 2022 00:48:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239283AbiKQFrm (ORCPT ); Thu, 17 Nov 2022 00:47:42 -0500 Received: from mx08-001d1705.pphosted.com (mx08-001d1705.pphosted.com [185.183.30.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE4196F345; Wed, 16 Nov 2022 21:47:18 -0800 (PST) Received: from pps.filterd (m0209318.ppops.net [127.0.0.1]) by mx08-001d1705.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AH2rpXC013925; Thu, 17 Nov 2022 05:47:08 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=s9nYSSvrzuXC4t4tRiuFVyOoiBidvlyeIo/S/pFhUN8=; b=YNWmwXYz9BHNqJxSFrQN9ALebtpvVn3MD7L9AmCo9zFxWVIszLezC1UlMrWxv5ma5MY4 oARok6jzSZkopQvPUndLtKqwyWGGg8WSPkmUxkwOLUoPIoNfeh7D5gXYBF8fk0NIRU0b PR0Mo67vs1EMwILAGm32Qtu1Kv6Lyw2jid4aVd/HHpq6kTHc/rF66kZPIk2Vs7BKIdDD 1T1HSXxgf2Yw51AuD7R4f0QtGm+SWfMJlS1mWSwMQvDOSD+c95vy6UxUXpe0WE2sfcvf spx+NgVpfhf5Kr7fyNpZwR+VzikuwRnisMRRAQ5LT3JOCMW9kRa2Tmrl6wXWGKtmoJzo uA== Received: from apc01-tyz-obe.outbound.protection.outlook.com (mail-tyzapc01lp2044.outbound.protection.outlook.com [104.47.110.44]) by mx08-001d1705.pphosted.com (PPS) with ESMTPS id 3kvwhpgxpx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Nov 2022 05:47:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=meHWt1nF9OZ3e3HK1QO7UArItyFiR1t6H10ahNqqP8hW8koVwH4WwzdRdHOFlRY6mJObydOZ9kyF+vbuISrq0WHCrwKlpoPhq4/2Rx/ARwBDz+JDs9BbZf55WZE0J05l6fUWVuGq4+AjX0JGnj3KSbvD8M/xMhHNM4UJ++Bcvr7jSxQaJMgUHj5qMxFqPkdb8/pk7mbnY/ivPj02/hAf/GL8l3VxT887le6q/wqnwaF8f5zXX9Tjk6jj3piubpnvSpFlJsY+26sIH3uNVsV8eWs3qy3w4LXmsMnUwrgKp5yaaVwHU8r4KbWCTsOH4qiSQZKNqzQex+wmj4e02144YA== 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=s9nYSSvrzuXC4t4tRiuFVyOoiBidvlyeIo/S/pFhUN8=; b=oEWDkhF+d/0tXIvMLJ8tf+Voe3NEy468R8Q9LPup/18IVrorxnAhgz9eN8ksVJ7C5B4BM82WDTLuL043i9QIJkFumBgpJPbroGT/uKZHIt1nwd7+2wZ/GBWy8Pi/wfA4at8uZWyY0jkxdqGfuA/dKBUTN5w709i6NYtGHAu2gmx2pPBH2i+58SX2D3qnqHpmOGDEPcR3F6norN+0cS8jB2mD4yIRzelRZE5d/YO6fAw93R+TnrEb4+3UkjLGd+Zyzqfo1R+9JBJFvNZjep1XFVgMAeoHw+pfzZ6Hnd9Przqzef+qmS2TJ4BincSN4fQfjZISJpEjEPir3H6EX350Rg== 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 PSAPR04MB4134.apcprd04.prod.outlook.com (2603:1096:301:38::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5834.9; Thu, 17 Nov 2022 05:46:56 +0000 Received: from PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::708b:1447:3c12:c222]) by PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::708b:1447:3c12:c222%7]) with mapi id 15.20.5834.007; Thu, 17 Nov 2022 05:46:56 +0000 From: "Yuezhang.Mo@sony.com" To: Namjae Jeon , Sungjong Seo CC: linux-kernel , linux-fsdevel , "Andy.Wu@sony.com" , "Wataru.Aoyama@sony.com" Subject: [PATCH v1 2/5] exfat: support dynamic allocate bh for exfat_entry_set_cache Thread-Topic: [PATCH v1 2/5] exfat: support dynamic allocate bh for exfat_entry_set_cache Thread-Index: Adj6RlW0h6tBo002TMOVyOUUojuPWw== Date: Thu, 17 Nov 2022 05:46:56 +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_|PSAPR04MB4134:EE_ x-ms-office365-filtering-correlation-id: 478d3d83-1bde-4bfe-c5bb-08dac85f2364 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: /ryJaA3DiNi7c/i5wcJaXdeNU2YO/O1yhp8MjoYgXEa86TRbiWVyj2EqxE8vctIHCVNms9Q3CrzSRP36SUgYJnQkqtM6L68HCLR/Kgele2Y3bk21QfSyLv6lcmJzbMFXPJo02YCxltZTpeMZlxP2TsSGeO1+MbGaZmlmQ1DpwbEUCXBUNCpu7nNm2Gd50MSLP0uyfIk9jeiE1dii835+VI6FMUZQa7kGsphnPuwsewpherxCshuL2ox92JSFyLrxIuJJwO9oA1qrpKEAQYi5tG8yIaMLahnqSD9cqhY/JpUDbMJXt/G/EEc5QXxWXip4dO+an7GQO9g+WS+sUq8xv+QQ4jY3DYPwbpbCvwqxEx/Ei2g9u+n3cr1SYDD/5r/6TEEjpzweE+Z/3qAvIzChzH13PPykF+57ESQVHoT3N2J9TARCPFAdM8WQsGN5s/kFfFrSsDnwr/Pm8S1p1pKv34jCwYVqZkV/Nl0w8P7AwDAIqe/xWtYs6Rz2tBR2ERO8eRoLipiJZlXg4ZA95vcHiqm8WoldtsrSE82IvvX0gtRv2wutM3JchZgxA0MJRCkl3kYb7l8aVPBiq9+uGXNoKU/d4OC0yQModsq1lheMVI3hbDiH6tbiarikDRRggA1LFv71MLMK8OjVhzzzKHsAxJZ4qKNFOpiYP7O8uKJLp8J+BYgW/5l/cCJfCowL/AYG0mjt1pd5o997Yq7dMn9Amw== 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)(136003)(346002)(376002)(39860400002)(366004)(396003)(451199015)(33656002)(316002)(110136005)(186003)(38070700005)(54906003)(71200400001)(107886003)(83380400001)(6506007)(26005)(478600001)(7696005)(9686003)(2906002)(86362001)(55016003)(66476007)(66556008)(66946007)(76116006)(64756008)(66446008)(8676002)(5660300002)(4326008)(8936002)(52536014)(38100700002)(82960400001)(41300700001)(122000001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?AunPorKaWfH8yc+JS3v7tiWkLWwe?= =?utf-8?q?wGIELdGZlhWrVl64gqCm0p2oJFyVrNtLpNo/TXCKWTdv05Y7NP7sMdstYKISEEhuH?= =?utf-8?q?Fb9Z6Z5MLH720GXtJWrE809sxROltaO5TS1yv/V4wr5CK1PegrYeLyQRtZbxRhjY9?= =?utf-8?q?2iT9iqQNrs22PD2ZEMBYP6wnuP49AyGALnRceiKs7e09lzjFoiFvBZk+owWJHhlaT?= =?utf-8?q?PFF3XTX1dLQK1FXpgRzLHWLzvBDDhO987SrxDOdDdol3l3dvC6EhBrJUUzoMwfRCA?= =?utf-8?q?1jsgufzSXfLyjZuHChpL+4k4pQVEf+Tgw/XsHMV2MroRbsm99R4Er/vLd2BpS0E2n?= =?utf-8?q?H+XDvLYEPRw9PIwwbeBorJtYrDd2oY1HworIJjoohRBhXxd2xuHyqJsKZxnshei1/?= =?utf-8?q?LtV5aKc3+krVBIwJ4pG+fBJSQ7Ee8457e0MlDTIlDCCskefOXlLr0sNKt9yDPGqLb?= =?utf-8?q?8LJMBFhdQSlo2PeWR+VEtSUk7txnIIjP/R316WtMp5ObCWtQGcmb3MdFoHmkQgc03?= =?utf-8?q?fshzKwIY193ru13jTqYdGjlZE4uYP09PZ/LsXTdZP/qwEqnj5baf4EORw21a+14lF?= =?utf-8?q?bLRRZg3ms3yKfGt7scKyYPb8Krc0BKubQ6LHyqY63kFNxBLvXHOgo64n24mCVttEZ?= =?utf-8?q?aOMKt9Hh8t2BpQORCVrjwbhT1nHQv4vb4FNZNAmy3LSJgGw+Ty+08aE1NpkoWFcHN?= =?utf-8?q?oRdOikNJWVKYPWAObbVPtwrzHXoh5T6ORv2AdTmIQS57yqcyNcdgb2ASPOPT42dBE?= =?utf-8?q?D9eXGpyYuilGheDLAj3w2+g116fky+W15E1+ahCt9JXuasGd/oyEKeazWUHphAYpS?= =?utf-8?q?nkXZS3af/Ro3njlQ5ZZ3/tinlzXdbTR7N7MKlgyEHa+ZeOMJ28Xtqo//ewrQckdnG?= =?utf-8?q?8smgFP/+9BWTNb2lDz+XShTGTAU8EdYR6okmryd0JRKT9Rq5P2ftiMd36LhTdA1Q8?= =?utf-8?q?79REwpxqrtrdm9Qgdt19hrowsiG126qBugxFYCi46otTHJi7cGRTZvSRDvGAhaSl1?= =?utf-8?q?sMmmtFkb2jF5QwQM7A95tthaNz8DItLiyY9H1/exhim9SEqEAMaOxNdpnXVV8W+MW?= =?utf-8?q?10PlZeOSnL6VCNahxIBKUZm39wUpGIbvCGO/Pc1STR8PaNyIbJCtl22biH45ad6uR?= =?utf-8?q?dvzClqJp/v88rRUj4Gnc1E9Hsg9I9FxN7PnuSi3xZZGMCFwundODcFdzMxnMytVY5?= =?utf-8?q?VvYM9a9/ZSQ3UPC5fz2+wNbxtP57OqBO8XUwyyUxeK4hnFrF6cG/E4r1l7ynogpF3?= =?utf-8?q?PWNqPLwm7uu3DCgM2EbOe7RA7e8MKcnQKj5cj/Ih3wZkkl6GRbWI+h1R8l3i4nFSD?= =?utf-8?q?wvbxaeKC/KOeQ/q+YjAH7lGF7Brye9GNwNUTIukX/8RYDsNIyOLruJBGBWjp4n70L?= =?utf-8?q?9zUwhzggkvu9Bs+Lh/QGgKeU57J6f9oxGhcycUJxbIKTD5CDMCXJfZmtXOSKbQ6Sy?= =?utf-8?q?boOIPua8S/lKp9g9qDhGAzga926vX4npv8EUGXTFseVbdOptQZ2lNFVvtQmYh6DsF?= =?utf-8?q?dtCFV4n/cKbS?= MIME-Version: 1.0 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 6GXGN31fta0yQ3HQXB6oghIzp4W+O3xABf8WTnAP/PiVwPm5HYpTRFUkV2F/sdaPxT0rZolJ51LcEi27t+h0jVdkfEpjJoWA7potK8d7d4npoKXgY7ucnOzJBB8U3vJIMcffheENzcrMwcOTb3Go199DDaSoVym/vz96e/3tapdx0X05+gewzUs2KAAS4NU8WGzeQdTOcwi5xbcmUfUlapsGY5+dyZgbo25C1FBTxppPfRuVaYGppQCy50VwpeL9EB92AhD2x6v5rDXgu2FsG422RBKg+FX5L/wC/u7aIikmh+4NBAFW9e108xiiuNl2yLhltKn4w+v2HFMrZk6UOhmgImSCimd42kt7nJuL8O7gJAitUGg1HCMFpxJPTcycVTD8kWSmL1/APwthmjg9q6khEZteg+IpDFRJxFUCVzWCwAiU+Qq1Rrbz+h6xIJniGNpnRyLe8giOJwSwT+LHM0UhseRPWx1Zjuf0VOW52XngRGQdJS8/uWoYLsSWMydsp+/khqhRdD0zS6pHyuQ+OWRRP8YtufOjR5SEXbt4ITnBHLCEQqJ5QsaGDDdXrTIt3OxvQWCuNhOd3YuGpEjZY6fu/DngrgfglHBOjVhGh/0hsFvmyCiN7Ve7pcjFHgs+cWEaHFnjkLxo6v6aVJV5AvE8G/+H4FisycsAKbFurfgYey7cFocrGxVc1z12xxzD6mC5rte+6po1jfNMApesZXATXaWWtvdp8/7FiAbF1yAjZ9SNcuJWlfkYuGQA/dJ6NSYpiwU9V3YLkzz5mrZr9bP+btqTGWJg/3yQ42ZCygc2Y8ygDSuIVrLIVOpnLoha9mZ00+YNKcNF8gGkTJ+EtFTH8wquioA3Y4Lu9ribGM9XNsFm8KcV1WW5fCUcS1ED 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: 478d3d83-1bde-4bfe-c5bb-08dac85f2364 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Nov 2022 05:46:56.6963 (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: YZdYQUTEbm5ZkyC8B/oLHMg5xtRlhhXM6pnvvnE+Mjw7/zEpn65g+scKvNQqeNvSii6P35Wj+Qh0nsQHwP13rA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PSAPR04MB4134 X-Proofpoint-GUID: 822aN-kN3FM5WGLczgZ_DxNak25mcitc X-Proofpoint-ORIG-GUID: 822aN-kN3FM5WGLczgZ_DxNak25mcitc X-Sony-Outbound-GUID: 822aN-kN3FM5WGLczgZ_DxNak25mcitc 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-17_02,2022-11-16_01,2022-06-22_01 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org 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(-) 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 7d2493cda5d8..33a3d544365a 100644 --- a/fs/exfat/exfat_fs.h +++ b/fs/exfat/exfat_fs.h @@ -184,11 +184,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 17 05:47:07 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: 13046160 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A78BBC4332F for ; Thu, 17 Nov 2022 05:48:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239224AbiKQFs0 (ORCPT ); Thu, 17 Nov 2022 00:48:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239284AbiKQFrm (ORCPT ); Thu, 17 Nov 2022 00:47:42 -0500 Received: from mx07-001d1705.pphosted.com (mx07-001d1705.pphosted.com [185.132.183.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC4206F364; Wed, 16 Nov 2022 21:47:24 -0800 (PST) Received: from pps.filterd (m0209328.ppops.net [127.0.0.1]) by mx08-001d1705.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AH5XDVk025497; Thu, 17 Nov 2022 05:47:14 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=pfrryum0nwBqLaw6YnsxOdwqLWKcFnA35ooE0Dq9NKc=; b=p9zsiIvCFk/sdlVaAlZbHLZheZRJvXUb+1shh783V7ntXK8j3BsA3jaIgScFG1FiuWYr OWr/zm9biWVVAuELsXKl204uTHfpi/UATrItMzMgG7JKqUty1ZJy5MvcIpUvG3k35U5m jp9PBoZlqmWNhNnN3TG7pCLiKfT5E3CAcLroM1LHyp/qB2AXcQcLAmiyuqyA9QAyXxpR ddQGUevW7GpCdrlD0Rsq72Lj11vdPnP25vJ4mGns6aCHtN1ka3ALe5/DANcxw1ZZf9hT gSDGrorwhifnuqiZYhFPwPlP/Z4iB4ce8g3bjn1S2zFE6YyGO39Xv5FwYQP5dIOMdcU7 GQ== Received: from apc01-psa-obe.outbound.protection.outlook.com (mail-psaapc01lp2046.outbound.protection.outlook.com [104.47.26.46]) by mx08-001d1705.pphosted.com (PPS) with ESMTPS id 3kvvy510ff-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Nov 2022 05:47:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FPaAmVIEai7zjEHy2emwHGvXOUCBH8LJv7dJPSGknmVd79mS/5fGcT+/7IUjMS+s7M1Q2uqDJ/Vb1jyS6cu7GSqF90siHFnT2R5pDENba9z/3+A1XCZxnjWE05ZSTFC4NCIEiLKkVdxz2DyDk128CHUD4PgzEai5WLeiEBtuLyHPTyHN6LYqwDkAEQlMf8v0kyvyIXp3NRo9LbT7nSKFygnUaHBCgS3ZcewSNqsGBfecYsh+KPdXyQZRXxnVHITCVXICG46l5W2ACXWi1J3Ov8mzT/nQX1m60Ij47NwPZPoG8prgla2KBypUg51ln7G9kMuCWK4kS+h/8LGZ4LSccQ== 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=pfrryum0nwBqLaw6YnsxOdwqLWKcFnA35ooE0Dq9NKc=; b=KS+FhlpGInoEuheAqA3wkvRVW/FHx+ka8dfgP9otJazq+xtVofEQKItVny3pY/0wnoC7lS8Zh49VrOk1oZQlXf4YcU8HQiDUrb3lssBuXKKUP4dcOK1Hs11fl4AjL8SXfi1MK0A+U2gbuQkIwGoU0muAZGFvQ+zKWOIxvEMWoCHOLBtAKS9q1Pb9P3smDCAKCjMFTDUPfe6MOnb0D7AVR/k8+ttfKFn9t2pUeiWA0Rr7C+CikNuFKVXMlPK/6a3S81aSx8qzWvFQZcs55hvuHjqaYwoi0Mw3vpdNA0nQF1ByG6xBspshfcQ+h1Um8EYtNSwVK7kfVyJ4XNxEMgFuQA== 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 PSAPR04MB4134.apcprd04.prod.outlook.com (2603:1096:301:38::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5834.9; Thu, 17 Nov 2022 05:47:07 +0000 Received: from PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::708b:1447:3c12:c222]) by PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::708b:1447:3c12:c222%7]) with mapi id 15.20.5834.007; Thu, 17 Nov 2022 05:47:07 +0000 From: "Yuezhang.Mo@sony.com" To: Namjae Jeon , Sungjong Seo CC: linux-kernel , linux-fsdevel , "Andy.Wu@sony.com" , "Wataru.Aoyama@sony.com" Subject: [PATCH v1 3/5] exfat: move exfat_entry_set_cache from heap to stack Thread-Topic: [PATCH v1 3/5] exfat: move exfat_entry_set_cache from heap to stack Thread-Index: Adj6RpvVSF/KosGjSpqM8sfPQ61zOA== Date: Thu, 17 Nov 2022 05:47:07 +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_|PSAPR04MB4134:EE_ x-ms-office365-filtering-correlation-id: 967433f4-de90-48f7-4c04-08dac85f29fd x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: ClphalQ4xAofbc5pNJ3mceTO4o1FaVJKuvKQ4W2k42C6Yc/0TZX9DIwRc0xPizjh9LttxGqjY07poD+HnJ0b/jY4Fc57uGzLbv3hrReyrRwnoVeFvMgPef1l4nNSMmjxB/QNr+v9uZSsJWbzQzvO5pN38DuwWuqD+qVReBgqrEI92SQbddC5exdOVrqqpiygwmyqV0kxgHN2bGQ8z/2CPiHM+I7iPBMSu3EfRYUbM9nycD4Msp0YTzVsp3iHjFabu9Fnj5m9UZAnaF4r1NJEdpSSKOJUlIfwFemw8YNtCe1BskEPYxpcxWdJA5KI7VLewcnr9kj9VwMw46sU9ihrBXYLEO7qAIJdJ5X2r0oAWyyRQAQjLg1qZgnmdSQ7e7SoWq1oSmag4jxbYOeR2Wv/xZdAZMy0zadaGs4FzUQQbrEMjMOfjQvvcnV+PbzXF4DfWzkBpii6HN6IxUIusYpD5e1+vjpOIL4FBxtckZPxwAKl2qTNCnqwiEqTOzvHKg69gC1gz4CGR/NsxIHBpPe9Z83FvMp+OpNNSHF9ZeS2uPxL1VvOiD8xSus5sEFdXUbBK2/Cm5NuWYOeM2V9pecmWzqSikICeS/LgctIzOTGPIPPSicSiRwpwxX/QyPEc+czxJHA919iX3SoPF8rImgTaksrNAgFSyyPWsRhD145I5q6kV9z/Y5i1iwyuCM1jKj4VWopKKD6jpd9dHV1CWmwug== 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)(136003)(346002)(376002)(39860400002)(366004)(396003)(451199015)(33656002)(316002)(110136005)(186003)(38070700005)(54906003)(71200400001)(107886003)(83380400001)(6506007)(26005)(478600001)(7696005)(9686003)(2906002)(86362001)(55016003)(66476007)(66556008)(66946007)(76116006)(64756008)(66446008)(8676002)(5660300002)(4326008)(8936002)(52536014)(38100700002)(82960400001)(41300700001)(122000001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?p78D9c0n963vfRAagSf7wH5arFJ1?= =?utf-8?q?RFRFqyI7jtvfcX8mWMriH077m/OqAegXa6yI+OVQy3XAecuqgdn5xdX/NmhIpoxxg?= =?utf-8?q?YlFKcVlZc+d8NEO9LaDifkZOw3421zqZ/zToTFf8W+KQO5LXqlu6kVzOz6SDjzjRi?= =?utf-8?q?kCGdUjJ9PVhx79bXyu5sCWHVvoh2uo2fhwMdZJ/01+KKDEqyaRhA+5EFm90XWeh/P?= =?utf-8?q?G8LLxK1wMauf6O++G2EGD50OLwOtxSeze7wRrc55M3M+AaiZXS4xVLO44qv3hTmKd?= =?utf-8?q?p1s8l++ktcWorHX4x6u2posEBRWBvII02aqE//HmVzAo77NQlczfGTRAolhU07Zcn?= =?utf-8?q?QhKNeJ58QeH8X0pBVyh9ak1RSN8apUCUS4dS/pYAvx9EvCPzMBS8GOBQxjb1uCtBT?= =?utf-8?q?MoWgA9VAnRKVzZJ/RJggGK9E7ctuMMaP/EbuJZt9nje5VskqrYvDUryJWMJYxt5iK?= =?utf-8?q?+M28oLGPjm2m5l9sAZ3W7hahVJM3exzUNHDyiN9ZrO6srBbGyIBt2keUR0fUx6m/4?= =?utf-8?q?WL2QaM8KuzKs6Dgb6FIOhRS5eKawooUY8nAfEBUoKcYg3Pem+mbq4TfcOgRM6YkqQ?= =?utf-8?q?iZzjbjhJ9NYEOZ/tg+etO2EkxcogMaWOQHTWGyRlOTF5TLwv6Tky/PCFaVwbeDv1G?= =?utf-8?q?y/nguO7JH6ZU0VibFppqgXySwjx/qieSdfvk1mpqWt9VNjT6lLFbpYJaEhNAxRrLu?= =?utf-8?q?hjpsYactxe0wMQpU6gpD2x7L33zNbTu3uFS+ZtTdBXf285Z3AMICwzqf84sc/y9Dk?= =?utf-8?q?/MQ1gsdxPdYHBFuo7olef3KNKDSwmUROeE00SqT37InR2ysuSynXaIm4kuNZP6LRN?= =?utf-8?q?9dx+ZC10prJiHm6YQQ0jHMTOabhvBO7bkKg2hF5k++zjhIVe07yzMviwMi+08Hibc?= =?utf-8?q?TRLUFw+VWQMOQMSQt6mcBmhYnc+0tRwtF7RX5AG05RnbUwy1kVVTM31R2eM0O2e0F?= =?utf-8?q?IF31oWGg1uXA4k4zPGcwWSGV/olvZTurC5HulWxRTFWoQ9I1h9Xaqm4ZyaD+JtuGC?= =?utf-8?q?qSYi/LiJHFX+DVtsDionUH5EADJlrKFAVOsvfNTgiayF3yk+wmwNREZnK//eVU5ul?= =?utf-8?q?6209umLo88TTBlJg59dTEsp0O+zTq8RPTn873hTD+EwIzITfVaHVWbrRqXxB64lYi?= =?utf-8?q?z5DaTZ6GINSOIjkllJzmtrrY1cwZuxe8GrrRMWoQmP4ifiA5/vZjV5U4Rbtz7yW0w?= =?utf-8?q?SjMMkE59PE1m9kykG65nrXZHAHXwGU6qCD8jb3xdxDxPnwX4xCJecMn4LOZinHxR/?= =?utf-8?q?XfVlnEbmHKDdxN9wHhvzCBevS8aA7gI3glG9ckEPxDv60+D7DOmxw1uqiXoIAWtAI?= =?utf-8?q?euHSlwwJF/XqhbWg8jkkksms2J8B6D+asIzYC9qSmb/IAlGVBV+Thrp9HkIIl8VrP?= =?utf-8?q?dU1qNBcfT46H5LFwnK3ODNZrWTlLVHwFtH8MYS0ejAYJMcXd7qNmY6dlyjDJNVE/z?= =?utf-8?q?r21+zAD20QYZFsyYilkXt2+UVkdPN7635f7XopjwmmiCp9cYu2ajbMpn6lVdOoQ6C?= =?utf-8?q?eBaAQtpaYNoe?= MIME-Version: 1.0 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: X1Gc1VgFRG1zX3RIndNVHNx/9QtJKo/MRGW7LdSSuB93fZQLlXW5/YyRFmbytXhjt6cmMFI5BOC7xGGflDkPVOCJXaGZcOniocawVo88BBTZXNmvuTt474YPSWKnVYzIhzvPyzV70PfGh43t+F4V4NwlsjA1bxBpofwV3NVPFJK2iuD9gICLrwNG3h0evOex5rp3TT0qbT3jDLc2eBsN5fkLOP8z15qzMY/DOXt6ORbQIUDQbuvzZyNMxutr5GQLaHbqEtfOpJ2ygvpUkbFcg2QEvVLEO+Fu3a1xRIxfehTD9V9IPiIG8Fm9rw8bdCWsKBbe1jMtQCIJlHfJdX2fSOBKXE91EqedAVyj6YHvc6v6JIujfUxY91EG+QDCpQeAESibBtjjpsHQ7wlB1mWDywZwWhTVtg1ANnY9NCLzNHc/9UxBZMALB+vUOAAo2mTJYM5pKI1cWNxQiAIF68VfzI81GcudWpiH5KSfYtQDuX1lGWls9VEQ5c/MkIztHQEcdy7y2BcDL1mVPdHvz32/y05u66bN8YKmkA4g22jxx8FW89dBgB+e37yAWujG6GHMMeKLUANCTdav5V0jKMCitZLFmcqWeuDyjmtscNY7rW5o9lRQuzVk1H5La0CHOx13hCvaIs7SZ2e7UqunPX3yAhMOVPdNZqZKinxu7lMSecDL4n+WX6SZp6iRJPE0rQ1W6GeQiQdgYvqad+puBctccackPFhFloxbAYLSeWh7XFHsaGsVmJQrSEuEgzdkFpguTGYItwoYBJ3t+/7Ze+JWJZnpwkLHJU1FTaJ50SmPpvqm/72NC5yTytJVBaT16OuIbpHrPvFDEqEkYrpxds1fJAeeczhLe6kTiDujoV5aB+ohZZ4h0BV5gnLLqWPVPSwf 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: 967433f4-de90-48f7-4c04-08dac85f29fd X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Nov 2022 05:47:07.8104 (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: EepwFgB4JX4pPnPWyUrS7yLB08DWfx+lhM8zr3heBZ0RnTtudvGcG1yoapXaEAzUcjHNN0G5Lw5i5wDS0I10Xg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PSAPR04MB4134 X-Proofpoint-GUID: GihcvNhPVEh14OPD3UPvF0G_P-RXYa4Y X-Proofpoint-ORIG-GUID: GihcvNhPVEh14OPD3UPvF0G_P-RXYa4Y X-Sony-Outbound-GUID: GihcvNhPVEh14OPD3UPvF0G_P-RXYa4Y 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-17_02,2022-11-16_01,2022-06-22_01 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org 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(-) 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 33a3d544365a..363b98bbfdd4 100644 --- a/fs/exfat/exfat_fs.h +++ b/fs/exfat/exfat_fs.h @@ -489,8 +489,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 17 05:47:12 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: 13046162 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F0CEC433FE for ; Thu, 17 Nov 2022 05:48:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239277AbiKQFsb (ORCPT ); Thu, 17 Nov 2022 00:48:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239286AbiKQFrm (ORCPT ); Thu, 17 Nov 2022 00:47:42 -0500 Received: from mx07-001d1705.pphosted.com (mx07-001d1705.pphosted.com [185.132.183.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 852C06F36D; Wed, 16 Nov 2022 21:47:29 -0800 (PST) Received: from pps.filterd (m0209325.ppops.net [127.0.0.1]) by mx08-001d1705.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AH3XZBv009986; Thu, 17 Nov 2022 05:47:18 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=Xl6epq/qeJZ4Rsw8DiBZ8n04id10ZVp99f53Prdx5IA=; b=awfP416+C2VaI/UQhMOvdZUqFCzd7LNJi9php2R+GUqbSO8G62pSSVSr1uSAM+WKvgTJ J2+BU2hT5FW68ZaR7QWTxnbuP5rrdYB8QmErq0MGnCiUlRj05gImG7M/xQSSTEVhrBi+ R6XucUjWKzPwOru5UAthHq0/8SHtc+fnq81EzCwI3tA8sjonQTl4n1NG6eSGNvDu/0TS +FwiFQwGw8FUsI4PsjJteTIsUlvvfOcmVDml1MBFDw+rJ2/fXzJ+WQM431YC2MP96d+5 f099XuNw0RUWBwLLYGwT3HogAFlPO3eBWT5H/WWWj4oRu4K1hNxfBPN5vCdAf3h2f2YU dQ== Received: from apc01-psa-obe.outbound.protection.outlook.com (mail-psaapc01lp2045.outbound.protection.outlook.com [104.47.26.45]) by mx08-001d1705.pphosted.com (PPS) with ESMTPS id 3kvn8yhf2x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Nov 2022 05:47:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nwJoXqkGyv1lgkjR01HU0xut3/JkzIIW19TYWhW21zhtEHGAHcWgLjBcUyrvQFGlDT8NBAQc9DyPyTKf+FbaCpBmu0uFHlMVMkMdutMhOGwip7pOJWA4s88MnyFXYxBRLEZ5hDxZeG7cnoGgXMKOx+Unj3v51wpbPy/sFqkhz0JdhDaV61gWUZPgq+hJTm4kETPZPNc6alGLIUU9GwfbwawpLDXs+0PAshlyMSopa6NLVbHSZvyLvPiL96jI7XVFoVY7CSXbN0Mfp3oYldG6pb1n3pO729TGZgYnujRUDhe+wfxHeoHsj/qg+pyNRSXEQFSawpRe66yN+3BghybL9A== 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=Xl6epq/qeJZ4Rsw8DiBZ8n04id10ZVp99f53Prdx5IA=; b=dT44dmr/XZj4uH3gQhsd9ULwhriWvmeP3L0tPurFYy3nm1rbBYfdJBjoRUx6d/3vJrUYgQ4s14448Mbe/cxshk/VYJGS5RV4kAIXiVaj2EKoTzbEQynlGxb8Sr/0SYfUw0D6n97hYp8FMxDT+rCy1houHlLPoYZBIEjhkDzBE8jBVo8INFTOYzFNl25xgY0I+FWlAYww/ALRx6adadFSAgvymwc7JcdH5E5lduDgje6HNL68o4b5ncJs7NuGjHLrCMWMAwMyeJGbRA+sYJF2DMUOx7P7/TE3p4aWGoG7M7O4wBOurypsUNF6JdHnZU9Ip0Bg7SAFjKkkIXUmhCRE3g== 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 PSAPR04MB4134.apcprd04.prod.outlook.com (2603:1096:301:38::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5834.9; Thu, 17 Nov 2022 05:47:13 +0000 Received: from PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::708b:1447:3c12:c222]) by PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::708b:1447:3c12:c222%7]) with mapi id 15.20.5834.007; Thu, 17 Nov 2022 05:47:13 +0000 From: "Yuezhang.Mo@sony.com" To: Namjae Jeon , Sungjong Seo CC: linux-kernel , linux-fsdevel , "Andy.Wu@sony.com" , "Wataru.Aoyama@sony.com" Subject: [PATCH v1 4/5] exfat: rename exfat_free_dentry_set() to exfat_put_dentry_set() Thread-Topic: [PATCH v1 4/5] exfat: rename exfat_free_dentry_set() to exfat_put_dentry_set() Thread-Index: Adj6Rv6JmOYi1/+VSsabj/HqJj5hLQ== Date: Thu, 17 Nov 2022 05:47:12 +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_|PSAPR04MB4134:EE_ x-ms-office365-filtering-correlation-id: 42828182-005c-4b9e-f62a-08dac85f2d19 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Ba5eGbXgNLyyc2vmRxAjAkwaEpl1Z+hFHwkRz3eeaIEpyg97ztnt2dXvk03F4zCIxKPFdt31kGM4Ata0hKINta/4mHfqkjh00XEnTyQdIplnAKE4DAiWlhdmejom7V3bl7k91LhKulBp8mLb8txEaslqGsSFocA+Z3cdcmv+R0RzO9Zc1lxgN7bBS4HS1YrFcuL5sZXx8Cw9nESdYMFh+o2MHCxfG74Z9/RgtI3KslT339JFG0n5PR+anG7ZArIs/3ttm2mVW6l2hCPwf/3l0I+oGSL2omNY6iou+DqtB9CiIRAo7hrsuZia5RZctKjbkX8gm86R2OgiylRKir0ogxnT349GCpRaaYvirzIpHnfBmtvXnTBNTZDdIuGpkxCssvs8P+eq7NCc1o93JDIG/MUMr8qp1WKat47O2wsHjXIhnoiUzUs0sTpsBMkkfQiCzHqVGBMeHIwwcpkz7DQXUFI2Vlu9TzBZh6N8Rithn8l93sMES4qQm9068uJ/lGJtqUWftQsECHtv4uazVgn9jqsXox6rLgVBVVtaspTKHBxydt1bP3DxBBNRl/ipS1cMQG1zZ5piDly6S6uXNxexB7aQRRCyhZZpV0UecgHFqv9qsOVnpDP0iiAiT+ZfxszGuvAHHJEyHBA6G5T1ODFDKFVfbLPEaHacH900Usr/wNkNLWF44ZhQpPRKKrT9qCyOvg47Yaafgn0NZ80Vph8ggQ== 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)(136003)(346002)(376002)(39860400002)(366004)(396003)(451199015)(33656002)(316002)(110136005)(186003)(38070700005)(54906003)(71200400001)(107886003)(83380400001)(6506007)(26005)(478600001)(7696005)(9686003)(2906002)(86362001)(55016003)(66476007)(66556008)(66946007)(76116006)(64756008)(66446008)(8676002)(5660300002)(4326008)(8936002)(52536014)(38100700002)(82960400001)(41300700001)(122000001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?HfRJ75dKZaf2UBSmseCQxQ48vQNs?= =?utf-8?q?buDced48VUxMMzUvTF9VvHPWnCY7mlgD3mVIG91wyw6qihHwbxJcbkrnH9e7VMFdc?= =?utf-8?q?8aUEzTDkXEBlrdSC2vdxqLPDSnqjo0a2cahTRoiSgN4BA2idNZq0v1G1SAefPFQHz?= =?utf-8?q?2wq6LNmj+og8jx3WIJg0xyblvs9pdF++49CmLtJFOTq020eCdWnvaLp6XmV90iHt1?= =?utf-8?q?OvQWIqK2Lxo/Q3M49aWiGaKRzMFnNW/Ax8JeJsjuDtgAfjlfF1oDe8Clx9lRaBgYL?= =?utf-8?q?iVMbi2oUpHuASfi7VtKWW4KExVz1qMDi8wHYH9ikCrx1avVRn2BVt5WZGz4/U19wN?= =?utf-8?q?oChK0FZ/SgUbdR7nI+h7v+SrlB4aWsP35TaM+HVt1ug6aMoRRp6p7lbokFpE6K/T5?= =?utf-8?q?Ng9J0ozQZ0vdeXdHjXMGErNu6eBihXfpx2Mm1rAEI0ijD5+zx6gqC9J1PXEB1sg96?= =?utf-8?q?fFSoO9kqHklrWd1Txu8nUOygxrnZZhwqA/qeSnLFwxrMqmAC8CmtuvTI+NkkwBl70?= =?utf-8?q?lXn1CnNILanjXdHzTrUiWbXvss/BAyPiQeLPnhz0OiUpKb182wSbNbL2Dyvat24Sy?= =?utf-8?q?i9Aw37utKaGW6Rj/euzUUG1tfiP+bS3Ft11beMmeAo99PEVVquCJ9zvq4IiMQCT2y?= =?utf-8?q?MwE7SbuKQZaKtbVuUjuZT9pxqrO3ZI2HIjJ+A/Fa1YfFS6ebmUdKhZ1ZuCC7H2R4x?= =?utf-8?q?XUEsTnMzNSTBg5q9Fd+8AgXu2LLJB2qBa2jNnKPmeIsIAkJ7J7CE7FmII0RpYE18D?= =?utf-8?q?e46J/YBLCeGNXetIkSZGIbkv/ztuVGxqB8pXZKaIU/IpNvhPsL/GPI0Y+obw7IHlF?= =?utf-8?q?8Y7Vszv2y4+iN211MeTKeVh1vcYNMhMIwEPW9gYsiTiDtfg5VazE42o0ApAoTHzRj?= =?utf-8?q?C2lrrldyOVex2g/lKU7jY4Gwb6YfMUonVyFQ4cYkZXTZpZCtJ+iBiZIQNi6L9qdKi?= =?utf-8?q?NPHvJajv9kZ6BUb3vQ/e/PcJpHQeR4gnRzOlY+iV+JP2E+7l/Mqzd9neGG1WmxY1J?= =?utf-8?q?/rW6+/sRP583w3K8Qv9hq0Cq2DGte3I3ANODqKtZatXc016Lx3CbSQKZbIn186Wva?= =?utf-8?q?sy6MuxZTIPIhxZzu1POmC0kLTQzR7p5aySz0gtAs8xExWBgeXCnpsqmv2W/qW40Xh?= =?utf-8?q?VRrXv4RGbrX1akGC3vnb0sjwxAoA4j1dDZ0LpBeHRJXjOiXJ0vzBTkd3luvzGeA45?= =?utf-8?q?XoKoiDunljE2h+KWibYGS1RYlSmFHYO08Ke5yR4BL4uwitq2LtdzBf4/BNYzGxnK2?= =?utf-8?q?wrtJXrF4NMWDhFu6208LpuooOedoYLYN5yodqz8KGPW8ocr6Ah1qDuSxBbx4BpYzX?= =?utf-8?q?piiLHBsQC0JVZy67QWfXAkYAZPcZlQ/DhbkWvsKymzA6QHhbcb2JY6eN7Ek4856Dm?= =?utf-8?q?lwiSfVUeb23pa9YDryyWPD5Wlp9zc5I6PIgGUbNJKxamgwaM+wRvZw7n4qqPi7AzT?= =?utf-8?q?ANkptIHa81EOcEBF01AOija60CQ2oTV0nq7TWDAwh08oyZ9bImK0hZTCVS3OgqdhW?= =?utf-8?q?1kt46lvkY+Sl?= MIME-Version: 1.0 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: dJdULTa+TRBTbdym0HwQ0mHSp1E3j0kn1r5ou5yzWDSR5YPqzhrgAFQw+VD8M6yoDq2anNpAxulIuPVhl/WOFbIzDc4kH73hlvn0qaO6nQuoBaFHSQ3+u7B/jemSeBGQZhPBBTVyXtwQThgxpMGuy18CA10okDVdLUlFtut4TyNolh8x2rKzvg6a9/DigDuJ3sJB5pLyTFBIIDSaP42xQuM2jFJEWuqaTC7w+tJM4VW8y+d5RMnQvU9qsJrseuvVQAnRoXCvw+lCsUfuBdSfOfk4l/5qf0RlR7jUHrOddCe1i/m02Fua8c0ok3Q51vszjdkOZBGQp4B+TszgxFNY4iq9S14IOKW/yBsIneMj/fM+0AeySpVS5DTSHKzvYVTRjLKMokyM3ZezOWd5UHLJYtRzXGNiDj5256tlkybbaqh0dV/kydllM8GsKbDDLHgQWewO4mZ02s6UK7YfbHqK1LWToVsp6UGW8exdP2V9MbE95RjGUOQ94dVR0kfviTMpTvhoBdWtOABeK0Q9E1qBynFGwvhwqGvmDHX+bRyxnjm/UGu6lyjfa4O8rU3DUaDDCoctMZDekXtRH3WkqLLdZkV+J+jzsOqen1nbiyieuUFB5TXNvy6uA+ILQ0CN05RN3HimNd2V9aApnEymFlC0mNBYOHGU3d6pin4MpYwjKjaQS8KT3/eB6ugQcghkk6JrErYv4Aa3xaJru/Kv7n4myO6mhgdjKIG0/78a0OFd2k3Qf2UBGfc/jm5q8G8S9g+P11EYprl635+Q/ZAuUiZxR2JOeeve+NtBYA3XtEJ4uO67wjJjZCfS2os6InNev2IoP5rV9+VJDccLoPc1jl9anWcmVCqJzLiGkFzbXVlCM/8eZFDkFBmEEuSqqvo3tPYm 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: 42828182-005c-4b9e-f62a-08dac85f2d19 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Nov 2022 05:47:13.0154 (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: QqU0JiuRkAaZV5zueZvyPm5362Z/cys6XDkkLjF6FmVt2rsveejJPcw2Q+w46C2yv9JfVe15yUmRame8+1cryQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PSAPR04MB4134 X-Proofpoint-ORIG-GUID: rJ5AGAwZOHHadBgqnPNA1WELoxmTkw3v X-Proofpoint-GUID: rJ5AGAwZOHHadBgqnPNA1WELoxmTkw3v X-Sony-Outbound-GUID: rJ5AGAwZOHHadBgqnPNA1WELoxmTkw3v 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-17_02,2022-11-16_01,2022-06-22_01 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org 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(-) 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 363b98bbfdd4..bd6ccde190a7 100644 --- a/fs/exfat/exfat_fs.h +++ b/fs/exfat/exfat_fs.h @@ -492,7 +492,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 17 05:47:14 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: 13046161 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E4A5C433FE for ; Thu, 17 Nov 2022 05:48:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239266AbiKQFs2 (ORCPT ); Thu, 17 Nov 2022 00:48:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239129AbiKQFrm (ORCPT ); Thu, 17 Nov 2022 00:47:42 -0500 Received: from mx07-001d1705.pphosted.com (mx07-001d1705.pphosted.com [185.132.183.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 158966F370; Wed, 16 Nov 2022 21:47:29 -0800 (PST) Received: from pps.filterd (m0209325.ppops.net [127.0.0.1]) by mx08-001d1705.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AH3XZBw009986; Thu, 17 Nov 2022 05:47:19 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=OP8r0h4lfQ8RDOW7N8mlx4Axv+AbuQVupQvi8Jy2mVE=; b=fwkkzGR8LJ7ZPZ6M18lRubwvTJQPUmotTioZNHk9zbRxzMxHjkigLQNMTizmDj+MxRLW 6dR572/gnPKR3vBUq8myICsLjJPMR6NP0iFE1LUUI2wGruLI8m/OeZ8bE78G8Kpdx6uv HwqL50phCRNhl8+HpBZ8YkF6JOQUOxjyWdeVTJDWwIaZab1RWJZLguE7WX4YWSagSdlE +4Qrcx+GeU/Pbz3J41u9hnWGFC8X8/SnEH6HeW9cBq4bt+sIL76Q7OSKnO+B6oMRwJYv RaJeQIjb2e7xTiTI6LpQMeIGj7iIhW2BVtudev2249fO27UCmz/laWPeNPE9JgRdBgVz hQ== Received: from apc01-psa-obe.outbound.protection.outlook.com (mail-psaapc01lp2045.outbound.protection.outlook.com [104.47.26.45]) by mx08-001d1705.pphosted.com (PPS) with ESMTPS id 3kvn8yhf2x-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Nov 2022 05:47:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E0dGGDV/d8WUVEV5Pk1r8qyPwzhVHlNa2ERsMdCwyAWcx7UQSF2CDpsKJMbk/wXOJ4laMR6WO0FHQSsJiRKHl50H6istnSR4/v2gT2olQp5S08TqqrtT4Xywhrq5bXj4QXmphzGLi8cZHOX7dA0fxTP4dJg9z4aGrp67gxdBHe5aJKlyExmYJM3N50Vx6lkNaJ/KD5g8Yz5Gs6xLvLRgBG1wpVs5lyLCOAX4xKCMQtmEIS1S/p5GJoESGrsVj75Zw61iu/T/cWWspPcF525Mo+w2ueOppm/L9iS4ZqOALXUwmqpAf3aoklWDkUMPRyMo2qgxm9Emxp1QMBQn/yupGg== 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=OP8r0h4lfQ8RDOW7N8mlx4Axv+AbuQVupQvi8Jy2mVE=; b=lNc9pbkd+VG5BKc8/aa5QmUrvu9R2EusZvQ/5XOUbOAQzPldDdfpWFcR3RLRvhB6ihd2TLcRP8YjSEUIoSxiab0aTpqBpEnDk87flKgd8n1lWDHQGOdGJVOk3RLyBEs/GigLxR/axvXuMJjPvWry+mmauCXqN4xPAK08YiqRo+ScEvBhbp/eMtRTtsePErPgQxvb6y938oeClEdATsC3zw1w0hEYCvzI3y5VRJlov6xsbwP1V4HWdgJbwDnvzaeGtI9z6FPkw/ISA+GBnGm4r8UgXPu9iJ/j1n2GDWYEcpiExsYhOefs5hmb1G/CEugfWDORyxScEJ+DgyoH1CkwXA== 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 PSAPR04MB4134.apcprd04.prod.outlook.com (2603:1096:301:38::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5834.9; Thu, 17 Nov 2022 05:47:14 +0000 Received: from PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::708b:1447:3c12:c222]) by PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::708b:1447:3c12:c222%7]) with mapi id 15.20.5834.007; Thu, 17 Nov 2022 05:47:14 +0000 From: "Yuezhang.Mo@sony.com" To: Namjae Jeon , Sungjong Seo CC: linux-kernel , linux-fsdevel , "Andy.Wu@sony.com" , "Wataru.Aoyama@sony.com" Subject: [PATCH v1 5/5] exfat: replace magic numbers with Macros Thread-Topic: [PATCH v1 5/5] exfat: replace magic numbers with Macros Thread-Index: Adj6RyeHIwRrcVQ8RsKCnq84QMZMWQ== Date: Thu, 17 Nov 2022 05:47:14 +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_|PSAPR04MB4134:EE_ x-ms-office365-filtering-correlation-id: e696b092-dad3-4c0d-b146-08dac85f2e24 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Re+pSLU1WNONfELGLacRQbk2cK0Sw5mLtU+3G/JNFqVttVhyKVDefbOer1/GsYWfi2b3ETg9APtxwMlSfzyyY238Du0wcCecuEfZQ+Egph7TR8a/Z/xQNPAWqVszN6oaoJBmzSrcRRY1sl/RPtX2IdFKGA3iO+qD6Ayj/yUC9zOJt//ucL8kd+7COoA0nchnnYK1PbSEyzMQ27CC1zUmH4JhtReJQIuyyGtQsy0h1EdsBXPT7fhu1kFPK0M4T7PgV/OyJwMqx5H9kjPiy56I+dFuW1+qyzfASZRfZcJcF7ISd3YDx8ynCnNDPWFC3kNSBC4JvH0m7FV0Z9CiDOG+cHdHkeuM1gQZeERy8yOHNOhzzCbc9xaba/VyUjmLSMbDoDm6Wsu0fNeqEAg6NolPAQNNlw+iG9QPP7v+Xytl4mGA0TsraHkT9DKFbZL9yMWg9I9mBZRo1YnrVwUuTXssa/RTKw4B9jGckv3ZIk5swrxIpt59rMlQ2QBtkVNNNyPKp8PZozXRs6SvOMoP4K/8dO08jFRr0GptR/YMcpYX+adaxyhy1+flPuq0vcfVV5S7ZS5ebk9Uh1oJjZcExM7ksLnqz+FFjGLYqwiDu4O46wZoPP/luVnPB2loOoS3S9X5HI6dVvwq7L5ckdeV34vNDNbWhsb+VCbtircYsBxFxHuRYWJ5PnZtQGcFUQc4iSBaft9/Kjgx0Sgsi/6/eoULQg== 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)(136003)(346002)(376002)(39860400002)(366004)(396003)(451199015)(33656002)(316002)(110136005)(186003)(38070700005)(54906003)(71200400001)(107886003)(83380400001)(6506007)(26005)(478600001)(7696005)(9686003)(2906002)(86362001)(55016003)(66476007)(66556008)(66946007)(76116006)(64756008)(66446008)(8676002)(5660300002)(4326008)(8936002)(52536014)(38100700002)(82960400001)(41300700001)(122000001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?XJfvk2XdzPied9WHpgvtd7dG3PDE?= =?utf-8?q?2wnpNiRCTEHM3qbV8Fad3OiV/xtKfxa7MrvHaAzcwb4eTK8q9CEIwftvKqYrQwY5z?= =?utf-8?q?nYjS9mLmT2w/7MvsE4r7yvUhYq6IVxlElFqseRjAZw5Jw7vNGBD5BY80lPL4fgp4/?= =?utf-8?q?SfcdSedImptpFphXMXu0pP7b4XT8hEdIGTTbxPKze+ZaP90hvATEsIVbnoT6d3XSL?= =?utf-8?q?vUoQ6qSx/+5oT/lOoMiSsakCE/7jHpQ3ldN5XNj8yBLDmwVdwY060NRQMq4Uj+MU/?= =?utf-8?q?hUT4/BgLKpV/IMLD85j5mXlrlvQITO7/9FwTYN3qytbKHZRhmOAGQQAM5zluJNVfH?= =?utf-8?q?lvVZuzidma/WsHAD/mcTqh49cHtcYi0he+aZBtwkStYyb6XthuM+gA02LLilAcR2l?= =?utf-8?q?57wM6rAOjCHG3L5UN0kRieVd5iQeN8068r9uMExp12cT9QEPXhHu6oT4YaWGWEJIK?= =?utf-8?q?07VjjTw1a045lj+QCf1Fu7Qt5UB3RlL8u81duhjPVLt5SpLzD2XKAtMfAxtaaeomM?= =?utf-8?q?5mLmwmCyL8G9WJlHqhDhgGgB76aRPkSKpN0daocXKrUI7k+JyYz/0xsD+V35nvYGx?= =?utf-8?q?jpJO6Nkm8adTu6MpNo7ByUpWhiCcHZGRNuVVnkH5lKYNiIyTsSr7R7JML18Y+awv/?= =?utf-8?q?NnNMaNZKoeksISgtrdXyLr5UtANlpeqYIlZirHRqzFAGC5MqTV2mlPzN0HTjz33tY?= =?utf-8?q?oaHEZT1uWetrffpZFRkuV8Dn5ax9WuI6WEWdfaO+XT+4z9EV/iFv2DCMKyEvnxb92?= =?utf-8?q?d6WvkQzL4CZX1yPJbYc0Yzgib3op/6Iq6LDc88L4vGat9Yw/fj9DdAVZhVmbSDnfW?= =?utf-8?q?pu4iB4tWlulbkJRA8xn4TwYXqC8ERdT9YgsGD5dn8zd2rCFGQ4CXkK0pGtwt413GM?= =?utf-8?q?otdebhmqcNRDQafLn8T2w+hxrbwNONlWR+z5Q1EwH1/3F4jUG49wRmhkM5CMvRjx5?= =?utf-8?q?9RckHPhKV2JL5OwmMEGDybMRX1NzzQIe1DaqAvL4F8SrkM0Q05N/k+2nlzT447++N?= =?utf-8?q?gwu0TTxzrjINqcjhCH4mZVy8x9n1BdlHIrhQqNYuwj2/Z16vbN+vl6iNZSBHunRc5?= =?utf-8?q?7rSGRcOiLOJ1uPnbMCVj/JXnaoycPbs+c6u53rStuBx9aOeZMcxjKWXpLUvR8xPWX?= =?utf-8?q?mO3Kar+pnEIZi8JdrjthiBY9FypViIPk41NvQAlgVld5TPoORf56hoVjNkISBfpwA?= =?utf-8?q?c5EdNekndOIYHHbvr1Lx9+cUWgxHtfdoXXjNn230kJloQxwvmbviCxfEWGVPyUOKO?= =?utf-8?q?sppjkEEcbR0J/VpRQgq9/foXT/UFBvHGyt4hR5LAYb1rqaX2vaz2lsJ7k5fX0lohj?= =?utf-8?q?t+jUI4evc63TiIPZtrYUu/f4e1100BOWq2pScft4DkKAOVYLcEpv12ECUcylkTGMn?= =?utf-8?q?VE1fozuJZoAiFl9/oLRpVs8A4Hs5JkPQnQdO9OM2lodBOGxxqF0OJnV8jomlUmS7U?= =?utf-8?q?cCy/p1EbgyP9uYYCCvn07lOo9MTtMneAr7NXQDQlytozOzvKDN7LcFET6C+CKncOV?= =?utf-8?q?/f95mSHJMIOP?= MIME-Version: 1.0 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: Hq7IDWwq3aA4v534gwYKwWo9liHSeRb0Xqw0IG/qub2gxWh9wMFrBRXZUIuJKKlamq/VEokEslkYjx2uAJ6qACs+XFoCoyEL0tA1rpaT5AATy+dohACBefIHkn0jH3CCnMXVY4FB9GVXaj6iCgtvgUpMMg5hXDLBVnAEWiBPEtb8v5Jq2g/S6+NHhbEoobLI8zbS/UAUVIEAbFKuk51Rc59fZGc71TXgCSmfXrEK3QgvhPrFYw3sKBr3ugNEXSmOdZdFnCzuqNNt19AvpeL8WLN4M3vaLBXpq+yC3xeIBH6qdK0ALj+AUSzksTmulgbB2gRNKwXIc6VTFvUFY0rgW3Lr+Gr0dWTn2OPBm6ZqZgbcHKmxYevIjGN9NaCi4BHlGGMBPiIDnlWc+jxvtP/TG1P/CCtWyoCm50TZ0I+TCReZgMZAd6lumnu2WTXGzDXFc8WYG/n2xeyYJz2TCbbBOC94uAdnbmDF0zEOj5ez5tM8VCJKa1m7EIo6niwIygt2NAHHROXGabVXlm3qLhuBJ6ConoGcfhAy9HSHr51nszjKcGiEJ1xJgI8oVKTNNfSFsFt0k+95u9xGOYToRD1/IYoP0I+RqmhWNqGZG38sZxXsFuJqYOkEYNQPCxn/j+okImFv43vVSqc8WWgvslF/qN/d+uHRwkKNiFjU+h+EbHYgDHArkGQ1/jcDeHrPF090qkLzQyUwo51HMRLXSgRz98kINcKaDRLbHiSIeC92R2VIJW+jfGrmPNsBQ3l1YUzCNS7/MGEn7ex24q1TToaXX/IZZz2SPFPxQYnHbZtJqCtfyd9Od5I1sCdblxA8dmdA18qZCgs8QbTs8+cgyhq+Gn8+tx0Y9N2oh+0aSVwvKjkwozgQQ/bzyTeXyoYL/zyL 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: e696b092-dad3-4c0d-b146-08dac85f2e24 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Nov 2022 05:47:14.7795 (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: LV4lbI4L8Szq/DbcwvBGx/D/DV9l8YgWYlV9MJQBFuS1+HH+4EnDxc9uBsDnCElWNfq3wbwlpqF6HpOnld2kVA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PSAPR04MB4134 X-Proofpoint-ORIG-GUID: lU3S9UJPozDUj2iFYFXArBKd4b0Di_UB X-Proofpoint-GUID: lU3S9UJPozDUj2iFYFXArBKd4b0Di_UB X-Sony-Outbound-GUID: lU3S9UJPozDUj2iFYFXArBKd4b0Di_UB 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-17_02,2022-11-16_01,2022-06-22_01 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Code refinement, no functional changes. Signed-off-by: Yuezhang Mo Reviewed-by: Andy Wu Reviewed-by: Aoyama Wataru --- fs/exfat/dir.c | 10 +++++----- fs/exfat/inode.c | 4 ++-- fs/exfat/namei.c | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/fs/exfat/dir.c b/fs/exfat/dir.c index a9a0b3e46af2..f50c46ccd0d0 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_FIRST_FILENAME_ENTRY; i < es.num_entries; i++) { struct exfat_dentry *ep = exfat_get_dentry_cached(&es, i); /* end of name entry */ @@ -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_FILE_ENTRY; 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_FILE_ENTRY); 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_FILE_ENTRY); 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_STREAM_ENTRY; 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..62f1c7bfb5d1 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_FILE_ENTRY); + ep2 = exfat_get_dentry_cached(&es, ES_STREAM_ENTRY); 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..38ad31b7eef2 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_FILE_ENTRY); + ep2 = exfat_get_dentry_cached(&es, ES_STREAM_ENTRY); info->type = exfat_get_entry_type(ep); info->attr = le16_to_cpu(ep->dentry.file.attr);