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: 13054617 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 D0C2EC4167D for ; Thu, 24 Nov 2022 06:41:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229753AbiKXGlH (ORCPT ); Thu, 24 Nov 2022 01:41:07 -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 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 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,