From patchwork Mon Mar 11 04:25:08 2024 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: 13588282 Received: from mx08-001d1705.pphosted.com (mx08-001d1705.pphosted.com [185.183.30.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AE2FA12B81 for ; Mon, 11 Mar 2024 04:25:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=185.183.30.70 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710131124; cv=fail; b=H7XAlnHb9fr44TPuFgmgZwq9G21cAQiJx6C9veMQcsM9vN9zLLIGZ+YQlPHOosTkKT/lcP3gnVLzbuRM1j2oeSYOeDikr1qf4lV8Jdqyo6ldppi+gZK9f1KObqk2wDYAmhMfQpfHaKkbUnW/o7Xl8uNZ+HyvRK+a9PezqsiGcnY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710131124; c=relaxed/simple; bh=ClHDg9yXO96nfRqgz6SeJri1e9Wdx1wYki+b08NFJOQ=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=hS5ZeOw5uUOADY/eHd90rIRW65y3YsH1wDko/gVEEPm+IHgNa7oTz00/3dasPbuRKhCJPXoXU8Tm25L9pRfeoYA+w+h4hhi/wh1r27hym9311qk1z9l5V7oRwhZ7mCUh0y/8PK5uTe0ZIAHX9t8TBvws1XwKRcr4VMJXvbm2CPU= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sony.com; spf=pass smtp.mailfrom=sony.com; dkim=pass (2048-bit key) header.d=sony.com header.i=@sony.com header.b=G7CayjdV; arc=fail smtp.client-ip=185.183.30.70 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sony.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sony.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sony.com header.i=@sony.com header.b="G7CayjdV" 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 42B4EKVq001813; Mon, 11 Mar 2024 04:25:13 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sony.com; h=from : to : cc : subject : date : message-id : mime-version : content-type : content-transfer-encoding; s=S1; bh=ClHDg9yXO96nfRqgz6SeJri1e9Wdx1wYki+b08NFJOQ=; b=G7CayjdV0k2SMobd2vvNRSYdmqYi/YkWFCH06LS7kHsWdcmacDUqWV0R6EV3EXqe3K3s 3JcDE/kFTklFVqflayjK4GmlA8Eax2dA/rMFMpjo/RJTqR2pcUmdmDFboLC/5ZtK9OJe pe+d0RotQPUc+jO4wzn0KXyN7YdKoWzLFB0PgNv895UYoxgiSVFFAr2Bhl52xdPUiITY y4z03HQxR5826Q0pB6uI1Ay8+33/DlSwcQufBKUjTR1CMZL5X/sx32FEdf1UVKV/SQgM /d9MS+65liHiNXDAfIRfTWv+Ew6h1Zye5ZZc/b0py6yOldSRobcUUh6HkB385YuRN57d OQ== Received: from apc01-psa-obe.outbound.protection.outlook.com (mail-psaapc01lp2040.outbound.protection.outlook.com [104.47.26.40]) by mx08-001d1705.pphosted.com (PPS) with ESMTPS id 3wsqt585gy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 11 Mar 2024 04:25:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HQ+hxw/ttLWfE6mSbMmzdE6c45LKWc0LqKapD/5d7EM+1gfQ8SYKuRNTzZTE9eDl5ZH3DWIwKPJAltrOE90MyrG4ag9kT7KqVGR6/qZywFuycQpjSvTP8fWI8oA2HusQuOSC9koV/X0obnYdvEloLF6ETwZmmaSH/J90V0vJUvP1i6oU06NT1hn8X+OwON5Q6qhe5lw5/rE07tTTeKl2VNrk65o9gcY+XwWkD2K7Vr1kgFl4SweONVxBr9oWeK280KRLYL7pHfI74HkdZitUp8N8TYBHhUzA3jumawPV2awwO76tzSWIBURxbYRPTyn7SbTibXOjop+KRHO/n8XvtQ== 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=ClHDg9yXO96nfRqgz6SeJri1e9Wdx1wYki+b08NFJOQ=; b=Rp1stGv3/ytjB//LrdgU4aI6zbajqQKd0kiSHNA5hsGnkavYLGgZs84p/xkqKeNt6/Beixj6Hj5Jk8HXYNM3OlagpvB+IQ+IRjsXWhZkGYmXiif23Al4O8GzSgLYFAFQGEMnJGJwCPZniQ0pLgMRjq7amgb1bN650l+qp33b3lfwtVwPpVeVmBU9of7khz/lkEhkPa5uprsqHUEy7yZETze3x+EfdlHU0+VZFdDuepWgif3Lb3GlVhFuNjtDP7ZlJa03D88YQrw7LysnECy3PDeCm3FQdU9yOlqVFGGj/h+NeUk5h1rLPWD8z2cFAL7hRCgyuzyYli1BZEffVBUumw== 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 TY0PR04MB6328.apcprd04.prod.outlook.com (2603:1096:400:279::9) by SEYPR04MB7362.apcprd04.prod.outlook.com (2603:1096:101:1a6::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.34; Mon, 11 Mar 2024 04:25:08 +0000 Received: from TY0PR04MB6328.apcprd04.prod.outlook.com ([fe80::c5b0:d335:658e:20bd]) by TY0PR04MB6328.apcprd04.prod.outlook.com ([fe80::c5b0:d335:658e:20bd%7]) with mapi id 15.20.7362.031; Mon, 11 Mar 2024 04:25:08 +0000 From: "Yuezhang.Mo@sony.com" To: "linkinjeon@kernel.org" , "sj1557.seo@samsung.com" CC: "linux-fsdevel@vger.kernel.org" , "Andy.Wu@sony.com" , "Wataru.Aoyama@sony.com" Subject: [PATCH v3 05/10] exfat: move free cluster out of exfat_init_ext_entry() Thread-Topic: [PATCH v3 05/10] exfat: move free cluster out of exfat_init_ext_entry() Thread-Index: Adk2K2Rlcvd5MS9gRPmcSF0nOdraqE9PvTLw Date: Mon, 11 Mar 2024 04:25:08 +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: TY0PR04MB6328:EE_|SEYPR04MB7362:EE_ x-ms-office365-filtering-correlation-id: badc6590-d7f8-44cf-4f33-08dc41833bf3 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Ed+Cv9PyhXfo/rh9OZEaPl1CJBMubFghQAxZl9PZZwMScgKFRgR5q5J8YSiABNf353bhN91c1ZuE521p498a4ft3KmlnmewDkQTOMwiKeksZtEmpGrhjuHL2oZq62Dpch+OmoFnrYdOFZm7hCtxO3pseLHw/NLo6gXyirm4YWmrD/ilHUvbDn1PtUSOfnwiolSHtntIhzB2rL4BCM76+elGtfCf59EeyTSYrFmoa5PN+A3T1hhTVWOsWlDquDWQEcRVuwAN4KosF5CDOfg5ekHk8RvQby4ARWgWYNwqUdZRzhm2mtkzDWwLdFpMNlRCkU6aAJ4l4d64O7oLh4Nkqwe8rH3L1K6UD0tzZcGr6zSG4igAMzYHBqSbBeWT0elT54btgI3YnVAgr6hUvrQUYfkIaWRhxEBZwLwfHP1xVOMBNDA4gpVsyi+/BeGlvAwqpiTUqxbzwkdd2AWT4HHBSdXGuUD7PhI4ZMYJML7daxCwcXhb2hF/EOEVxhJLS0p1PK2H7dZ4jXYMcyMnbYrlz772u0tz+HJCiPKZBXyfYN6ooLJXe88QjWaDn0mzL3QJti+UzwhEdPwFWDZQKTdoAQsecS7DWzBGMhU9fR5ee+CUWdzSw4lvFxWnz0n9ZGPRGNgnZ9R8SFnwcoLFkcxMcCl5OWh+poEZvz9f+6XHIBqoSpMZ2U6Xev00wTq6Vc8Tb+zWqygBf4fHsDIA/6fMmzLY/78RD8gaGhcEgsXvBc9M= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:zh-cn;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TY0PR04MB6328.apcprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(1800799015)(376005)(38070700009);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?YB/WCqXvY8mqQkJADyvyYfBFGJh6?= =?utf-8?q?1yt+UQ1IgDnWgUFDe9eSmEszMht1xF4x5dRe+o2YWmnpb9xr+/kTGHhaU75k2k13J?= =?utf-8?q?FV2btmlk8oIC4aPAKXtwHygyCdngFJMZ199K0uJEs4Y6vilH82T4M5GdZfGi7KzOC?= =?utf-8?q?xx3t1E5LWn+lPEpe4twVQmOyrIrWy2DWInzSvBgcojPlTuMvwqehAqJ1E+VP8EFhf?= =?utf-8?q?t7A6pjKeP1cfNgO/VFimosTN/5HbUcBmbgbvdf8h1SsaExMILUyKEM3Tu/i+S12Vc?= =?utf-8?q?7BUvX20jsg8F2SI9qhjVXiRkjw9eotnfLblbYgyh5zMIUDsTWVqRWtZJFo26hNXOU?= =?utf-8?q?5QDfCtcQP/CyxPc2jAHXOR82QnJEVRoxplK4pwVtaeKyKrvTdeYny7CVoxEBQG4i+?= =?utf-8?q?Lu+gcp0z6w/iMVs2Q+KbjPcHfu7Doz7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wIXKkG3otnOa52apO4elzFmITp5vr?= =?utf-8?q?5043Qhy+z07o8lvrPBLsc6vZAmJW/jKdcR0NwpakB/UAaBcZME908UM+AfRDMJlLi?= =?utf-8?q?4lizjaRoRrK3TcD1thZC6ABS0bHMsPczPlmO3g+wj1CcVSmpttGH7P3Ryow9re8v9?= =?utf-8?q?qIbj4PVR0n3yh2DM7EAS8KooAdHfx/tZpIqlZU/NclYrQ4lLGxtNxxAZ4JfnIC3mb?= =?utf-8?q?odozD6h7B5WG?= Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: /zU4FfwHArnymhOTaeHd7xWwPX7YAOHaS0ZTO5uiNgv0mBiLYFyda3Bc90e/xRTeUAV/ECPhbDfCMGQiKav9ErNJKYFisNQ0r7iQDHF7pY7+W0D5UMkWqzVov8kCH5j+EFq10cvj9IiS57h7Eopu5DUNZNpwFOp8ZfOpXotH2RZEOqOYbVzbFLBR+kxm16YAS+qK0/MOcDkfOaXI3Zu8BFhk0OdSk6qJeeTV6m7AakcfrbkjQN7ei4LHlGcNEYkzcWMQaZfeiX4dVDJZ0dQf/Gv0WMRSvINiS+6LmkWc1n4s9uKnnZwid/skGqsgHhLBTIH2o4tWdcFacKJHJtAbYpeJFQ4BMY8wK8jZX3yxGRtIeAjrL6Mh0r/xUkax+lmrprEwWrz0Kr0dtXrm6jihm0mKg4hN2qepz+RonYu2d9uT291tGOeTxWK2ddLtdtjE/LuPnw5c7z5bV4svEg5oe39Wwov1YJ6qZIUfrPaV97u10w/kzWThY0cX1LHgeewkVzY6lGGt74LYcS269KOICY5eYCtc76NICAodhedo1t91UaYBYYH1Whty1jONJDDNZX2xdCg+t13wWSuc2fYdXCAZbj8e8ahPU3KEkIp9eIsG+F/A9Y4PEp59a5qQkX1w X-OriginatorOrg: sony.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: TY0PR04MB6328.apcprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: badc6590-d7f8-44cf-4f33-08dc41833bf3 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Mar 2024 04:25:08.1907 (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: e408ZoIR0yGgzSe4key/M/nw20gysCGrmeWRQEQZ+xW8Ov2Cn3g1uB/+5Zbkx9wpUUjLQ3KZVoCOnoiJVgUMwQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR04MB7362 X-Proofpoint-ORIG-GUID: blP-OX9SnVJOMOHOcGKX1uUVjkL8GIp4 X-Proofpoint-GUID: blP-OX9SnVJOMOHOcGKX1uUVjkL8GIp4 X-Sony-Outbound-GUID: blP-OX9SnVJOMOHOcGKX1uUVjkL8GIp4 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-11_01,2024-03-06_01,2023-05-22_02 exfat_init_ext_entry() is an init function, it's a bit strange to free cluster in it. And the argument 'inode' will be removed from exfat_init_ext_entry(). So this commit changes to free the cluster in exfat_remove_entries(). Code refinement, no functional changes. Signed-off-by: Yuezhang Mo Reviewed-by: Andy Wu Reviewed-by: Aoyama Wataru --- fs/exfat/dir.c | 3 --- fs/exfat/namei.c | 5 +++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/fs/exfat/dir.c b/fs/exfat/dir.c index d34b50293e2f..85a566c23811 100644 --- a/fs/exfat/dir.c +++ b/fs/exfat/dir.c @@ -564,9 +564,6 @@ int exfat_init_ext_entry(struct inode *inode, struct exfat_chain *p_dir, if (!ep) return -EIO; - if (exfat_get_entry_type(ep) & TYPE_BENIGN_SEC) - exfat_free_benign_secondary_clusters(inode, ep); - exfat_init_name_entry(ep, uniname); exfat_update_bh(bh, sync); brelse(bh); diff --git a/fs/exfat/namei.c b/fs/exfat/namei.c index f56e223b9b8f..be6760297e8f 100644 --- a/fs/exfat/namei.c +++ b/fs/exfat/namei.c @@ -1082,12 +1082,13 @@ static int exfat_rename_file(struct inode *inode, struct exfat_chain *p_dir, epold->dentry.file.attr |= cpu_to_le16(EXFAT_ATTR_ARCHIVE); ei->attr |= EXFAT_ATTR_ARCHIVE; } + + exfat_remove_entries(inode, &old_es, ES_IDX_FIRST_FILENAME + 1); + ret = exfat_init_ext_entry(inode, p_dir, oldentry, num_new_entries, p_uniname); if (ret) goto put_old_es; - - exfat_remove_entries(inode, &old_es, num_new_entries); } return exfat_put_dentry_set(&old_es, sync);