From patchwork Mon Nov 18 02:01:36 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: 13878042 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 62AE11EEF9 for ; Mon, 18 Nov 2024 02:40: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=1731897626; cv=fail; b=RdKXcU+Z/cT6tIGm34Z8uL65zBQpBc2bwYJ9A2VgT8y12X4xj/9GvI+44YzT1cIQ54aqNccZG9A7uWt29ISC4fOtRtb4AfYKjf3aeW7AXtYMJEOcX4qGLpw9asBE3F45WKMkTu5L/KjoH1g/oC+CBndPHkcAvGHYZ97Sb9rR6u8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731897626; c=relaxed/simple; bh=NivdX8AtRVA6JNFvv/TVGM9USOTDI0TcVF/YlAo3/Gs=; h=From:To:CC:Subject:Date:Message-ID:Content-Type:MIME-Version; b=R0tVhQQbFbLX99qvMSNdRveneeLMKOfZeUVBaQClr2iSwI0GyhyJWzrTSPqeZ96PuaTwRr1n38kmUKJqG5XeUar06mmpCnvsHe8jkDI+oAbauLuje39HeM2e8/kK3ScqMHmKfugxk5crYYTlAOR/LS1pxXWHBnOYtGP+EqLGUoI= 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=NNcwgf86; 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="NNcwgf86" Received: from pps.filterd (m0209320.ppops.net [127.0.0.1]) by mx08-001d1705.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4AI090Zf023366; Mon, 18 Nov 2024 02:01:43 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sony.com; h=cc :content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=S1; bh=NivdX8AtRVA6JNFvv/TVGM9USOTDI 0TcVF/YlAo3/Gs=; b=NNcwgf86MZ7nXY2WPZmRpEAhHcE+BbSllV5CgtXeobSyL 1cs5Evb1/0CTfUAjW/nc163ztJKRXApi6AOxH5JGNgsTY5iRdF9upsxZ05cNF5Ag Lkzm/MS5bg03Y5QfAYW5eZz8RdwBU/lZgcDRJqAKyZRbdDaOwYXfhiTKFxQ0pcSy kc4BjtBmOhqotCbM+raNpG6qZMJHJPanRCXDPCpPMZEcgeH4ty6wkpy/IvyQr3yn fYs/iiMwZA7rBR3u4Oin9Bwe/pcDdJT+Nz9kOJuywL7APwMufJle5zmzvtbI3ZN/ zictzPOk/Zxq7zpNHEYrqbsJLNM07etr/ljWWiiNA== Received: from apc01-psa-obe.outbound.protection.outlook.com (mail-psaapc01lp2042.outbound.protection.outlook.com [104.47.26.42]) by mx08-001d1705.pphosted.com (PPS) with ESMTPS id 42xm7xgxg4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 18 Nov 2024 02:01:42 +0000 (GMT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ptk1iYjQM28YEjlxMNtM9M31W89DN97kktpl3iATq0LO8PFexmt8ggR9k4aSoVxpdmnl2mL3qCOA3S9qRBwVb+jyUm5v4uhHoFuCn4JAWlHzA5I0rdeQjb95r09kKHSWpIFWSo7cdPpHpuODdAk38HSABZTxzB8IygCfB8URgd0qPO1ehVhnN9mUTOedUheVr579dCoMf8gK9okHaKNoMKlDnhq5GbaXXxfG9QVvpzN/Bo/TZXEHjTfTzfy61KzPo+4H0UsdOUzCEVL9iFrwaYzDdGbtxQghuJgUMzkb2nXilj5JFO7mE1LNxS8WPA4pLB9TRTx75I1IBwlqNVO4BQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=NivdX8AtRVA6JNFvv/TVGM9USOTDI0TcVF/YlAo3/Gs=; b=ZzGzKMsZPl/3s2EegJLXqWouABQJl812k1qoyA8p/2IRtBo0RJlzpEZKZYXxuTiUwvhkBthzufZvwGTICrYKKsIKweEi3crKAcfMlmP/uo+VaEpj4S4HKrXU4SEE/MNy9qk1NN39dGcABP2NhqPU+PmFWG0Mh71XK1I8QaxFXItmVEQ6s9zhF6OyQRKo+XzsjVBdUFjOc+SCG2q2k837+09OxClGwukNYADZ5wWEyGAkfBrRllkRs5nQu9m/xMriVqoC2t1vpI9Mu6LJxoJBvwe3rTM2CzCs/K8PUwH6wTomIhEWYWYz1jZJI5OscpfLGv0COVbQrjdk7Lhi9vMS+A== 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 TYZPR04MB6119.apcprd04.prod.outlook.com (2603:1096:400:258::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.22; Mon, 18 Nov 2024 02:01:37 +0000 Received: from PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::409e:64d3:cee0:7b06]) by PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::409e:64d3:cee0:7b06%4]) with mapi id 15.20.8158.013; Mon, 18 Nov 2024 02:01:36 +0000 From: "Yuezhang.Mo@sony.com" To: "linkinjeon@kernel.org" , "sj1557.seo@samsung.com" CC: "linux-fsdevel@vger.kernel.org" , "Wataru.Aoyama@sony.com" Subject: [PATCH v3 1/7] exfat: remove unnecessary read entry in __exfat_rename() Thread-Topic: [PATCH v3 1/7] exfat: remove unnecessary read entry in __exfat_rename() Thread-Index: AdrpZcjCRKtT0hm3SA+WwfLpTFDiWBP9lkEg Date: Mon, 18 Nov 2024 02:01:36 +0000 Message-ID: Accept-Language: en-US, zh-CN Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PUZPR04MB6316:EE_|TYZPR04MB6119:EE_ x-ms-office365-filtering-correlation-id: 97a4eefc-f213-46aa-257d-08dd0774ef50 x-proofpoint-id: d8690225-876f-412f-87c6-a7cb45557a4c x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|1800799024|376014|366016|38070700018; x-microsoft-antispam-message-info: =?utf-8?q?v5V6xWVSkWb89CdO0ZzCVZF5E5TFblz?= =?utf-8?q?sP/gkZgb3T1ZAJr2ODS8sGZeIIJof3Jonxe/uzGR0AElKHFr/G+Jxy8zNdrGnOwAn?= =?utf-8?q?wrEP2gWWFBAMBjE4pSM9kdulo8WXwBLDvie9Ddt8hDYQN07x1RQ5NLOHGOqAVKoJI?= =?utf-8?q?ZPVZkZyORnLC883RSZUNw0lLvCeyDO053PEvXFQtw7U+DW+rq8AJNTtyvOhCoQIl/?= =?utf-8?q?3qeCdyRI8z1A7JPdzsXx1R9d6P1J77Bh9SQIE9py86DfJSdDIdauVovaGCK+7wJ5t?= =?utf-8?q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GM61oBxLNtDSxSq2jFWciXPLiaIQkzzVcy2BKR31FOT+4Z4zkeKoiQDTHaV9Wc2/?= =?utf-8?q?SLL3y20HVixV2qmZrEHB20ol2leq69xHCermml/xG8IogQ2HEXcE+M5a8Z6bwcGIJ?= =?utf-8?q?8AeaBNThOXroA0WN3Atn6EMzF/1Az59h95LEkGjla552oz5b3qO9LSN0=3D?= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:zh-cn;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PUZPR04MB6316.apcprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(366016)(38070700018);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?OK8UZWE8RLL8adGTJ2ceGdPQHCH7?= =?utf-8?q?o1tvUd6YHllWMVGeJ2H4ulQLnRkDcg7KlTFJoCYMWPFqfqXy0LP+pFO2nPhBrVh4D?= =?utf-8?q?hue4KbB+gEcM/R5Tk4gqk9Wtd7fXVhpTZoyAxbyGF965AuYhACC520tNmotB9xuWz?= =?utf-8?q?Vd6ydCkfgEtVD4M4FzFJQviZR5E36HZ9PE4m2d4DzYUsaBpGoujbPae13qpkr8DZc?= =?utf-8?q?Ct5VY++IUAg/bykQuuv+iCqtm+V6rN6OL51uf6491KuBsB/ZSwVSnZZyAD3IwHL2r?= =?utf-8?q?wsQHgmBDxXORtPqfebfjIs/M7LwVg8f96BwZ1aYyMBNZ4qo461SVR4QiC/g/Lh9R5?= =?utf-8?q?bWY9fBvRSg+RMsRdBY52UhXnTDT2jIPFxqX8flyPnHYdB4wBAEhkQlv/bu+q9ATT1?= =?utf-8?q?nft6UINHJVT4C3V3SY8EU0c4uhMBK9UiXh03DpcJbChwI8t8ehuY7OpnO8AkKeFCI?= =?utf-8?q?M5C1H3RofDCd8PE1q+PavmgWqpfuDot8tl2T3X/mNtsJOeR7uy/5whOyYymnk3ch6?= =?ut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q?ZoxLjSQEJdbSiv8cpDot4Q1fSpWGB4Zbr3avBvLlNZI57biVXLsmoCDVeq3Y1KX+e?= =?utf-8?q?12WxUou4aMwLlmeINEbQo0b7N363OLb/czc1EwdYs0aLaHLNuNftX7s2gf+VrFtXU?= =?utf-8?q?Z+pk2poJELLg?= 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: al9Ddb4wAdgjzdTUgxYiXDxH05Kpe5GF7OdnLlZK5xcGnLYTT7XeM73DmawsLpCGGskBo5t8UoDgZpDdO9OW9PZxf/O9TeyFA1QCSiEdVUpVWsGuyzoKtjGRsqqGRvgsLWSDTNlslblKPuLPWLATB0OwfENMWoDInetR0Qp36NTAAkQPF0KCW54T/HLeFEDpkJCxOnzp+1tz0ghjXqQSGH5AvOLuJ4dD/taVikRChLeM1ax78QcmKT9wkya7XTa0u09gGNwxVQ8OonRfetYg55YGZT1Z5LLa549IBkI+Bw6ktDQzbPY3B5Egw5mv3wCGAiHQMdDQ4B2qiEyIsR8R1tRd39YZXW/DbFFGkcXSVEo2D35YnYkhcGw6nsjOk0Ijw0G2i49VfOaNSG38ebIJ3YNlFeT74vHRaq01FEvU6CzRS7Xsfr/LucHOkXA5FTQhSx/kIIc/NJWee5OwhEGrMklMbkga/XrygNmf5uwto9RXAf2qh8XEiWxlshiY5IghWC6lWPSbQSejlqbz7fYPaBxcbPqjCUuRKOfk195qbzfp3wCIXAfAoVTh445PQZ8fOJl9N2+uumPRh0H8Zr9aU/yv5wkbQA3i4YCo8FaPmGsMHxVA4KITEAgVHOjW6DlS 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: 97a4eefc-f213-46aa-257d-08dd0774ef50 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Nov 2024 02:01:36.8660 (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: 6+n8c6ElkRubjddFCTsuzLNqwHUkN7dY1Y5Uf5w5LUlXKSZhJ8GqzwA27e3BDdgtYOXH9aBBuUV+ZzDk0Hq/zA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR04MB6119 X-Proofpoint-GUID: Pb27w_B8xuVOUccb6BiWsZGY0Zhopn0R X-Proofpoint-ORIG-GUID: Pb27w_B8xuVOUccb6BiWsZGY0Zhopn0R X-Sony-Outbound-GUID: Pb27w_B8xuVOUccb6BiWsZGY0Zhopn0R X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-11-17_24,2024-11-14_01,2024-09-30_01 To determine whether it is a directory, there is no need to read its directory entry, just use S_ISDIR(inode->i_mode). Signed-off-by: Yuezhang Mo Reviewed-by: Aoyama Wataru Reviewed-by: Daniel Palmer --- fs/exfat/namei.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/fs/exfat/namei.c b/fs/exfat/namei.c index 2c4c44229352..6723396deae8 100644 --- a/fs/exfat/namei.c +++ b/fs/exfat/namei.c @@ -1118,17 +1118,12 @@ static int __exfat_rename(struct inode *old_parent_inode, int ret; int dentry; struct exfat_chain olddir, newdir; - struct exfat_chain *p_dir = NULL; struct exfat_uni_name uni_name; - struct exfat_dentry *ep; struct super_block *sb = old_parent_inode->i_sb; struct exfat_sb_info *sbi = EXFAT_SB(sb); const unsigned char *new_path = new_dentry->d_name.name; struct inode *new_inode = new_dentry->d_inode; struct exfat_inode_info *new_ei = NULL; - unsigned int new_entry_type = TYPE_UNUSED; - int new_entry = 0; - struct buffer_head *new_bh = NULL; /* check the validity of pointer parameters */ if (new_path == NULL || strlen(new_path) == 0) @@ -1154,17 +1149,8 @@ static int __exfat_rename(struct inode *old_parent_inode, goto out; } - p_dir = &(new_ei->dir); - new_entry = new_ei->entry; - ep = exfat_get_dentry(sb, p_dir, new_entry, &new_bh); - if (!ep) - goto out; - - new_entry_type = exfat_get_entry_type(ep); - brelse(new_bh); - /* if new_inode exists, update ei */ - if (new_entry_type == TYPE_DIR) { + if (S_ISDIR(new_inode->i_mode)) { struct exfat_chain new_clu; new_clu.dir = new_ei->start_clu; @@ -1196,6 +1182,8 @@ static int __exfat_rename(struct inode *old_parent_inode, if (!ret && new_inode) { struct exfat_entry_set_cache es; + struct exfat_chain *p_dir = &(new_ei->dir); + int new_entry = new_ei->entry; /* delete entries of new_dir */ ret = exfat_get_dentry_set(&es, sb, p_dir, new_entry, @@ -1212,7 +1200,7 @@ static int __exfat_rename(struct inode *old_parent_inode, goto del_out; /* Free the clusters if new_inode is a dir(as if exfat_rmdir) */ - if (new_entry_type == TYPE_DIR && + if (S_ISDIR(new_inode->i_mode) && new_ei->start_clu != EXFAT_EOF_CLUSTER) { /* new_ei, new_clu_to_free */ struct exfat_chain new_clu_to_free; From patchwork Mon Nov 18 02:01:51 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: 13878022 Received: from mx07-001d1705.pphosted.com (mx07-001d1705.pphosted.com [185.132.183.11]) (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 10E8533E7 for ; Mon, 18 Nov 2024 02:02:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=185.132.183.11 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731895342; cv=fail; b=He08Fq+AhDobZtuGiVGCBYg22mrog6+7mj1879VmYBXmQQ7z0YqzSSr4I6QT/VNO68h2E0qJymHWmug0KGJtpQ7mEbvSTeDRboN9wK4wLYxLcmJldk6Gk+lBBx0BUQCpDt8EJ6dCrFpHhJbwRx9pc3heTZS/Zuai6ns/TPL1/LM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731895342; c=relaxed/simple; bh=rkrl6YX8xbN+xRG04wIpN0gi4doZWCF6YW6YuY41ie0=; h=From:To:CC:Subject:Date:Message-ID:Content-Type:MIME-Version; b=ltZmxM85G4brzAzZTK+VtPC44mBKdo0BIah3O8MPFsf0vTs5xbibsVJ/2FU5QR6yd1RoN4wCMbfK4LSUfgp48FlNYIjmr/lt+hifLYSzMtPn6G3NspaV1kZ/nRW8Vlqybfz8FVYaaSBmju9tOdGOQ+FVaFIs4HaW5TUWt7z1Qrg= 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=DqX/+J30; arc=fail smtp.client-ip=185.132.183.11 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="DqX/+J30" Received: from pps.filterd (m0209324.ppops.net [127.0.0.1]) by mx08-001d1705.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4AI0xxNI007562; Mon, 18 Nov 2024 02:01:58 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sony.com; h=cc :content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=S1; bh=rkrl6YX8xbN+xRG04wIpN0gi4doZW CF6YW6YuY41ie0=; b=DqX/+J30byApADko54JkpwUhS0dZqADOdIcPr/9Yxuq9P 3hsd5X+0fTb8Pp3tjJT828cI9ZBnOgM/umo+zghAVMrCjJwCFdNXiQqPWQctxtY6 29oWyFXSVWZzRnyZTIkh6M7/PITBLLYbcAtNpnR6vk9q5pIuLgLsrxdl7j6nRogr VMqYKXuGnItscOiCmbU7RanlJHrbnvrQjHyOR8ii0+LdvfT0sMb/e2qtXGa8sV3v 4gMvh7LziPSAY9aAM8UkJd9eGGdjNaTTUtNX1HIlcotIyxoeiUKFv4v95vbgKCgZ dVWQazU6nWN2zVUCYODlq1/cOPHolw+7fgK2wrS3A== Received: from apc01-tyz-obe.outbound.protection.outlook.com (mail-tyzapc01lp2043.outbound.protection.outlook.com [104.47.110.43]) by mx08-001d1705.pphosted.com (PPS) with ESMTPS id 42xmc3s3s0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 18 Nov 2024 02:01:57 +0000 (GMT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=cw+E0GX6EX0lnnYpqDbRigDS0SyLb/QRJDhKH2ytwX1kVMQbuomGCD0tAxu3/v7yE7rMPVpYJxNyWDKshEvU2vQ5+JeZrI3+r2UM6lPVWTJXYADu/T+0WBxKdEV+XqzfLibrtqhATZf7hP6Ww2Ax51Mv3cv5qNyhOhQfeYaOTlxSgbvq69+EEPYZpV0Udm484eDQAcVfm/8acWXL/5jV6MLTt0qM1xfjj7ChdxbKfnzwdzyelaFd7moAzOcZRi3UPbnbmaEvUGfpbDr8xnJXvNs65T7nnmBQBsLOkxiJ51vC/zMxEu30Ah7VTC0c29k6jIDCeOWjWSc5QstZlCuDVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=rkrl6YX8xbN+xRG04wIpN0gi4doZWCF6YW6YuY41ie0=; b=KNsl4UCY6t1MqOQHU/q9033pQSCdjs025lmorQC4H1YWyLpbM+i0x0VKtjb5VTwR9gPAaSDghMyThy+SrKMJg2go5SZIt11ukN97zYeF5phuTMWodn1Q4TuMrAKZcWUV6rqJtxY/3FXeYYktHjDDF6FsXSB/d3bWg+iT4YYJ6G45k9TnlO65pusqk0RwBCmFS9KY6/30upeAm5LS+GYmZ7nb7/vinHGeqxfYxFrstQcZQu0Nosu+SGQVBy8WOr4/TLFHe8Rp9J50/VvTy4QUO9JhKY1+Fbiqz2qH9gFo1HE57C1O343sGOmjXHeSer6VLIrZYeLLfh0Kr/0phTqAIg== 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 TYZPR04MB6119.apcprd04.prod.outlook.com (2603:1096:400:258::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.22; Mon, 18 Nov 2024 02:01:52 +0000 Received: from PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::409e:64d3:cee0:7b06]) by PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::409e:64d3:cee0:7b06%4]) with mapi id 15.20.8158.013; Mon, 18 Nov 2024 02:01:51 +0000 From: "Yuezhang.Mo@sony.com" To: "linkinjeon@kernel.org" , "sj1557.seo@samsung.com" CC: "linux-fsdevel@vger.kernel.org" , "Wataru.Aoyama@sony.com" Subject: [PATCH v3 2/7] exfat: rename argument name for exfat_move_file and exfat_rename_file Thread-Topic: [PATCH v3 2/7] exfat: rename argument name for exfat_move_file and exfat_rename_file Thread-Index: Ads2/7nXFdJ14dydR3K7zKkd3b636wCXNCsA Date: Mon, 18 Nov 2024 02:01:51 +0000 Message-ID: Accept-Language: en-US, zh-CN Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PUZPR04MB6316:EE_|TYZPR04MB6119:EE_ x-ms-office365-filtering-correlation-id: d42d29f2-7bdb-408d-4b62-08dd0774f83d x-proofpoint-id: d8690225-876f-412f-87c6-a7cb45557a4c x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|1800799024|376014|366016|38070700018; x-microsoft-antispam-message-info: =?utf-8?q?1dYex9Hy3adoHC/aLiDe1Ov0D0FDbjm?= =?utf-8?q?2n4SxyHh13i+UoRhWH8Nitv0urksj1E/1J6K39gXKc8M7Wo5p/MwhRVu/VV25jpGv?= =?utf-8?q?Sum3up0zkmUAwhv2NfnPJzDKHcdaZNtlF5BzgNeohrVFzzYplVUsOLUV4ZdvPlTPE?= =?utf-8?q?rJplY0gDZgUC9mkomn+q9LV6uQStlylkJHVYk4nbXocqOYYQXQuNbkdA/P+c+j2u4?= =?utf-8?q?Jm2Wpts7FiH3ZrYBovtq1JkTCtZLYuEd+vKxOfI5LYqmOTa3uwQGXgA56EdkjhDHE?= =?utf-8?q?NPYHm0F0A3OYb4hjam94nuTBMBXsRSU3xtSbnFZ5Mh0oaSSrwd70OWnaHa8ql7pOV?= =?utf-8?q?JFqjx7+NA0ekfV1gGFGTOx/d/U6KvGeakm243ZCRZpFCVqOMEG87sKx5xoZNnQ8wy?= =?utf-8?q?SWEWPBMO22ZXbqm6xt2vlkx38ymktpvvHfRPrCjcLMEOLQ+oJYp6FA837XvUq0/Zp?= =?utf-8?q?QRb/JA6iLH+TBVwxlQ9sOfD3c5N2Nf/iQOMGVAO9gHYUIIOfUluQCF/+LMP8ZAXMU?= =?utf-8?q?MKPeM5kMUeTNl6sY7Pas9C9kvz4kvRHJvPwPRfsWFyVVIPqZHOWFX2Rm3vW0rUEUR?= =?utf-8?q?IMc9TooZuOgrh4MWjnIXwf4cJlr/HYLa2i4ItvRUNGZ+gT9wMLPv8qs2Ru6g3Pycz?= =?utf-8?q?LRk+aVfrW5GQ8MOEX+B/1dCA/sGOie/8hiRIsa2++25OhVsvtcaEZNT0d7lBwdpSL?= =?utf-8?q?9baKjNFWQkuhacQAdZzRbp55o5T/hWHfrjGAAaI1aUu2RK+7500xhzPOd/1SqRbIu?= =?utf-8?q?WySz2TwT3kvkZNUWk2uGyg7M8//tilegjhHe42mGAkTzaQF01GgNntep6rEkY1okU?= =?utf-8?q?2QN6pzInlk/rY11x4xfIzgIDQJFWFldsTWPpjdqTAGBaglrFZkfIJf8FRROaQUniC?= =?utf-8?q?uBZxK/tVg62qP+vyMu+C6J0UFlMuAVdMyj9ItwrpS6+U+A2pVB/iC0+NpyACAnLrT?= =?utf-8?q?7WNkPtSmQoWwXdPXkFPWHTQ2CYvJm2bNFFvJI70Qlp/RQI7he9b6qStu8PiZnurmz?= =?utf-8?q?ctkUY2uKAN+fzKtYVgbjQQQSWCjjauhV43VaJK4OTLdF2SjLaemKQps7nHED497As?= =?utf-8?q?XQbN69G0fZA8UxdwfQT19BzXyW5dG8g34mhGOF9t3zKmujtBnZuGHGeHUvFtvWIxn?= =?utf-8?q?EaOdrQfMQtxfxaaRxV9HN3tM4pMDOvdfMxY+OlCfM4aNTko2JymuOOLqLhox7CoOE?= =?utf-8?q?8aJZAiHHvHQlNGAZrEpX384g+uvZ3YJpfoBsozKpVALuwlrAO/stSfZ0tQHwz9wd1?= =?utf-8?q?U9eWUCfvwMHzOeBzK3tXdLVTmCkbqkz1fRWZ4+geja3efGc8xuYIY12M=3D?= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:zh-cn;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PUZPR04MB6316.apcprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(366016)(38070700018);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?OalAmvM7APf1eBLynceQ8ggG5OXc?= =?utf-8?q?xWRM/F6oXpXvm/4/pnrzT3r1jg1aXqhMLeDdPWS4WBao0vzaKPvESaQ1mdzHSv0XW?= =?utf-8?q?gWhmoqHvXx5Bu5WlspGpsxtSAFe+YC8d27ybYZNqCKkkxw/fsqJ1igYaJleji9ytp?= =?utf-8?q?pfy1eT90Zo9ThOqFBt2mZEDOh0SQoNKMh1FzSEqr6D+mZ2RjejLhrLn2RQUCQn68n?= =?utf-8?q?zpsZB7/zv4DP4xErPhia1D8EuAM+eLbEqStBVNI/KBjQAdhKeQS5voSemhHvdTUiP?= =?utf-8?q?wwOLhkCAp++ibn1K0kgYa/WiPrAYj7oxU7wkQBcCYMTvn7dTwF/wRdsOBacdg1GC6?= =?utf-8?q?lNl9QVx52ne1pFMKXFaGqo0DoGbgm6UEv0goiHabfy/kSszxieo4K9yMFxLoDiFgA?= =?utf-8?q?6zLDV1Me8MRWj2dBl02i1fUvDcrL3FRE2+kDYh56Ac6GxmhSs8V5ahfF755qJr6H9?= =?utf-8?q?h35REqeFNE+PMjmrTUCZcG6wzanHMfVLF2vbU2JBmZPjHbPXbe+G6Iwv7MGg51mF5?= =?utf-8?q?sBitD0YK2MReDsxjj+aTXIGDOxI38O77zTtV/R++oY1emOu4YVzJDEiZKRVPVrvEC?= =?utf-8?q?FbSBMxwOCH9QFS/Jka0BQC7QK8XxYOdLW2EbCNVplk2JH+dkAm1MtVkLtVMwJZybK?= =?utf-8?q?bh7AptdP2Iq5sKjiHIReLrFi2/cUNu1WVnVim2Rf3nc0yLC9tfuEU+Apx43rJ/maW?= =?utf-8?q?j+wdTeNY1psba4uqmWa7N5q0jyccy/rLSmTSnuRh3xpTM4C8hfQmHp1ssMO1HJDql?= =?utf-8?q?1EO+7i8UBSFGRxyOfhnJdktSZHwyXprgf1Avg2XY+u5tdI7oWCDrbmfmb5Hbk7DN1?= =?utf-8?q?r0oyzLi+oSILiDDF30tFecTPmsUjCnPe1nPBZP6gNDU/z5r2yco36XjfKfuS7CgxX?= =?utf-8?q?B2MBD3WoSYN3faxZzVYYBr84PerpwY3agau6a2doKmlLzmTHkv9kembrQZWpsHgsH?= =?utf-8?q?U7QgYv7mnoUfK3K9CkC3yWSebd0Vt/bhCdNa42vVeBLpvDS0DSiHWeSAh/xp2z5Ay?= =?utf-8?q?jfKshAZihBzGM8hamib0wUYrc7h4Ibybi5oChaUUrnqbkVW4Mn4p3Nvpki+BBJAlu?= =?utf-8?q?kGtz13o5dN30K16VqwubO0PFHsC4X2YlK8F38+y7KhNi0yMEXVWJ2o0Iq/fSEUyZ0?= =?utf-8?q?6OXhyEJSwyijMpm7CsSLm5ci0/UPkclQnrzNhV51F1Zt6z8ESx/OAzZoB9xw0EKyi?= =?utf-8?q?gYKbxCUGf9I44w4pZK7+uLkE8GJAqQsdg8ajTB39e/FLkrc8yGCpmB3h4TsVRGAt7?= =?utf-8?q?S9zEiCrACzuDC1wehJrhCfjRszryqoQ4+0EtMnTjC/3yXRv6gUyBPw9FEwKn9OsSv?= =?utf-8?q?8VSVtAo67I0C+AueCvX1Wk3xYmIUbjN/Es5V9HBk6pQW4dqE+mfvO2UwwkrSiuDQV?= =?utf-8?q?+fEFqdERxirDaZoT5PXP+Mzai3oKlhxSrDuMIe7ad0div1vDFvdkh1l+Bf7pZQ6VM?= =?utf-8?q?8hFYF3iFmDexzqAW9XXSkRsSUCtqmBlJa7MhoPttX9vrJbIKuO6NqNWO14LfkXJsj?= =?utf-8?q?Eu2ueTF4TByL?= 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: PyFMMyOyn7BG8LZSpOGghKWWSBtu73KhnMrNed5Pq2Uebq258rtEiY+UlkMFlEpnOXxcyyaaa+y383QY+myv3WUwi2XBO5hPqKrkPRIIpUOHVsgJthqk/nNNDZ6KEPgE3fEXZuMdhdCV44cLH0Hk+Qvh7V0pEpFzZoPbU/c6r9aMFZzPMEdKtR2U1r5OfxmbIxpL42MLh+eZeFEsXYo/gj+1b5PxLSA4yVdWK4Ey3P+DaPw9rIoceX5YnCW1GRw5JTuj9RKkNCh8fVhabbc/JDJyI2a5RtT32pa0x01L9eKjmRfREe8p5XD/uaBJ54BFsbcxh/IToHSVsHUx5Z7fmizBQo4lYFXHPgwM21aJZdcZQdcqKB3I3arAZ3tEopx8ekZnPFBK1LKcW+LRYfQotX8WFgS2FIFNI0Y6n0LhXWLMBo4qDpFq2SQqvCpEa81Nfp/0aOiSNgulq2hR3ofU4eZ9fTzQY4+P4aPKRS51M/M/OUtCO2GN1oNCq2BEA+MlX2ZXQKpRFS9VwDwjlTNpeybLYCOieWB8rih10GPXZuGaxYb5JD2u8z/sOgPROFMQ6Ujvx5NL3sTS8DV+a4QbzM4Q/AitCZRybo64Nztn56CORtwArSn4OCDZ25vygm9+ 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: d42d29f2-7bdb-408d-4b62-08dd0774f83d X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Nov 2024 02:01:51.8053 (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: RGF+xItwGHq3Npj8tx+q+i0Sq3ad1Eiy2FnqL8Bzfye89ojuzt2P2z30BFMvYsFeYpg8Xbq5gTvAaX4fxbhX1w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR04MB6119 X-Proofpoint-GUID: 4haWbuVq3nTgNe0HXovKxn4rJzkhbDiY X-Proofpoint-ORIG-GUID: 4haWbuVq3nTgNe0HXovKxn4rJzkhbDiY X-Sony-Outbound-GUID: 4haWbuVq3nTgNe0HXovKxn4rJzkhbDiY X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-11-17_24,2024-11-14_01,2024-09-30_01 In this exfat implementation, the relationship between inode and ei is ei=EXFAT_I(inode). However, in the arguments of exfat_move_file() and exfat_rename_file(), argument 'inode' indicates the parent directory, but argument 'ei' indicates the target file to be renamed. They do not have the above relationship, which is not friendly to code readers. So this commit renames 'inode' to 'parent_inode', making the argument name match its role. Signed-off-by: Yuezhang Mo --- fs/exfat/namei.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/fs/exfat/namei.c b/fs/exfat/namei.c index 6723396deae8..c61fddb9b23c 100644 --- a/fs/exfat/namei.c +++ b/fs/exfat/namei.c @@ -982,15 +982,15 @@ static int exfat_rmdir(struct inode *dir, struct dentry *dentry) return err; } -static int exfat_rename_file(struct inode *inode, struct exfat_chain *p_dir, +static int exfat_rename_file(struct inode *parent_inode, struct exfat_chain *p_dir, int oldentry, struct exfat_uni_name *p_uniname, struct exfat_inode_info *ei) { int ret, num_new_entries; struct exfat_dentry *epold, *epnew; - struct super_block *sb = inode->i_sb; + struct super_block *sb = parent_inode->i_sb; struct exfat_entry_set_cache old_es, new_es; - int sync = IS_DIRSYNC(inode); + int sync = IS_DIRSYNC(parent_inode); if (unlikely(exfat_forced_shutdown(sb))) return -EIO; @@ -1010,7 +1010,7 @@ static int exfat_rename_file(struct inode *inode, struct exfat_chain *p_dir, if (old_es.num_entries < num_new_entries) { int newentry; - newentry = exfat_find_empty_entry(inode, p_dir, num_new_entries, + newentry = exfat_find_empty_entry(parent_inode, p_dir, num_new_entries, &new_es); if (newentry < 0) { ret = newentry; /* -EIO or -ENOSPC */ @@ -1034,7 +1034,7 @@ static int exfat_rename_file(struct inode *inode, struct exfat_chain *p_dir, if (ret) goto put_old_es; - exfat_remove_entries(inode, &old_es, ES_IDX_FILE); + exfat_remove_entries(parent_inode, &old_es, ES_IDX_FILE); ei->dir = *p_dir; ei->entry = newentry; } else { @@ -1043,7 +1043,7 @@ static int exfat_rename_file(struct inode *inode, struct exfat_chain *p_dir, ei->attr |= EXFAT_ATTR_ARCHIVE; } - exfat_remove_entries(inode, &old_es, ES_IDX_FIRST_FILENAME + 1); + exfat_remove_entries(parent_inode, &old_es, ES_IDX_FIRST_FILENAME + 1); exfat_init_ext_entry(&old_es, num_new_entries, p_uniname); } return exfat_put_dentry_set(&old_es, sync); @@ -1053,13 +1053,13 @@ static int exfat_rename_file(struct inode *inode, struct exfat_chain *p_dir, return ret; } -static int exfat_move_file(struct inode *inode, struct exfat_chain *p_olddir, +static int exfat_move_file(struct inode *parent_inode, struct exfat_chain *p_olddir, int oldentry, struct exfat_chain *p_newdir, struct exfat_uni_name *p_uniname, struct exfat_inode_info *ei) { int ret, newentry, num_new_entries; struct exfat_dentry *epmov, *epnew; - struct super_block *sb = inode->i_sb; + struct super_block *sb = parent_inode->i_sb; struct exfat_entry_set_cache mov_es, new_es; num_new_entries = exfat_calc_num_entries(p_uniname); @@ -1071,7 +1071,7 @@ static int exfat_move_file(struct inode *inode, struct exfat_chain *p_olddir, if (ret) return -EIO; - newentry = exfat_find_empty_entry(inode, p_newdir, num_new_entries, + newentry = exfat_find_empty_entry(parent_inode, p_newdir, num_new_entries, &new_es); if (newentry < 0) { ret = newentry; /* -EIO or -ENOSPC */ @@ -1091,18 +1091,18 @@ static int exfat_move_file(struct inode *inode, struct exfat_chain *p_olddir, *epnew = *epmov; exfat_init_ext_entry(&new_es, num_new_entries, p_uniname); - exfat_remove_entries(inode, &mov_es, ES_IDX_FILE); + exfat_remove_entries(parent_inode, &mov_es, ES_IDX_FILE); exfat_chain_set(&ei->dir, p_newdir->dir, p_newdir->size, p_newdir->flags); ei->entry = newentry; - ret = exfat_put_dentry_set(&new_es, IS_DIRSYNC(inode)); + ret = exfat_put_dentry_set(&new_es, IS_DIRSYNC(parent_inode)); if (ret) goto put_mov_es; - return exfat_put_dentry_set(&mov_es, IS_DIRSYNC(inode)); + return exfat_put_dentry_set(&mov_es, IS_DIRSYNC(parent_inode)); put_mov_es: exfat_put_dentry_set(&mov_es, false); From patchwork Mon Nov 18 02:01:58 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: 13878021 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 34D9D33E7 for ; Mon, 18 Nov 2024 02:02:13 +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=1731895336; cv=fail; b=u53j2Vdve9hqagiPEXZPlFE2c7+gzXJ/syE20/gEBduerspM5Mq9TFOMQESV+6LfgUpds5SWntqnvhu+kMcuuiG7q3ig5EsU2zBY4RaMyAOAWJxuKQ3h5in83lmeObglsQ59zMT5ccrtvgLQCBhbtF0ePPGKvZEhzIZgeJly3M0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731895336; c=relaxed/simple; bh=Vcda1x1I6Ld/dIrWnPI8SRG3HDFKEQ3PfkHcSfc5KpU=; h=From:To:CC:Subject:Date:Message-ID:Content-Type:MIME-Version; b=VnSGvnJp1pH2FHpX8CTO2ow7nPhUixdMyXiCDWOUhso34ZM9r9UFfNBjmWJaS6iAmNw2H+cMRfdz8uOK+0q4oaKg9HV964cNM2o68Givjd/i4tysfsG0I/kEQ6uZPkdrpzaQKwMbz5kyEkxodA7rhom/EqGUsNBo4nxCWC/KgKI= 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=DXueErnV; 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="DXueErnV" Received: from pps.filterd (m0209323.ppops.net [127.0.0.1]) by mx08-001d1705.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4AI01e38009889; Mon, 18 Nov 2024 02:02:04 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sony.com; h=cc :content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=S1; bh=Vcda1x1I6Ld/dIrWnPI8SRG3HDFKE Q3PfkHcSfc5KpU=; b=DXueErnV3iLuCNMCzGgpiZH2LYjwPRAz37USajNW0WN9e 1tPMrbRcmB3obO5bcZPLirHAzxKhzJLfH+U2lcXaWs5oAnn61P4GbHpi7Qma7ASa bFiesVqB+OCLAPy94qY5LHMxO6Klx9qcNNdNVRoU7WkkUDvr0IOTOSgg00EpQOlB bWhoY45YXHCCWl4m8p/1Xc/12R1fFFGPEPRi6cl/a5JKGV3/Ho9nuV57OHuGiX1n aS7PW3WHIolyQ+CKQjc/lQ97/re9ks9uYIthTICN4FEIYncOg28HtkZWCbIF6E+L tKmBVjmJ0l6nHIxIHtdwNwrB0Optyw6uCkkIIF6ew== 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 42xm9p8xen-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 18 Nov 2024 02:02:04 +0000 (GMT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=PKPFnxADQGlOuOlqOgm5DgQqekt/BhtfBEMPXbqbU9qknU0cOXNVhX1MkFVItGSch8Xnmd/mo2ygg5Q2PH9SNJ4UDtm71sHk6TC6g0DW3GREE77ojyF7wXl32XaZ0emMf+Ijit/hn3dg0GJnoHk6vB1zfW0CXBioarpkwzGs2zbOQ5vkLTn2aWh0oMy/JJwLLcz8rQicIOrwNjMKv7rKwW9jL2Rf/h1iAIZEmtWVV8a1mL2yYzIfBED28s1OgoJjQ4UfP+nvf048bcsECyCqaqsNoHdMSUaqxOxROR96MVF58fZDS6U0i6bWJvV2bvs06aaG6nWAR0T/ORY1ln3B1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=Vcda1x1I6Ld/dIrWnPI8SRG3HDFKEQ3PfkHcSfc5KpU=; b=g7LYwz6/uNbzGJEXWzgFddDsT3m4PMOicXoeiPIj7byY/Nmi0q00MSLwgoXGLBi/Jc50BMMcgef45fAhnlkzCKRAheDssxI2rphvk2OE9b4UwP90OalsXaq2IR2Po9q78euRIRYVrwhyCRTV6axadLTMH36JlzHRmcdXy+lrK2vjetZxWyS2CKCCQgAG3nWWlmWcyNT1HJmVS/GfDSfE/9xLzRn/PO/ycCWfAmrfpEb05SiQruJJ49trAZ6Ae+xEM5sGlO+ZQcYfKy4v+7mv/QCrdJLDbCqEya/metl8pf1Z6OPhtL49XsewC22y/xeu2fIhujR82XV1hbMHTxOifQ== 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 TYZPR04MB6119.apcprd04.prod.outlook.com (2603:1096:400:258::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.22; Mon, 18 Nov 2024 02:01:58 +0000 Received: from PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::409e:64d3:cee0:7b06]) by PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::409e:64d3:cee0:7b06%4]) with mapi id 15.20.8158.013; Mon, 18 Nov 2024 02:01:58 +0000 From: "Yuezhang.Mo@sony.com" To: "linkinjeon@kernel.org" , "sj1557.seo@samsung.com" CC: "linux-fsdevel@vger.kernel.org" , "Wataru.Aoyama@sony.com" Subject: [PATCH v3 3/7] exfat: add exfat_get_dentry_set_by_ei() helper Thread-Topic: [PATCH v3 3/7] exfat: add exfat_get_dentry_set_by_ei() helper Thread-Index: AdsFm7o69pSeu2bAR9KHr0tMBqa1WgzwPUxw Date: Mon, 18 Nov 2024 02:01:58 +0000 Message-ID: Accept-Language: en-US, zh-CN Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PUZPR04MB6316:EE_|TYZPR04MB6119:EE_ x-ms-office365-filtering-correlation-id: 9a1f4db4-1d77-45e3-8e1e-08dd0774fc19 x-proofpoint-id: d8690225-876f-412f-87c6-a7cb45557a4c x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|1800799024|376014|366016|38070700018; x-microsoft-antispam-message-info: =?utf-8?q?UlkjWu559ktHmuGX6sAdnJiHBr7pDmb?= =?utf-8?q?NrLAIYk+WVP1s91U2HsIMjbdWN8WLxcTwfHNvGycj0nOrZfcCUG2csRrZV22iYsTi?= =?utf-8?q?q68VF95N2VtZhg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m5SUtC3tUF8BnQS1r74bilY68yy5l6eDYTLOKrRJseb?= =?utf-8?q?auGYP7BUXDWC0WesVwOxdumi9mIvIUOA+HkSgIam6gfU2uiNpuH3XMgMAO09Ay9Hq?= =?utf-8?q?/ovv1vi7cKc7anE7TlBnptuyVJyhaq6XtuXYvnaFlS3ymXqGkScEogyA5RKF24MIt?= =?utf-8?q?hbHdIgcBvlSxl9DkSjH55wDbxvvlgouBWJ1k8ObhPrkGZpwhE44sZEi/wnRhzJhuD?= =?utf-8?q?jb/uJe7eU/liknTpp/AMsw8nqPYgvMo74BMaEuu8oet8CA6zVPz/iZtnar3d1SSvW?= =?utf-8?q?kQiKCghknMbDTbqQCaxYCUQkfjcpKkmOoZmXz186Md9SWGSjbgzd8Qrw=3D?= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:zh-cn;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PUZPR04MB6316.apcprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(366016)(38070700018);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?WoEM97MN+s5BgQzhXR5EJUShMq9N?= =?utf-8?q?npf8Z4gSPDThvLBF0sWN5qpKOgXuC4PEW44EkFJsvdupr4o9mci/fRH9L0mKPLTAI?= =?utf-8?q?0e+Dib4Jf8LC0HHcILqQTM81AI/1u52G23nnokOtuOQITDHltTJDU/PA7D8/FFs9q?= =?utf-8?q?CrgreONt+89yyIShJ9tJCwmm60Y0899FENffwN2bA0aXSXRGVOy9ZXsWxmPE+ScbX?= =?utf-8?q?4uYBFyNyNyP3lvGUE29CsyJeHJO7iw3X2ZttGABCGKCH4kHIb1iADz+GD4J8quaMz?= =?utf-8?q?5EHqxJybN8p1groC87zz8fZZ8pZ5plrobtTtoykWZIK5Eogejg7EAWi8Rmpg0m4rL?= =?utf-8?q?0krK9AJeycosNp4kjbq9vugz2pfp9c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xgAunamJXFako5C9sesJhmBDIel+KFoIf?= =?utf-8?q?ghMO8WMeJWeY9d+RrtP8xPP9OyOd/GmDhYnDWYgVFq6c08blRxKhd+y+BucfEzr8g?= =?utf-8?q?sDV/o4Q9xD/7WRcaTxXK8i1XEJuFzoMv9GgMhz2nNvANscqTtye980pD1cmBXBh20?= =?utf-8?q?45vww62VcWbKUKHd7/sSy3o1XNm0Wc8tm5o613FvdulcQi291fqdvVJ6CJdVbh3qi?= =?utf-8?q?U+R46TB8teD+Cra5E3vaAMID3a4oY49L2/WD/bcqSgubTivNNrLxtJ/Z9O7biik/D?= =?utf-8?q?9i09qlidvnKe?= 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: 9j1ZWytZgnmMbl1SEIAcwgD9jTS0rh3bRkE9ymFDfRKRgZApc1Hv+ynIE62pmdIqBqmNSGekHPImxpYQd7CtmsuBR5qhIbGGJ29kLTiDlX4ZC9hm3s5jnz9CcYMLOjZNShIf4n+uSoKZoiEHfSsiGRurJELN0R2c40QG3J8BpJREIUDonh4LruXshHsWfA5dL+Znw4mA7Gj3gjZQp/2xLZWoJE+HukiCFZSqp16UQe+cWomdKhp6QmaCoczYOY4QtoJ98TfxdCG2IOa+6WrJnaTmA/O4xM6mLrhsm8HguYnIYhadcH65FWoAzxk+EmdN+2pzT7478MfDffrRSOZN4U5ogshIuM8mf56z9WlHL7J+1HkeaPYeUiT7zFeVgu4K2Wvx+NCp4c4kQ+jHEEhMOggziW2lHj96btuVq+Ri4Xm7c/xUZH87BWpqrbdAfgeiLmf4Dyir5uxDzE7TwnfEmve1sYdNz8E5cMMn3d8xwrStCDDfjoxREbEJgXQptWh/YsziaWonA6bkJzfctpSkaqGJBA9XxyOUMsOUo41Jzd0zKxz/f+A9aQSyE6R4n3YR2S9tKqXY0MmUf40HXguT4gCJkXFzkaYhwkcV1sMIXVrmhNiztugfQZ4MIM7mKTad 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: 9a1f4db4-1d77-45e3-8e1e-08dd0774fc19 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Nov 2024 02:01:58.3256 (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: A/PqV6jxFIuqMOhvSY7nlc/nfRUGE3e6heFmqiXGp3e5LmzP2rUhYwAC1bZsnGXAXDAxq/oo1yciLUXJVbv5Tw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR04MB6119 X-Proofpoint-GUID: cwl9lXU8ys0ukQX4ZA6aZIdgpDiY2fWb X-Proofpoint-ORIG-GUID: cwl9lXU8ys0ukQX4ZA6aZIdgpDiY2fWb X-Sony-Outbound-GUID: cwl9lXU8ys0ukQX4ZA6aZIdgpDiY2fWb X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-11-17_24,2024-11-14_01,2024-09-30_01 This helper gets the directory entry set of the file for the exfat inode which has been created. It's used to remove all the instances of the pattern it replaces making the code cleaner, it's also a preparation for changing ->dir to record the cluster where the directory entry set is located and changing ->entry to record the index of the directory entry within the cluster. Signed-off-by: Yuezhang Mo Reviewed-by: Aoyama Wataru Reviewed-by: Daniel Palmer --- fs/exfat/exfat_fs.h | 2 ++ fs/exfat/inode.c | 2 +- fs/exfat/namei.c | 53 +++++++++++++++------------------------------ 3 files changed, 21 insertions(+), 36 deletions(-) diff --git a/fs/exfat/exfat_fs.h b/fs/exfat/exfat_fs.h index 3cdc1de362a9..28cc18d29236 100644 --- a/fs/exfat/exfat_fs.h +++ b/fs/exfat/exfat_fs.h @@ -508,6 +508,8 @@ 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 num_entries); +#define exfat_get_dentry_set_by_ei(es, sb, ei) \ + exfat_get_dentry_set(es, sb, &(ei)->dir, (ei)->entry, ES_ALL_ENTRIES) int exfat_get_empty_dentry_set(struct exfat_entry_set_cache *es, struct super_block *sb, struct exfat_chain *p_dir, int entry, unsigned int num_entries); diff --git a/fs/exfat/inode.c b/fs/exfat/inode.c index d724de8f57bf..96952d4acb50 100644 --- a/fs/exfat/inode.c +++ b/fs/exfat/inode.c @@ -43,7 +43,7 @@ int __exfat_write_inode(struct inode *inode, int sync) exfat_set_volume_dirty(sb); /* get the directory entry of given file or directory */ - if (exfat_get_dentry_set(&es, sb, &(ei->dir), ei->entry, ES_ALL_ENTRIES)) + if (exfat_get_dentry_set_by_ei(&es, sb, ei)) return -EIO; ep = exfat_get_dentry_cached(&es, ES_IDX_FILE); ep2 = exfat_get_dentry_cached(&es, ES_IDX_STREAM); diff --git a/fs/exfat/namei.c b/fs/exfat/namei.c index c61fddb9b23c..f938299e749b 100644 --- a/fs/exfat/namei.c +++ b/fs/exfat/namei.c @@ -766,26 +766,23 @@ static struct dentry *exfat_lookup(struct inode *dir, struct dentry *dentry, /* remove an entry, BUT don't truncate */ static int exfat_unlink(struct inode *dir, struct dentry *dentry) { - struct exfat_chain cdir; struct super_block *sb = dir->i_sb; struct inode *inode = dentry->d_inode; struct exfat_inode_info *ei = EXFAT_I(inode); struct exfat_entry_set_cache es; - int entry, err = 0; + int err = 0; if (unlikely(exfat_forced_shutdown(sb))) return -EIO; mutex_lock(&EXFAT_SB(sb)->s_lock); - exfat_chain_dup(&cdir, &ei->dir); - entry = ei->entry; if (ei->dir.dir == DIR_DELETED) { exfat_err(sb, "abnormal access to deleted dentry"); err = -ENOENT; goto unlock; } - err = exfat_get_dentry_set(&es, sb, &cdir, entry, ES_ALL_ENTRIES); + err = exfat_get_dentry_set_by_ei(&es, sb, ei); if (err) { err = -EIO; goto unlock; @@ -915,21 +912,18 @@ static int exfat_check_dir_empty(struct super_block *sb, static int exfat_rmdir(struct inode *dir, struct dentry *dentry) { struct inode *inode = dentry->d_inode; - struct exfat_chain cdir, clu_to_free; + struct exfat_chain clu_to_free; struct super_block *sb = inode->i_sb; struct exfat_sb_info *sbi = EXFAT_SB(sb); struct exfat_inode_info *ei = EXFAT_I(inode); struct exfat_entry_set_cache es; - int entry, err; + int err; if (unlikely(exfat_forced_shutdown(sb))) return -EIO; mutex_lock(&EXFAT_SB(inode->i_sb)->s_lock); - exfat_chain_dup(&cdir, &ei->dir); - entry = ei->entry; - if (ei->dir.dir == DIR_DELETED) { exfat_err(sb, "abnormal access to deleted dentry"); err = -ENOENT; @@ -947,7 +941,7 @@ static int exfat_rmdir(struct inode *dir, struct dentry *dentry) goto unlock; } - err = exfat_get_dentry_set(&es, sb, &cdir, entry, ES_ALL_ENTRIES); + err = exfat_get_dentry_set_by_ei(&es, sb, ei); if (err) { err = -EIO; goto unlock; @@ -982,8 +976,8 @@ static int exfat_rmdir(struct inode *dir, struct dentry *dentry) return err; } -static int exfat_rename_file(struct inode *parent_inode, struct exfat_chain *p_dir, - int oldentry, struct exfat_uni_name *p_uniname, +static int exfat_rename_file(struct inode *parent_inode, + struct exfat_chain *p_dir, struct exfat_uni_name *p_uniname, struct exfat_inode_info *ei) { int ret, num_new_entries; @@ -999,7 +993,7 @@ static int exfat_rename_file(struct inode *parent_inode, struct exfat_chain *p_d if (num_new_entries < 0) return num_new_entries; - ret = exfat_get_dentry_set(&old_es, sb, p_dir, oldentry, ES_ALL_ENTRIES); + ret = exfat_get_dentry_set_by_ei(&old_es, sb, ei); if (ret) { ret = -EIO; return ret; @@ -1053,21 +1047,19 @@ static int exfat_rename_file(struct inode *parent_inode, struct exfat_chain *p_d return ret; } -static int exfat_move_file(struct inode *parent_inode, struct exfat_chain *p_olddir, - int oldentry, struct exfat_chain *p_newdir, - struct exfat_uni_name *p_uniname, struct exfat_inode_info *ei) +static int exfat_move_file(struct inode *parent_inode, + struct exfat_chain *p_newdir, struct exfat_uni_name *p_uniname, + struct exfat_inode_info *ei) { int ret, newentry, num_new_entries; struct exfat_dentry *epmov, *epnew; - struct super_block *sb = parent_inode->i_sb; struct exfat_entry_set_cache mov_es, new_es; num_new_entries = exfat_calc_num_entries(p_uniname); if (num_new_entries < 0) return num_new_entries; - ret = exfat_get_dentry_set(&mov_es, sb, p_olddir, oldentry, - ES_ALL_ENTRIES); + ret = exfat_get_dentry_set_by_ei(&mov_es, parent_inode->i_sb, ei); if (ret) return -EIO; @@ -1116,8 +1108,7 @@ static int __exfat_rename(struct inode *old_parent_inode, struct dentry *new_dentry) { int ret; - int dentry; - struct exfat_chain olddir, newdir; + struct exfat_chain newdir; struct exfat_uni_name uni_name; struct super_block *sb = old_parent_inode->i_sb; struct exfat_sb_info *sbi = EXFAT_SB(sb); @@ -1134,11 +1125,6 @@ static int __exfat_rename(struct inode *old_parent_inode, return -ENOENT; } - exfat_chain_set(&olddir, EXFAT_I(old_parent_inode)->start_clu, - EXFAT_B_TO_CLU_ROUND_UP(i_size_read(old_parent_inode), sbi), - EXFAT_I(old_parent_inode)->flags); - dentry = ei->entry; - /* check whether new dir is existing directory and empty */ if (new_inode) { ret = -EIO; @@ -1173,21 +1159,18 @@ static int __exfat_rename(struct inode *old_parent_inode, exfat_set_volume_dirty(sb); - if (olddir.dir == newdir.dir) - ret = exfat_rename_file(new_parent_inode, &olddir, dentry, + if (new_parent_inode == old_parent_inode) + ret = exfat_rename_file(new_parent_inode, &newdir, &uni_name, ei); else - ret = exfat_move_file(new_parent_inode, &olddir, dentry, - &newdir, &uni_name, ei); + ret = exfat_move_file(new_parent_inode, &newdir, + &uni_name, ei); if (!ret && new_inode) { struct exfat_entry_set_cache es; - struct exfat_chain *p_dir = &(new_ei->dir); - int new_entry = new_ei->entry; /* delete entries of new_dir */ - ret = exfat_get_dentry_set(&es, sb, p_dir, new_entry, - ES_ALL_ENTRIES); + ret = exfat_get_dentry_set_by_ei(&es, sb, new_ei); if (ret) { ret = -EIO; goto del_out; From patchwork Mon Nov 18 02:02:05 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: 13878023 Received: from mx07-001d1705.pphosted.com (mx07-001d1705.pphosted.com [185.132.183.11]) (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 08F3726281 for ; Mon, 18 Nov 2024 02:02:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=185.132.183.11 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731895344; cv=fail; b=LoH8OE/WQ+Owrxm0yWUvgVQKeMeLTsEQgT0gJ1+BbKhMVHGaX4QDzYmjeepK1bIpgk7h9GLDelrNb6Qn9/8/rQzqZAMAF8K/tMJWwaKLAhTH4HA5kwrVaE4Q7UJMZqfU/0fHLWfx5RD9ldesdQh27lzkEp7YkrQLGyMBY4nM/JY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731895344; c=relaxed/simple; bh=EpJqZs5fJoojSLuWK+iwXV+v39pseaE48qG4KwBnZYM=; h=From:To:CC:Subject:Date:Message-ID:Content-Type:MIME-Version; b=Mcf3srEgxcps+5rm2gsXrFiSeGMB7rrL6x+pFgSlGtvPBhpVkTm4nvTwzCiTVhUw9NIqHrTy65n2i7Vk7PU/PxTkkuEviGQSyODZY24CqWkgIDvH0vJPjyq5E6YiXoQnYJIBEoW7kDW5SNI+iKoEV8nS1TuGtVg6TyvZ2Pe52CE= 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=eNOz65T/; arc=fail smtp.client-ip=185.132.183.11 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="eNOz65T/" Received: from pps.filterd (m0209328.ppops.net [127.0.0.1]) by mx08-001d1705.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4AHNwihw018091; Mon, 18 Nov 2024 02:02:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sony.com; h=cc :content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=S1; bh=EpJqZs5fJoojSLuWK+iwXV+v39pse aE48qG4KwBnZYM=; b=eNOz65T/Nd91VaglX+r1kUo9VwSRE/1XbYBMDKVB67Myu CeHV+abj/pyp9xUMsZa/YsXDLLaJfUr7JyH5IT1BoJEa0Opo4aWkI1YG2KbUbv5I 21zXvzoINsoVL24eo6lv+4JeTNEYUVT/tfJfIKkWgwhrKlOLcGwU9s2lwRHLF3wD AweCO1MVp7YnnWHYl5Hu9vxu3+uzzSsLkoRanaZuUQLpIoxPoPEOZq0o69RNf9IV J5BwG+CY9qDhb2aUZKxmDg0AqTJ1dI8DQfgoCRs5YexmsduL5KvQ6nhvRCiQANrq qvA1HiGL6sL8PqXgEVbWnNclHVLXGwUU4F5wh2iJg== Received: from apc01-tyz-obe.outbound.protection.outlook.com (mail-tyzapc01lp2043.outbound.protection.outlook.com [104.47.110.43]) by mx08-001d1705.pphosted.com (PPS) with ESMTPS id 42xmjgs3jg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 18 Nov 2024 02:02:11 +0000 (GMT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=RggLQky+30WCBM1EdsbYH6IHAfLempeoFBL0Vrx5p2Ybha5heZtXTucP44T0iaTwhOiCZ4SUmAknUC6FKdyXg0e8p0vZ+pHKsJrSZXfnZeejpIXod0i9pMrqfAm4qb2WauEyH1mcqp+NRewdhokhYskA6MLgtqX6veYMzvkt/YvTycMnCo357lVLYgsj/NAi7Nym5DZrmZrrzP1BYwJHGucQ3nDIxbm9/CmAofmyfH/pdR4wD3A/KHA8tFAtxBYwpwWldD3QrvTMjzPTSkX4xjo2lXcX8ObY0VD5AdeddOvliVszP6yz/wMJDYUim7uwxkcv0p5OkCPX99K1Itl63w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=EpJqZs5fJoojSLuWK+iwXV+v39pseaE48qG4KwBnZYM=; b=TqCX/t5VajlyCQqY++f9jkcqiWLxgecdiGmP4IGQyo3mlVzEKk8yuJLYeyj6DN3oP4Q5mS+/CghHcWiCh/GA9WCmHR/61CwCgu/Instmnpg+o62gWqmMb/tHoWiWoVaeFexZ5MFcm3z68tjrX53cg6iEx57aL78mc+OF1yVkgj7UMj3f50ubieeHxKtISRq8NkQxqAsMh9z52o6FYqXKKAmeWSy/CMkffTII/C3sWh2sv/kgdz1jn+EKLg4yEwLn1c9lRhad1tx0E90cz2XDTO/1yAJzesFda+EFXs09nFh4ZoP9CqEqTUGqipAnApXM4vek2PGVbUeogmrwBu0oJQ== 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 TYZPR04MB6119.apcprd04.prod.outlook.com (2603:1096:400:258::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.22; Mon, 18 Nov 2024 02:02:05 +0000 Received: from PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::409e:64d3:cee0:7b06]) by PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::409e:64d3:cee0:7b06%4]) with mapi id 15.20.8158.013; Mon, 18 Nov 2024 02:02:05 +0000 From: "Yuezhang.Mo@sony.com" To: "linkinjeon@kernel.org" , "sj1557.seo@samsung.com" CC: "linux-fsdevel@vger.kernel.org" , "Wataru.Aoyama@sony.com" Subject: [PATCH v3 4/7] exfat: move exfat_chain_set() out of __exfat_resolve_path() Thread-Topic: [PATCH v3 4/7] exfat: move exfat_chain_set() out of __exfat_resolve_path() Thread-Index: AdsFxBC7IXbbz4laRpe3GmeqAxN27wzmLUQA Date: Mon, 18 Nov 2024 02:02:05 +0000 Message-ID: Accept-Language: en-US, zh-CN Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PUZPR04MB6316:EE_|TYZPR04MB6119:EE_ x-ms-office365-filtering-correlation-id: 83a10b76-a682-43f9-a04f-08dd0775002b x-proofpoint-id: d8690225-876f-412f-87c6-a7cb45557a4c x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|1800799024|376014|366016|38070700018; x-microsoft-antispam-message-info: =?utf-8?q?3Eh/z9w8mUcEgiC/ZlR0O+phaAjW1nT?= =?utf-8?q?4/nJDTtDwb85jSod4i3y/UF4bfY2Hq90BPODnDZXObpdRWCGEafPzVOQWn8bw2s35?= =?utf-8?q?kLxa+WlG3Xmz3d63Alk3BWlKJN+5YjQLsTdQfjZrtTfO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BzGfBUNp3XDLgKQZF3+?= =?utf-8?q?3nIkISIIa9uIdl8VIa5Ns3F190OqqD65IxTQDBa1ZOy6gLC5IkzVSLZaoWISyk27a?= =?utf-8?q?mPzl1Dh1R92l/XiU9I12YpJKjKmgeE5+ZbWEOil3eEmkNT+GctK0ekdvpomF2Wyso?= =?utf-8?q?Y/vPbRrb8GhqnTpX6GJaOnNHqkxOee+t2vOD1Rh2wKx4aRsY3Otn3H9RmGEbvNwXa?= =?utf-8?q?NAw4tnXF001A5E4Gfq6H0WmOBSnFpACKP8GTclBggBt02lclbsbrg7PXNIDhXheeS?= =?utf-8?q?/3lRhTOJT5Zdqk2eaQZ3WpAQbdKOoW/NRc4Rv3AIuNeNCIBQsteQd9PE=3D?= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:zh-cn;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PUZPR04MB6316.apcprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(366016)(38070700018);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?gZqvD0fFZw7bUsBobphy9yIewwFf?= =?utf-8?q?nW+s/2fpCYeOOpbGi0g7yNWrlpmz9p1e/I80LJ86jAIggcf6cxASD1YjZClCUoJWD?= =?utf-8?q?OVLCuLuFchAyuc/xdV2mCHd8LW+oEzoomZNcaYdEPvXLam1e3yrB+e3lZpXcuTO0s?= =?utf-8?q?v5Lots0jr9NwMFFqUCsQNjDwwvnjM53KTedBUSx62/oTHsEbKHcroZYhRPFNAhXAy?= =?utf-8?q?Ylt3UkZbX1UzY+NLaSYuvmallklQHnzS2m3MLkNRvh1HXvjxm206NQEBws1jbNjJ8?= =?utf-8?q?O0S4XK4lbDKKECC4KNSiVxi/6w50A961JeMNTdkSyP6FnWiH1hzTekd1NZH/PNt9Q?= =?utf-8?q?6EMMWJMI3+pPqjShQ/86hbSc1IwTnW7sdnpme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9g5Iy7KK68TmbgUUoqVp/xWthquQ?= =?utf-8?q?KGPFQ1rWwIwEf9f5WgCYQS42k0PMP98Ia3eU2WS1aUZSRvSdKmkGr68tU+Iu5QFpD?= =?utf-8?q?JdRVQFkLnRGu4PygQSnM25kT9fxLQdbdvkQqcsmf7vg/ZF/S3/bZ8KyMA6TIJVcZB?= =?utf-8?q?HT/71Smx9dW5imBJk7lLBpXZm+PFLP/2xNGXpu6/M7vEURD6/BwKvX/ho+O++qEKX?= =?utf-8?q?UtbQwvmGpUFyxOvlP+t+L9kYWGoE/KxAmXVMH4lozkG7rhG7qBXZAXTUhmVnggiqt?= =?utf-8?q?SWwWxedFmpU4?= 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: b7dJ0ap7UZ/n6GbUD8vaoGgHVMasZHzZrg+3Lwq32srcUlCGzspkDsudNd2A3opu43+5n52rV7EWqTtkc3I4CoSoof4MNU0p243uWX/TtutWVRjCn9XyQiZs+D6oT0SAmY9A1AZ0rwwPY6sCKVGaqqCu4nz8W9fww3o6UiTw011EZgDgy4ear64wloHwVQ/69aoY4ZiPnShKoiznMFpKrK4isRaDya/wUjBQ8DPJQUrfBNnZ9XmUJ8Ox8hEzNPMT6vN0iclK54y2m87xPwbzsgMfr2DywNE6ZEQZnoibYVdoxqCcczSsBSOrRMnP+Ajw7PA08yfPOMDBadsWJWTQ7iLxaMlk0eAJRHQTNzYbOQGOWOiVA8al31/fHsYqjrq+MiVJXfCUFxItjmMc8tHU1PcydMWpj5v+nnNzwsXfm7LJpmZy+i4pbuDY4QwQicSNAHRnuPVzdS8sqAuIPXNyCfRenG5QcPi7VxCbkxLYvqXkshl7DlkU4ziq0I6lj6+k+x8M0Wa4VLBFDWsXiK1DQ6RT8vfgCEg/0Z3dpt9tW4gNcyYzen50QCNSDFLZnCQXMn7e+M61iv2p7p48JwdxC14ICy5fVCkC3dd0cCtBefvmNF+VBXMNOMawQn4KAMC7 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: 83a10b76-a682-43f9-a04f-08dd0775002b X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Nov 2024 02:02:05.1508 (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: JSbIB1phigPBrHOLqGaaNpU3yKZQa4aUOyK2bkQFTlfV9/7CMZMKgvmknHIqWoMB5kEKxa1lToMY0q8ghBi/hQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR04MB6119 X-Proofpoint-GUID: fqP0vYVvVOxg1RsG6cwtwYSRjIa-32hb X-Proofpoint-ORIG-GUID: fqP0vYVvVOxg1RsG6cwtwYSRjIa-32hb X-Sony-Outbound-GUID: fqP0vYVvVOxg1RsG6cwtwYSRjIa-32hb X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-11-17_24,2024-11-14_01,2024-09-30_01 __exfat_resolve_path() mixes two functions. The first one is to resolve and check if the path is valid. The second one is to output the cluster assigned to the directory. The second one is only needed when need to traverse the directory entries, and calling exfat_chain_set() so early causes p_dir to be passed as an argument multiple times, increasing the complexity of the code. This commit moves the call to exfat_chain_set() before traversing directory entries. Signed-off-by: Yuezhang Mo Reviewed-by: Aoyama Wataru Reviewed-by: Daniel Palmer --- fs/exfat/namei.c | 60 +++++++++++++++++++++--------------------------- 1 file changed, 26 insertions(+), 34 deletions(-) diff --git a/fs/exfat/namei.c b/fs/exfat/namei.c index f938299e749b..d6ab4fa008c4 100644 --- a/fs/exfat/namei.c +++ b/fs/exfat/namei.c @@ -311,6 +311,9 @@ static int exfat_find_empty_entry(struct inode *inode, ei->hint_femp.eidx = EXFAT_HINT_NONE; } + exfat_chain_set(p_dir, ei->start_clu, + EXFAT_B_TO_CLU(i_size_read(inode), sbi), ei->flags); + while ((dentry = exfat_search_empty_slot(sb, &hint_femp, p_dir, num_entries, es)) < 0) { if (dentry == -EIO) @@ -385,14 +388,11 @@ static int exfat_find_empty_entry(struct inode *inode, * Zero if it was successful; otherwise nonzero. */ static int __exfat_resolve_path(struct inode *inode, const unsigned char *path, - struct exfat_chain *p_dir, struct exfat_uni_name *p_uniname, - int lookup) + struct exfat_uni_name *p_uniname, int lookup) { int namelen; int lossy = NLS_NAME_NO_LOSSY; struct super_block *sb = inode->i_sb; - struct exfat_sb_info *sbi = EXFAT_SB(sb); - struct exfat_inode_info *ei = EXFAT_I(inode); int pathlen = strlen(path); /* @@ -431,24 +431,19 @@ static int __exfat_resolve_path(struct inode *inode, const unsigned char *path, if ((lossy && !lookup) || !namelen) return (lossy & NLS_NAME_OVERLEN) ? -ENAMETOOLONG : -EINVAL; - exfat_chain_set(p_dir, ei->start_clu, - EXFAT_B_TO_CLU(i_size_read(inode), sbi), ei->flags); - return 0; } static inline int exfat_resolve_path(struct inode *inode, - const unsigned char *path, struct exfat_chain *dir, - struct exfat_uni_name *uni) + const unsigned char *path, struct exfat_uni_name *uni) { - return __exfat_resolve_path(inode, path, dir, uni, 0); + return __exfat_resolve_path(inode, path, uni, 0); } static inline int exfat_resolve_path_for_lookup(struct inode *inode, - const unsigned char *path, struct exfat_chain *dir, - struct exfat_uni_name *uni) + const unsigned char *path, struct exfat_uni_name *uni) { - return __exfat_resolve_path(inode, path, dir, uni, 1); + return __exfat_resolve_path(inode, path, uni, 1); } static inline loff_t exfat_make_i_pos(struct exfat_dir_entry *info) @@ -470,7 +465,7 @@ static int exfat_add_entry(struct inode *inode, const char *path, int clu_size = 0; unsigned int start_clu = EXFAT_FREE_CLUSTER; - ret = exfat_resolve_path(inode, path, p_dir, &uniname); + ret = exfat_resolve_path(inode, path, &uniname); if (ret) goto out; @@ -601,10 +596,13 @@ static int exfat_find(struct inode *dir, struct qstr *qname, return -ENOENT; /* check the validity of directory name in the given pathname */ - ret = exfat_resolve_path_for_lookup(dir, qname->name, &cdir, &uni_name); + ret = exfat_resolve_path_for_lookup(dir, qname->name, &uni_name); if (ret) return ret; + exfat_chain_set(&cdir, ei->start_clu, + EXFAT_B_TO_CLU(i_size_read(dir), sbi), ei->flags); + /* check the validation of hint_stat and initialize it if required */ if (ei->version != (inode_peek_iversion_raw(dir) & 0xffffffff)) { ei->hint_stat.clu = cdir.dir; @@ -977,8 +975,7 @@ static int exfat_rmdir(struct inode *dir, struct dentry *dentry) } static int exfat_rename_file(struct inode *parent_inode, - struct exfat_chain *p_dir, struct exfat_uni_name *p_uniname, - struct exfat_inode_info *ei) + struct exfat_uni_name *p_uniname, struct exfat_inode_info *ei) { int ret, num_new_entries; struct exfat_dentry *epold, *epnew; @@ -1003,9 +1000,10 @@ static int exfat_rename_file(struct inode *parent_inode, if (old_es.num_entries < num_new_entries) { int newentry; + struct exfat_chain dir; - newentry = exfat_find_empty_entry(parent_inode, p_dir, num_new_entries, - &new_es); + newentry = exfat_find_empty_entry(parent_inode, &dir, + num_new_entries, &new_es); if (newentry < 0) { ret = newentry; /* -EIO or -ENOSPC */ goto put_old_es; @@ -1029,7 +1027,7 @@ static int exfat_rename_file(struct inode *parent_inode, goto put_old_es; exfat_remove_entries(parent_inode, &old_es, ES_IDX_FILE); - ei->dir = *p_dir; + ei->dir = dir; ei->entry = newentry; } else { if (exfat_get_entry_type(epold) == TYPE_FILE) { @@ -1048,12 +1046,12 @@ static int exfat_rename_file(struct inode *parent_inode, } static int exfat_move_file(struct inode *parent_inode, - struct exfat_chain *p_newdir, struct exfat_uni_name *p_uniname, - struct exfat_inode_info *ei) + struct exfat_uni_name *p_uniname, struct exfat_inode_info *ei) { int ret, newentry, num_new_entries; struct exfat_dentry *epmov, *epnew; struct exfat_entry_set_cache mov_es, new_es; + struct exfat_chain newdir; num_new_entries = exfat_calc_num_entries(p_uniname); if (num_new_entries < 0) @@ -1063,8 +1061,8 @@ static int exfat_move_file(struct inode *parent_inode, if (ret) return -EIO; - newentry = exfat_find_empty_entry(parent_inode, p_newdir, num_new_entries, - &new_es); + newentry = exfat_find_empty_entry(parent_inode, &newdir, + num_new_entries, &new_es); if (newentry < 0) { ret = newentry; /* -EIO or -ENOSPC */ goto put_mov_es; @@ -1085,9 +1083,7 @@ static int exfat_move_file(struct inode *parent_inode, exfat_init_ext_entry(&new_es, num_new_entries, p_uniname); exfat_remove_entries(parent_inode, &mov_es, ES_IDX_FILE); - exfat_chain_set(&ei->dir, p_newdir->dir, p_newdir->size, - p_newdir->flags); - + ei->dir = newdir; ei->entry = newentry; ret = exfat_put_dentry_set(&new_es, IS_DIRSYNC(parent_inode)); @@ -1108,7 +1104,6 @@ static int __exfat_rename(struct inode *old_parent_inode, struct dentry *new_dentry) { int ret; - struct exfat_chain newdir; struct exfat_uni_name uni_name; struct super_block *sb = old_parent_inode->i_sb; struct exfat_sb_info *sbi = EXFAT_SB(sb); @@ -1152,19 +1147,16 @@ static int __exfat_rename(struct inode *old_parent_inode, } /* check the validity of directory name in the given new pathname */ - ret = exfat_resolve_path(new_parent_inode, new_path, &newdir, - &uni_name); + ret = exfat_resolve_path(new_parent_inode, new_path, &uni_name); if (ret) goto out; exfat_set_volume_dirty(sb); if (new_parent_inode == old_parent_inode) - ret = exfat_rename_file(new_parent_inode, &newdir, - &uni_name, ei); + ret = exfat_rename_file(new_parent_inode, &uni_name, ei); else - ret = exfat_move_file(new_parent_inode, &newdir, - &uni_name, ei); + ret = exfat_move_file(new_parent_inode, &uni_name, ei); if (!ret && new_inode) { struct exfat_entry_set_cache es; From patchwork Mon Nov 18 02:02:10 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: 13878024 Received: from mx07-001d1705.pphosted.com (mx07-001d1705.pphosted.com [185.132.183.11]) (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 B33C41803A for ; Mon, 18 Nov 2024 02:02:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=185.132.183.11 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731895347; cv=fail; b=j53DHQpM2kZZx9ghhlB18RTqOExVTCabmUsaB1pNxii7SzF8FSll1ACIJN5cbGt8Zqwfhc61wmSzjihY+a7dqzueSZoz11Da9duxFHbFyoiFeSW4+K9kf+75jkQK8uW+V2D7z7cWlL4+fS05lIl/VE/uNaXaRWKr6d3XpZElKT0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731895347; c=relaxed/simple; bh=PLl8M25aSQDsAJlAl4lHTZn3I21AGUq3A9ToxY+xuO0=; h=From:To:CC:Subject:Date:Message-ID:Content-Type:MIME-Version; b=p2EutrZaVB9DA1KLBqd81xVRGe7L2rVxReMMWBui8HlGD+b8nrzuU58QOqTXmsU7BeawDU7/P5VNwGfGUB2BjMQIHHNMcsnStTau+byfW2rNFExkJFokl/hbHf0iHlj+pB8eunt8aVWsU30pE+F2TCahSnCqyKUGcAv4hC1rlA0= 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=W5NF0ly9; arc=fail smtp.client-ip=185.132.183.11 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="W5NF0ly9" Received: from pps.filterd (m0209326.ppops.net [127.0.0.1]) by mx08-001d1705.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4AI0eEUX023960; Mon, 18 Nov 2024 02:02:16 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sony.com; h=cc :content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=S1; bh=PLl8M25aSQDsAJlAl4lHTZn3I21AG Uq3A9ToxY+xuO0=; b=W5NF0ly9g1UmuuUC28En09LsPC2OX6otb+BjQgscQLxCZ 0VCbRIaniXMj5GnVaaT1XsWzpovzMQqpdwFvQXcYX9Z2rpwhD16Ah1dAmS3iuWqm jkFyk/gB+hjD4wvWH7TjhAO85wdv9ajJDN6uOiSPnWofQUaGZy5WKZbaBfH/H9qu BsvcJVl94ustywYaSXIp1EqIFsi5lauBmUzdPyzuH1NC5cnoA/ZInjgkluZMDbNK y3CFia1uyL0RQuE8gOSCuoXnpWOJeruZTi2yefCQVhCgmXw3FAW23RchsEepelQw YadvqJwX6fy+WbNIeelExBajecPVX/KEGbpRaHyzw== Received: from apc01-tyz-obe.outbound.protection.outlook.com (mail-tyzapc01lp2047.outbound.protection.outlook.com [104.47.110.47]) by mx08-001d1705.pphosted.com (PPS) with ESMTPS id 42xm8xh3t3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 18 Nov 2024 02:02:16 +0000 (GMT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=wfU9PPRy4GxJ7LN4rmlWGfyAlpMa2nIFN/uSLj5DH9829r9mrk7Helk9ynP5s0RkuqI/jjKMKZm+MGzP0vMDWixGKIqYVELaVo8G/BzVfJHsXumqNLdLBbRRK0cEw8rqnfyGsVnTgzMYVVdTzzFXX+X0RaiIE9YhVm2PHU1Fn+Qk9PdYQp/0YKrHW5qaSOZLTWhWpZrvvYdtmqhpMPIwld4Xu3qgt/EEp+zu5Qp+mOii7S+BbqFukGeKYyNJn2DMPAWT2NAZFILGlpRbArA2wAYMnZG5nQsxokCVObDeQ55iiPBYAlTZRUbymT3mvgszmeC+o/TGVdR0GKCEnCSp6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=PLl8M25aSQDsAJlAl4lHTZn3I21AGUq3A9ToxY+xuO0=; b=IBykZG9by2UvH8pUNDnQMGRrXbHuQuwEScyXhMDFz15Pr9u5cOXEq6IbpVwbdLQXAoZr5Lh7v9CQiATMi/y9T+6WiBibqZ5q8fKPrxYnhCSkJNHuxYdQU7zDGIzRqbW31equ96/hDienhvQEfyw7FEUlrFjZn5FkCM8C8PINpJjjZYqZRzKuzXhl0rWMHENXRMBR2sKqlncooUuGFgAuJO6PiH5QPxzyEG7PfsNFPXv4uK/5gZNlg8OvsADVQAD/0roK+AO18nJ3T25MYpTfQrOyjAHs0eikFCXRMltIiUwFo3RkPN9Okt3IeJTXOQNgj15Wbq1Mq2TDEQhBUwyh2Q== 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 TYZPR04MB6119.apcprd04.prod.outlook.com (2603:1096:400:258::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.22; Mon, 18 Nov 2024 02:02:10 +0000 Received: from PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::409e:64d3:cee0:7b06]) by PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::409e:64d3:cee0:7b06%4]) with mapi id 15.20.8158.013; Mon, 18 Nov 2024 02:02:10 +0000 From: "Yuezhang.Mo@sony.com" To: "linkinjeon@kernel.org" , "sj1557.seo@samsung.com" CC: "linux-fsdevel@vger.kernel.org" , "Wataru.Aoyama@sony.com" Subject: [PATCH v3 5/7] exfat: remove argument 'p_dir' from exfat_add_entry() Thread-Topic: [PATCH v3 5/7] exfat: remove argument 'p_dir' from exfat_add_entry() Thread-Index: AdsAKdCLRxbAMeyARRCBbIFV5KWhHg5MxSfg Date: Mon, 18 Nov 2024 02:02:10 +0000 Message-ID: Accept-Language: en-US, zh-CN Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PUZPR04MB6316:EE_|TYZPR04MB6119:EE_ x-ms-office365-filtering-correlation-id: b77cc207-69c8-4ccc-cdc5-08dd07750366 x-proofpoint-id: d8690225-876f-412f-87c6-a7cb45557a4c x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|1800799024|376014|366016|38070700018; x-microsoft-antispam-message-info: =?utf-8?q?69fr7eHpi8aKabBi1ZAOX14cRSM/IA2?= =?utf-8?q?zq7DadytnqdVoijKEfPLiFKBhLCIqW1JiLNprOJlBv08GWGXq7c9XPvrmWGnbXa5X?= =?utf-8?q?TQovNGcRX5tj5wDEu+VMCQ/JHBWXOE1tVjxUMHH5R5O0mlhDi107jKN3928o8fMOc?= =?utf-8?q?ZBDdalgfnvc3iwIM4+cmk74J1KVA3X5iwi708dpt6TowCaCKGoMr5nJXVYc+EeODZ?= =?utf-8?q?OLVzpwG49r/Os9/Az11iHZyAIjBQJ7wsFowruXrVQkiv2KHySvUbaRQTdBB8elISe?= =?utf-8?q?R/rJ7A27Z3XNSbTzZ0qmsNmDP1yHolG/KUJskkfuke1Y07F+YPtkEY5mvWFEa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DmPomW3WmAzoi7PvpWOKJLCfxQbXRaKVDCRYHtBx/E6LAJweDXMCGFNoKD7L6ohwD?= =?utf-8?q?xKh60gdk00OEwYD2n5n3NQOpk0UVf687Jjrl/JxqOQYkLyYH3s5Maz7w=3D?= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:zh-cn;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PUZPR04MB6316.apcprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(366016)(38070700018);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?vTVq0fn4+uwW6eDJXeNaxn3itgyr?= =?utf-8?q?JEE5hXpGLaCmiBI69syZ29rFR+MDcegOamzCor0qj4yBf44phA8I1bBp8kAcX7RG4?= =?utf-8?q?5xE5SkDWhYG4FVukuYJEUOKmj9tNkRYxDNumZBdxdeCg+uf+JfEzB6lNDZtEsp2Nb?= =?utf-8?q?Fcg7uimRPs65UOPRgeOwyMzZJNqPlHfK57BI6YiHv0gavX+WQ3ie9P/qhCOw1FtjZ?= =?utf-8?q?ZaJMuYIydCfSYBOfHk5oULooIBlH++5gTk1XR2ibVVMO7X/qUXK7IxLw5kRL8lu7B?= =?utf-8?q?1Cx5MHIz68sMNkjladCaImzQAue0cpGEWJFXeQJBy0rb+KMswtRGt6mebECTRsDN5?= =?utf-8?q?JvE2vyBBEKfht8z02ZHr94yBri1i8z5EddVH0YQvsAgHGXX3DjdMuzUtGt1LW0MXd?= =?utf-8?q?8NMNv7TIQDcWPOAMwXSkSAnIRk+IhmNBDyfrCtT3Pyyd5oIgWPdLgwfVIibDIOV9/?= =?utf-8?q?YiQemWfRkNUuysCIlvohOeQdhq2nQVrZWvGB+yJ6C6J0PUMuuw6Ox3Lpfc+Eyb/NB?= =?utf-8?q?rLSOToVIClWvsSfZRH3cmetoyuteUrGG8+JemtN/G8o975bi9wDj6PcvsXw0KuBJB?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C?= =?utf-8?q?ribmPq8PYkMyNb3JEVtQLZhVENnJXIJh6nH20U8qwZ8f9YCKDxx+C5mEROwADrnXR?= =?utf-8?q?9RTewvsbdxOm?= 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: 2AaRp2dp3AnlCHSJksaDFomTQ08kCev4ZNJROQUMsCKGoZP2cs/aMKC9ZMjPXsMFuuMugirAtqUpRbqQVdhZP2BZrZ0FvK3H4PR8cLNOO+z37QzjP5UVNnJGtsdaO0D+o/B5clPKvHwifXYKlobaYogTgRf+NNDQL1cHJnpX3mlDXS41MdM37lv3U+JmH/6/NDrm2MJKeTlGHYFTIXHzIedpLXlcfymZ0SwFB+M7k+T1x56C7OF+TIskzXTtnfN3kx63rSDlCP6MsCBEoocaOMtA87wdie2uxn/FMRihkMvrt5sVDhZb3tKBquBBAijurC/d9q5rS2ENoDcu6GW0KFHP86oSZU7YfYnbQHZumUKn8OewsHPUR8tejvN4UgVXpkIIhpqe2U6gFP3x+g9hIcIouFmyPvyz7/DHSPhTQX/2N/BUOEnTtaDQ9d12OX9kt6fjJI4SecIkWVoppgGH6KvYEEuW+79UpNcN1wnWwPhSc5f8XUqoX12k1uV1tcMcdwFvs3WkGZl9pdFY9Phxn7xOKQsbNSCesQgJ+CHiw/TrlibVC6tNgniSQQSzE5oIyW4t8NkhDlkHwz4pZcQo6/q/P6uuFAdLFVqBiq8EUZwYRJhAifBwqQTGjDqYn1Tp 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: b77cc207-69c8-4ccc-cdc5-08dd07750366 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Nov 2024 02:02:10.5751 (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: kLHffXA29zCKtXN6fdwe4jIdH7KJWBZnDL2nBxbNZBhKTMTsD8yjCUhGmM2L6nDxj7LVwN1jKis7wDWxLunwbw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR04MB6119 X-Proofpoint-GUID: Mp1RsHqlyR17NY25AC9NkdxEuANwdz_N X-Proofpoint-ORIG-GUID: Mp1RsHqlyR17NY25AC9NkdxEuANwdz_N X-Sony-Outbound-GUID: Mp1RsHqlyR17NY25AC9NkdxEuANwdz_N X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-11-17_24,2024-11-14_01,2024-09-30_01 The output of argument 'p_dir' of exfat_add_entry() is not used in either exfat_mkdir() or exfat_create(), remove the argument. Code refinement, no functional changes. Signed-off-by: Yuezhang Mo Reviewed-by: Aoyama Wataru Reviewed-by: Daniel Palmer --- fs/exfat/namei.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/fs/exfat/namei.c b/fs/exfat/namei.c index d6ab4fa008c4..83786938f06c 100644 --- a/fs/exfat/namei.c +++ b/fs/exfat/namei.c @@ -452,8 +452,7 @@ static inline loff_t exfat_make_i_pos(struct exfat_dir_entry *info) } static int exfat_add_entry(struct inode *inode, const char *path, - struct exfat_chain *p_dir, unsigned int type, - struct exfat_dir_entry *info) + unsigned int type, struct exfat_dir_entry *info) { int ret, dentry, num_entries; struct super_block *sb = inode->i_sb; @@ -476,7 +475,7 @@ static int exfat_add_entry(struct inode *inode, const char *path, } /* exfat_find_empty_entry must be called before alloc_cluster() */ - dentry = exfat_find_empty_entry(inode, p_dir, num_entries, &es); + dentry = exfat_find_empty_entry(inode, &info->dir, num_entries, &es); if (dentry < 0) { ret = dentry; /* -EIO or -ENOSPC */ goto out; @@ -503,7 +502,6 @@ static int exfat_add_entry(struct inode *inode, const char *path, if (ret) goto out; - info->dir = *p_dir; info->entry = dentry; info->flags = ALLOC_NO_FAT_CHAIN; info->type = type; @@ -536,7 +534,6 @@ static int exfat_create(struct mnt_idmap *idmap, struct inode *dir, { struct super_block *sb = dir->i_sb; struct inode *inode; - struct exfat_chain cdir; struct exfat_dir_entry info; loff_t i_pos; int err; @@ -547,8 +544,7 @@ static int exfat_create(struct mnt_idmap *idmap, struct inode *dir, mutex_lock(&EXFAT_SB(sb)->s_lock); exfat_set_volume_dirty(sb); - err = exfat_add_entry(dir, dentry->d_name.name, &cdir, TYPE_FILE, - &info); + err = exfat_add_entry(dir, dentry->d_name.name, TYPE_FILE, &info); if (err) goto unlock; @@ -819,7 +815,6 @@ static int exfat_mkdir(struct mnt_idmap *idmap, struct inode *dir, struct super_block *sb = dir->i_sb; struct inode *inode; struct exfat_dir_entry info; - struct exfat_chain cdir; loff_t i_pos; int err; loff_t size = i_size_read(dir); @@ -829,8 +824,7 @@ static int exfat_mkdir(struct mnt_idmap *idmap, struct inode *dir, mutex_lock(&EXFAT_SB(sb)->s_lock); exfat_set_volume_dirty(sb); - err = exfat_add_entry(dir, dentry->d_name.name, &cdir, TYPE_DIR, - &info); + err = exfat_add_entry(dir, dentry->d_name.name, TYPE_DIR, &info); if (err) goto unlock; From patchwork Mon Nov 18 02:02:15 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: 13878025 Received: from mx07-001d1705.pphosted.com (mx07-001d1705.pphosted.com [185.132.183.11]) (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 8571C2AC17 for ; Mon, 18 Nov 2024 02:02:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=185.132.183.11 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731895355; cv=fail; b=aTRbv1WvhvjUSQ8XaHL66jY5KYzQDaj86n5lwXlC9zs0bowK7ODDBtE+Ms8AvqhORXqZdRiLmDzzoWBcw+ME5gqHZukvu7kChs6ZcoXmJoSZGric92nMU1WvyCtj6Zi5srdxm6F0wFIrdMqpqbLU8NEcGpJmeeBAPYvMWebACXI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731895355; c=relaxed/simple; bh=vryzNcwLyfZVGYRl2uswP1MxTcdF2jankqCdCx3klrs=; h=From:To:CC:Subject:Date:Message-ID:Content-Type:MIME-Version; b=mJOdTHhGP8T36d9xZZUyuX+piTKXhJyZPf0D3F+htp3KdR4uj9evG+CNNHfiBS0zEZzwglrDD8U3M5SYg31zBmOFob5cDH1mp19cFv2Mi1U2Oid67Ag1lxXtHi+pWcwOWwtR9WRQFlnpMOgnUdygsdrUpdIJBAwIRv/PPQjday4= 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=M+nxLrVa; arc=fail smtp.client-ip=185.132.183.11 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="M+nxLrVa" Received: from pps.filterd (m0209329.ppops.net [127.0.0.1]) by mx08-001d1705.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4AHNOHjd007526; Mon, 18 Nov 2024 02:02:22 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sony.com; h=cc :content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=S1; bh=vryzNcwLyfZVGYRl2uswP1MxTcdF2 jankqCdCx3klrs=; b=M+nxLrVaLdTNDFgYIet0wvcW5D+0Xx+HIF7kH4/wLf/Sz RfoTjUUDZoANTEIRB7UWRiJRE0Q1vxWNMmOTSYm7nOrXHJ86IR9pQljTHX+yC+TZ 8ngwPFzQgRMv4v50tW7AjrkEbJdg0eSYZfEYLJys9sds16GLraPHhGiHKOVZPHrD 7eB5bpY6N5DphbhqvdGncucf00ss/q2eV0FKaQAe4cx85ib8gcC7ngW6TUkbaUmq Gae/yI/dOZdvdHnlOk0B0fNlLUIl4auGgq+4CPUT104UoADETWq0mk59LxuCZYb/ SO2co0hAsPx6aJvjcxgsTQr/IeS81pWALOwBf/Z/w== 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 42xm9613ut-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 18 Nov 2024 02:02:21 +0000 (GMT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=VHCoT1BfWSNC+ICfwcJghql30kL/OPgYbXcpmRLkp4wy8d5wUY7szJ+hdEyAneNOEfxA5smdLNlAh0BGPo78ecbIRlcBjd8u4ktUitfKyyyUqgo3Ke5OGHugUaGNgvwXBzCFAsvNSjihIJg7kR652UHmJKDKqFYmzGem1KDg7KMoXM6yxa9yrxaHXzQqGyy7vgwoCShzfVWACo/BCQA38TukfvyK3rJTwVZZSCFuYaBVwADao/5Tr3sZE+OPwqJctjq78ELGI+D6mj/N8XhxSiQHVvLOxGOXBc7IO4M7NQwm65URoHOUW9f9JKanPn6o3Gn/7Xa90YikaYSNm4YImQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=vryzNcwLyfZVGYRl2uswP1MxTcdF2jankqCdCx3klrs=; b=VuaMCc5yuYmmORPr9i8awN9zMlYgg/G9LhN4Iv3dStOwMX5tx8HkwpLe8w1yepR9AWCYLUhZ2fOs7o81QgPmu091ilbSBAhEoWrSwSFOX0/Rw75nMqHw0q/IQDTeLGUusU3/VZvOxKHDfYnw0qEnvYSSQzC55qfohiPdt4kMuexRazEcKZpBxsl7tJ8ZigAswYxq0lZP4tSAWUp40G86O22SMwO3LQjS9w4FbA2klPuJ7MvyoOwH/UR/PSI1KRVyjkOY50GEj284ZrMGRgm4Vv6GRtmTWP8F2Q142v1RtFXIKZirIZ4ChzfRdUOEIAQRR/xZAItVGOiztASsl5eOww== 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 TYZPR04MB6119.apcprd04.prod.outlook.com (2603:1096:400:258::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.22; Mon, 18 Nov 2024 02:02:16 +0000 Received: from PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::409e:64d3:cee0:7b06]) by PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::409e:64d3:cee0:7b06%4]) with mapi id 15.20.8158.013; Mon, 18 Nov 2024 02:02:15 +0000 From: "Yuezhang.Mo@sony.com" To: "linkinjeon@kernel.org" , "sj1557.seo@samsung.com" CC: "linux-fsdevel@vger.kernel.org" , "Wataru.Aoyama@sony.com" Subject: [PATCH v3 6/7] exfat: code cleanup for exfat_readdir() Thread-Topic: [PATCH v3 6/7] exfat: code cleanup for exfat_readdir() Thread-Index: AdsE8yC3W8n48hAWScyp5o4nMOvEXw0aeInQ Date: Mon, 18 Nov 2024 02:02:15 +0000 Message-ID: Accept-Language: en-US, zh-CN Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PUZPR04MB6316:EE_|TYZPR04MB6119:EE_ x-ms-office365-filtering-correlation-id: 3168202b-b137-4f37-61dc-08dd0775068a x-proofpoint-id: d8690225-876f-412f-87c6-a7cb45557a4c x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|1800799024|376014|366016|38070700018; x-microsoft-antispam-message-info: =?utf-8?q?IyYmr9LnKt6v2zeZnYnOzX6GjwGVyJD?= =?utf-8?q?ihK4eb/il7kQnyOJ2fi25YTsfwaY13F9BoXeo6TUWuLw9cMV+ra7TEEF65YwgTcYN?= =?utf-8?q?d0mXcsikjcKoPuFGVnxq7+30H1TCM8OcvMy2rgS9jNBtPpzWRJOEq6YDaXCEwyaVo?= =?utf-8?q?ARJmgmrZ020wLE1t9LIEitf6kXXXxF3zZ17hGJMzPvDvi1riimHlABbPOlriGvvCg?= =?utf-8?q?Rsa1/9vwC133SBHinG2L7MjTGC+F8QBtuMQDS9wrIDDgxMn9tgIn2LH9+MzWfbpYE?= =?utf-8?q?ewhnFQZyO9tJjl02LKSXpXNfHo/oOOM5Y8pBH2Vo2uWRlDm5xokKKwpi6J5HtbLfI?= =?utf-8?q?56EcrZC0QrCkfTaGnlPE93KbXzumqj3wYpDN9bFq0fJjegKze4nhcNMkW3PSfxyi+?= =?utf-8?q?thqvU2e8m61Ry5XNelCw82fA4oDM0q4L+rwvz8mt3cm5qSZJUa7LGnTglw3uF/Ovl?= =?utf-8?q?tFVtx+2K174gaJOn8SEZwpxqkQd5L6zqAyf0+mqFCduwRMEBXCvLPBvbVYHmwbI0B?= =?utf-8?q?EJeg39sM1b0XCB3nuvWZobmDutZNQh1STUy2JAp8Cg6gCMYAHSbn6gm9txkcyXhC6?= =?utf-8?q?DR3pBojub/eeiSqV+pFzr9U/ul9uCeIBC6E80ittqmvjamg5gGZ024nYusDJK4mMJ?= =?utf-8?q?9TrTpTh85ypKIJbCcd5hDlbPMqI8qFpnMMBLigw7hjEZfBK/XKxWyKM5fPnW7XhkQ?= =?utf-8?q?Raz0jouqagpxRA4BK/4vk3wWO/oqXdNVuqsWFvytCTUoDxRNyW7Ps6ca0oxGQzYm9?= =?utf-8?q?0uVfOB78lF1+iEKYlmrTa7hedpTT3af/JQ08aqGT0a8fFhYC8F7yQ5pzNMlHkbzOC?= =?utf-8?q?6AtiMAG51SPMcZLmSQY4zZkRUAWNtU8l5KMJsDMHRLsMabTUhPekYLdn/xlqzNHyA?= =?utf-8?q?bASm8brXuKwsU7IgrDM2Msae9v4h+RqLpVYUyGHl8Kjba5g9laDlfHPXeFiOHtAyw?= =?utf-8?q?+yMdLigza3HU9Uh3GqpxgsVhREzJSbBEJ5S8bb8o8nvKR8hikaIqyeMECB4xgiQgF?= =?utf-8?q?2V8kO//TrORWEvAl/yuhB/00z3pOjjQo0ALDt5K74BY5oeMUAXvMELzwdiLxRIv24?= =?utf-8?q?9/YhcvpF1qgEG97IC3uGBy9/IUPK9H2HRJRDD0P4Upd2FARS8oZ8WGj9JtA2rUnro?= =?utf-8?q?GsNSv0nRR2050PIHQkmnSDez00v5AB5HkAlw1Ze6Ss/B/EATH0EO3/gQH++03YCy0?= =?utf-8?q?caUahGvleMgrHyuDsh/86baEI80mU1qN+M5V9xx4VHTrNdXerXvBXxE/AZeuFbWfj?= =?utf-8?q?D8UDOHhOJ4ku8QbvADJKehKG3BpGFyCsBKBfetc6Vbab+Z6HPQ8NQYp4=3D?= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:zh-cn;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PUZPR04MB6316.apcprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(366016)(38070700018);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?1GbVp/H7Dl+FP95lp9BHbPo9mP6B?= =?utf-8?q?Hfp74hwUbHeK2gCcvGXXF2BvZGUBKHwGoDrmvQ91bOYYg7rYGu2f4McB3g50W1Z3T?= =?utf-8?q?S+or8pf+QP29y2WHKYQv1THcZNZioF0Q38wHwEl4GosrRP8LKzYKVcuu23GoW7EBB?= =?utf-8?q?GWzAoBX7KYD7cU9gdqIk4iCYfduiPKcZUfCiphm4P1AhAfLfxC9FjI9khuOoKJj5r?= =?utf-8?q?+HnzlGPTAJJZKDBvYWE2mudjoMKvEpqFLpGo70BP0jtaMOhliHikBKJIkvp4MKYnl?= =?utf-8?q?Yw6iN/dEeHLSnutA3pzRY9iQV04ofP8gHa1vzxwg42G8+t1rBF5up1S3rtPL60jbD?= =?utf-8?q?EgmmRXSWLGSgE4mj5L35sUcnIWU/OUAhwEMikMEPylUL85mO0UYml3TrP6okyFC/Y?= =?utf-8?q?ggY6h67VLt1iHg15jQwmRDizdTLLQkn/5sXQEix0EIep4I3DxarZI1XtFnmDDG3kF?= =?utf-8?q?60sGbKAMPmjUS4eUd8zabfD7E3W53atrQEr+nzfRSjIf3TC7bcGkS5D2FmH//GdO8?= =?utf-8?q?urm8/4Je13RFk1LsTUvW9omMSJSky9rUmf+dTzMtoxCXa3RqRdplKqXSuANFYyMtB?= =?utf-8?q?CNSvlBEL+d8Fp2Cbx6TIRdR0Pv7gy7F5z3Xnq9Dfu0ouOnOU05kwSitaUpVQASpXO?= =?utf-8?q?KgbvTESO5IMDMXfuCRxJtoEKzXNR16t3Ty4fp/1C6LcapPJ9Geu/DjY8T2wAOcFa5?= =?utf-8?q?ePqOboGXpgcbslIrffqp1fIbRm8LB+U8wVi6twH1Fy28oYGPZ1ZiRWVWzdq2/4mi0?= =?utf-8?q?SnYvTQ03ulw/XIIPAmkKCIR4MzYm/ipYfVlUf7a04k9RMlEphv0puenU/CXcB/o+K?= =?utf-8?q?SnyX5dz9vl3jFpqgIuebS6FNrsFRig0ucha9ZNfkkBij0IGJtJOZcbPD9Sd6R+Dx5?= =?utf-8?q?CGhaq2aeVv3yOVqVa7jQlbGT2GL6qlztGkWiytnAs+hep1zjmua6RuVsAFd8ft9ix?= =?utf-8?q?5C+rCWM2CTfNYhdr2ZaX7LLJfwNrTB54ythajQPnoWyu5BJ/A0cGfJUeeYwDBGQEP?= =?utf-8?q?FdwsDVLUdBj6GT7ypLL1weND1RvPsYro9gnJXzyh6XkRv6nVrXjqYfjfSzgCncCeh?= =?utf-8?q?tkvLzc5teJ9pahIhDDGIDLo5n1Wqv2Gx9Qlz2LxC3uftJZBLRFe32loH3FnGhtLqu?= =?utf-8?q?UEIF9KzSQ9x3tlWwhZ4+NGu4cNe4POTa0AcjyFPdsE/jGN+fypAbYKkI423tJY4+/?= =?utf-8?q?jh4RJMR/qicdHA+zFF0EGlTqQ9FTsRcHit/ZtA9ZjCKhKlrzQ3HumIbFy+MAfZL2r?= =?utf-8?q?xH4FVjkMug2DC0hjdy7Y17FRm140e/6fCsLynaEzUQQ31ufCCYFXQHLXuoqg/XZfc?= =?utf-8?q?5szUPBXtjvlyArXTde6ixrDZfWE7hF2N3ZGyyKef3LIRtgc7svHTO4JEV61J/XYD5?= =?utf-8?q?0cOs1T2oNn3cdOEtKbq5ir0uUxSvHLYA1UpXZPpeYUGL61LYZhshidhBBI1k230Wx?= =?utf-8?q?fn6TrJBSuY+AUj7IJpYQgAZfA24M4C8HlEYZKGhf0emzbstBViZZ2HRJeCweYsAwb?= =?utf-8?q?w8LQSkqjY+uv?= 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: rlW5V+xh3sOQ9HH5VZ01iSStFLJ+lNdfqdNKPrj8gdD7v8UqppNPBC7aYbiYJxKl9yLVWdM83VZvmSPMY1LAibHpYCEE8SQYJvgU38H50+kkxE47Xgn+J4gq91Z2d4I9MeYLnmpkAaC8+vuuCuPpogj7vKBBu87rmVpNzMnnVdECYAKdYkoO5KeHCkfkjs0T2Umlu7I4Q81qpHIEN7UbEuZb4mTHq/y3iyTHtFFxnrm/gKp5uNPdQjHdo3PevM/Wzk2MtrOgX0LuG+dWFhwCp5yh6Y+JZ6AMs/pByjXfwDIlfTKxZRjT2t/F4gbeJQtVBMJbRq3B+XqeEB/Yinbg7jJv0IBlM8HrJt1WA97lPG+6P2gV8kl9C1XcrcHQnxpj45hX/g1QRqWnlLZ5/Lvx0qKFIwoyun1W+WiENMdlMAuJOxbLUu5nzGxjFl43eoft7eAN+YuEWYPbsHf1Z9F9au+7rUGY0I5ZZXuzKsEqvHXBkNP6E1dyjnjSToBUe1VlVhHm/BGm+ogFikVBSP6cz2rdEAF4H/KV90ewVc0o6Xx2vVtShRsRD+RsSVVQ5mkJ4WxsssS5IpC2h8tLZlxrk8MFtecTLlOevAczVTpUQR/upMnwBNNewSiiRxCXEmvC 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: 3168202b-b137-4f37-61dc-08dd0775068a X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Nov 2024 02:02:15.8546 (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: VaXnK+N1TntRb10T5bzQI7RjHWhLJKWj+NTxkR12L6fKANn77lrLb06n6T7RJejMmpv5dX7/DgitCO5D1go6mw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR04MB6119 X-Proofpoint-ORIG-GUID: DnhsbdQ9ay1tw4QL6QQH05YQP4KbeCLd X-Proofpoint-GUID: DnhsbdQ9ay1tw4QL6QQH05YQP4KbeCLd X-Sony-Outbound-GUID: DnhsbdQ9ay1tw4QL6QQH05YQP4KbeCLd X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-11-17_24,2024-11-14_01,2024-09-30_01 For the root directory and other directories, the clusters allocated to them can be obtained from exfat_inode_info, and there is no need to distinguish them. And there is no need to initialize atime/ctime/mtime/size in exfat_readdir(), because exfat_iterate() does not use them. Signed-off-by: Yuezhang Mo Reviewed-by: Aoyama Wataru Reviewed-by: Daniel Palmer --- fs/exfat/dir.c | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/fs/exfat/dir.c b/fs/exfat/dir.c index 7446bf09a04a..24149e0ebb82 100644 --- a/fs/exfat/dir.c +++ b/fs/exfat/dir.c @@ -82,11 +82,8 @@ static int exfat_readdir(struct inode *inode, loff_t *cpos, struct exfat_dir_ent if (ei->type != TYPE_DIR) return -EPERM; - if (ei->entry == -1) - exfat_chain_set(&dir, sbi->root_dir, 0, ALLOC_FAT_CHAIN); - else - exfat_chain_set(&dir, ei->start_clu, - EXFAT_B_TO_CLU(i_size_read(inode), sbi), ei->flags); + exfat_chain_set(&dir, ei->start_clu, + EXFAT_B_TO_CLU(i_size_read(inode), sbi), ei->flags); dentries_per_clu = sbi->dentries_per_clu; max_dentries = (unsigned int)min_t(u64, MAX_EXFAT_DENTRIES, @@ -135,21 +132,6 @@ static int exfat_readdir(struct inode *inode, loff_t *cpos, struct exfat_dir_ent num_ext = ep->dentry.file.num_ext; dir_entry->attr = le16_to_cpu(ep->dentry.file.attr); - exfat_get_entry_time(sbi, &dir_entry->crtime, - ep->dentry.file.create_tz, - ep->dentry.file.create_time, - ep->dentry.file.create_date, - ep->dentry.file.create_time_cs); - exfat_get_entry_time(sbi, &dir_entry->mtime, - ep->dentry.file.modify_tz, - ep->dentry.file.modify_time, - ep->dentry.file.modify_date, - ep->dentry.file.modify_time_cs); - exfat_get_entry_time(sbi, &dir_entry->atime, - ep->dentry.file.access_tz, - ep->dentry.file.access_time, - ep->dentry.file.access_date, - 0); *uni_name.name = 0x0; err = exfat_get_uniname_from_ext_entry(sb, &clu, i, @@ -166,8 +148,6 @@ static int exfat_readdir(struct inode *inode, loff_t *cpos, struct exfat_dir_ent ep = exfat_get_dentry(sb, &clu, i + 1, &bh); if (!ep) return -EIO; - dir_entry->size = - le64_to_cpu(ep->dentry.stream.valid_size); dir_entry->entry = dentry; brelse(bh); From patchwork Mon Nov 18 02:02:19 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: 13878026 Received: from mx07-001d1705.pphosted.com (mx07-001d1705.pphosted.com [185.132.183.11]) (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 66C19286A9 for ; Mon, 18 Nov 2024 02:02:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=185.132.183.11 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731895361; cv=fail; b=ryYwEoPJo8AUBCgEDxKg3z2BYIWFdEMFN3iKDTy7ePYj1TinMQ7xF3lhjbC1aVXgCMOWQsQG5EWTr6X5apgiKoFsdaxmRt3Nup7ihI4in0DU2DI31H76Q+m0Hfu//V5xiWGHiqZdh+x8DUAwXhjiVGiqYAX+EnsZbROLTPCLFOM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731895361; c=relaxed/simple; bh=JAWdN+uzREyOMv6PuS9IagPUa30B53PRl9rwKzZIAk0=; h=From:To:CC:Subject:Date:Message-ID:Content-Type:MIME-Version; b=gXHMXez4QzGh0d67UXcltN23ocYSo4cPxsyQYdPntxviPdmnpT2Lm6NWh0K+TQCtoWJQwZtn1MjTVKzbjkuEuEJVvuLPwSn5gWBDdN1rxFlaifoMymEgQod8eq3DvItazrqKHBeeB6Cgws0FJFhm+zT1/6+t0nDyBBveYSt9xOU= 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=SFOVDr3f; arc=fail smtp.client-ip=185.132.183.11 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="SFOVDr3f" Received: from pps.filterd (m0209325.ppops.net [127.0.0.1]) by mx08-001d1705.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4AI0RsiN008585; Mon, 18 Nov 2024 02:02:30 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sony.com; h=cc :content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=S1; bh=JAWdN+uzREyOMv6PuS9IagPUa30B5 3PRl9rwKzZIAk0=; b=SFOVDr3fjhxnTxTuBKQ7kg63kEUMRoXkMD5d6HEaZfdH8 TvfCMBUUsunwtKlEkf612rI19ZbYL1ctAbWpDVqo2qM9EAJm3QWIqqg+8kRXrNlP 3868RL8HedcDDCiZpzopaLJDnlDvpbt8dBH/oejUQbB6nJ1l4qUTqway+oZyDQpV F3kO1+Z0bap9a+zQ1IAgjtTb3c0qTPszDjgoeLgb0fKUCyt14I1NCx7fYRYmgfqb W6rMPLwp5gvZYD+UDrT77crAqqJVFCMkESw1laTVN5bD5C4485go2PcB4/Clvujy rNQsFhmLcGpsAfzj8rCcJ4lC2xqgWpihD2wRJ35hQ== Received: from apc01-tyz-obe.outbound.protection.outlook.com (mail-tyzapc01lp2047.outbound.protection.outlook.com [104.47.110.47]) by mx08-001d1705.pphosted.com (PPS) with ESMTPS id 42xmbes3sm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 18 Nov 2024 02:02:29 +0000 (GMT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=A82+3vMfbIHeeSgXZlzjchiirHqSLHf4qCrOqWz5ngQvhMteA/iz39nDcZpe+yUMYCPvrGNd1k3O/9XB9VQXpaYNIbwmOezib8t7w97n1UMFV1oOQ6fGo3b2cWjcUhQsdpIL1cCo4YAMr04CvvMeqHuXAwFLsGGUMBc0bmIsI8VlAo7AaS2RQmij2dQCMv22HJH71LQNKKoDIJcUE44RmGwGAU/+wzBpCrS1ULnIN7Wyx+zOvulknaiYNrbfyE/W0UZUafHu31pYK6WuAxnBXnVs5YbCk3G6LK88AhssVN/B9c52gWFwtvT8uDo1F35z5htkhlXuwzYiWXy2Orxatg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=JAWdN+uzREyOMv6PuS9IagPUa30B53PRl9rwKzZIAk0=; b=cawC/HFy9XICZUpDuFDBJib7yBUt048VLFskWIjS8XD04eLApMXU8F6XQ8aiFimo5oRwEfPLIcEGjSz66z+XkVERrACTUyMZMo2o9yoc6Arzy/OVDTrWQMJRPROcp1avYQ3guBuqtdeN1Y6ZAnWAw97sj4ZOP/xFTZ7sF33G1YHlFhdkN3cLoohtHZ6rdgXA2kmv7uI1Qgo0N05tVphiE41jIemVLnSt1YaBD8QXtlmj7zpAHAfOMu3K7BJVDvXuoKJ/EH9rqaLP8ynJL/GzaRuLZfEvbx0u+xu1zMzdiiPx2fCTwRxmh2x6xfPuUon3H7VD+0riRwrLteYdVkgPyQ== 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 OS8PR04MB8100.apcprd04.prod.outlook.com (2603:1096:604:28c::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.22; Mon, 18 Nov 2024 02:02:20 +0000 Received: from PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::409e:64d3:cee0:7b06]) by PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::409e:64d3:cee0:7b06%4]) with mapi id 15.20.8158.013; Mon, 18 Nov 2024 02:02:19 +0000 From: "Yuezhang.Mo@sony.com" To: "linkinjeon@kernel.org" , "sj1557.seo@samsung.com" CC: "linux-fsdevel@vger.kernel.org" , "Wataru.Aoyama@sony.com" Subject: [PATCH v3 7/7] exfat: reduce FAT chain traversal Thread-Topic: [PATCH v3 7/7] exfat: reduce FAT chain traversal Thread-Index: AdsE8b4Rg6sTcpHXTLKC6v4wl4SyRA0a1tqQ Date: Mon, 18 Nov 2024 02:02:19 +0000 Message-ID: Accept-Language: en-US, zh-CN Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PUZPR04MB6316:EE_|OS8PR04MB8100:EE_ x-ms-office365-filtering-correlation-id: ee62788d-d1db-4717-e92c-08dd077508e0 x-proofpoint-id: d8690225-876f-412f-87c6-a7cb45557a4c x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|376014|1800799024|366016|38070700018; x-microsoft-antisp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d+82FFC337cSAwkjp+KL5K1pd33GRi9RvWmPi6Shl9SzyJkwKqHYUjmaeF71vzb?= =?utf-8?q?giQMmpHGhdJMFZmcuF1wwlb9TIyumNaRVcneibVPjUijxPFtyPAcgwgJFWQg0eius?= =?utf-8?q?KDmyVIlnBbRzee5G1b48l4ml17s1lm1xQeJgt0V14/d93TYxt/gyjz6gUaLcZdHka?= =?utf-8?q?UMYliwG9g2RhuWkN03/aQINMXqS2WEC0wYPkjYVUVYgmUMWY6h+YV2MF0qJkTAqd+?= =?utf-8?q?xYgK2TMqOf4ermxhefTgrVzKjd6f3h2U5vhnn5Y8cA7y55UhDYs6+RmLufO4U6KCs?= =?utf-8?q?5N+DzkgBTA4hJOOhQHUeG8BYPyprTgWi5W47P4RyTxLZ0QO3q/Zyy6YTC4ehhx/GW?= =?utf-8?q?ggm/AnwtbnZlZMhejfBNl2gNc4zqp3vMOkP05jQ8MVet957fHC4eU9RGp+T5LbGGD?= =?utf-8?q?XTN47IlCW7hVS2BUN8m2lmGvkAu7BOUuVeLvaJhZ3S60gIDxflmwlPqA=3D?= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:zh-cn;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PUZPR04MB6316.apcprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(1800799024)(366016)(38070700018);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?nWpBD2irQwo6naAtLKd7S0kkwi80?= =?utf-8?q?XWCSUb5VucgR8OsAPNb33PaIcCGkLU4VoE6NT41mRl4oE4IWP+0rUYBCm8r75eHu+?= =?utf-8?q?+lI3Pby8smvqzRpdx4zUah+iX8pu1n9zlBtAr1HCWqNUKI+jfPozYwy5EdacRO4td?= =?utf-8?q?5ZKNJ3GGo3c9nZtYt1A1CGjEajicKc7TD+sbBnv6vthAJDAec663iT2R5hqnv29GQ?= =?utf-8?q?VRn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tMAr7hHcTU9gCunteMze4bn75eiSUDPKk84EOj+VND3p6fThHNB3I?= =?utf-8?q?k2Q85ydUd/4NikSMuJGC8XmFppeF7XMs3fpiuG1varToET0t39bYmf7b7QVWEVaMa?= =?utf-8?q?LTHAkw7WduyMxd5BrAlo+VWyeT3DWtcqSgzVD3pj+EeXbS2T5ye5SleUh7wFmlPDJ?= =?utf-8?q?JEip5fIuKnHJuooUQDJXLBacPHthvb43loxP3CdEaUC/dguspgxyCQh3sCcWMGGvN?= =?utf-8?q?2QAq8WE8X/cFSmUdjTnQHPWuoVuhvHMsKRulhtxRD2Z50hhusgKdUUVGe9QE9w2jT?= =?utf-8?q?liY3dhFFg+ShvkDP1wLafnnCPvUNxs+gGc5Ux+kjgPRox0lVxyi81hurUcryDCaAO?= =?utf-8?q?0OKiy2pFrpVt755rGQ22whAGYCVB9SuL8Lr6FFWxVMZKFK1lHHoEMhTMLAN36SDLx?= =?utf-8?q?8bRMc2IGx6M7?= 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: hYlej/y7hgnoD0mQwYMNg5P19cm4QiOhm36/aBBgR2K7ZytxrVwmhQvKhtuYfoq8TXFSMZn+rgluWasxrmdPlpIYhfgCR1tku31juTtZbYcAq5eU72H6+oHy3RPVLC9/G06dwWrkxHimKfCHZjm3/ywDa6x24iolNBKyN0nwDkMDpE+czlHqYsQL/P0IpWjvYBakYSE5g7j9RXg1UoIRWVmoH23CI9Khq85sHmVShWo8sSyV8wXFUM7whE93jLwbCkxTP7I8hehAozlJ5LoP968Ka8zafT1DvoYJNqBDJ/AAAF2Z8K338NBK0/mREAaTySaYFNZwU901qb4gepH0Sli0AeYcxBjuJvuWIDFOFv4EQu7N/z2gQ9TF/v0NrmF8WzMCRiUICaAVklSAnum7T02fRKGqpML1zfyi+woknu2QG7HlsFGoMhxL/B+diAxxyTrcWM6HHSKPdkFbB+0A41IR2l7ALvof2RjyNsx4Dttn7HS/9kY8a7k3xzOI4FFyRGZksm7K4L8NVZt44ZVQZZGP3RESPy3NoFCDVTDNVFiRswfq2XI4+bo713cTkx9V++ZQZKXhzZ+78NetQ9WdtvLvJAhaiOe0O/fDUG/g2brzrKZkvciRQOTVmwWFm8J0 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: ee62788d-d1db-4717-e92c-08dd077508e0 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Nov 2024 02:02:19.7576 (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: ks3SFl5pRITKYirAkQoiYBGh9a+SquYybBRTIbZgn4mYGdMbubI1AecSDLotFGdfLTuYVVM5ZYbNelnROejXuQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS8PR04MB8100 X-Proofpoint-GUID: TaMVQaQd7pwa7CKOCv9GXwzwoZXwt3R6 X-Proofpoint-ORIG-GUID: TaMVQaQd7pwa7CKOCv9GXwzwoZXwt3R6 X-Sony-Outbound-GUID: TaMVQaQd7pwa7CKOCv9GXwzwoZXwt3R6 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-11-17_24,2024-11-14_01,2024-09-30_01 Before this commit, ->dir and ->entry of exfat_inode_info record the first cluster of the parent directory and the directory entry index starting from this cluster. The directory entry set will be gotten during write-back-inode/rmdir/ unlink/rename. If the clusters of the parent directory are not continuous, the FAT chain will be traversed from the first cluster of the parent directory to find the cluster where ->entry is located. After this commit, ->dir records the cluster where the first directory entry in the directory entry set is located, and ->entry records the directory entry index in the cluster, so that there is almost no need to access the FAT when getting the directory entry set. Signed-off-by: Yuezhang Mo Reviewed-by: Aoyama Wataru Reviewed-by: Daniel Palmer --- fs/exfat/dir.c | 5 +++-- fs/exfat/exfat_fs.h | 4 ++++ fs/exfat/namei.c | 32 +++++++++++++++++++++++++------- 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/fs/exfat/dir.c b/fs/exfat/dir.c index 24149e0ebb82..fe0a9b8a0cd0 100644 --- a/fs/exfat/dir.c +++ b/fs/exfat/dir.c @@ -148,7 +148,8 @@ static int exfat_readdir(struct inode *inode, loff_t *cpos, struct exfat_dir_ent ep = exfat_get_dentry(sb, &clu, i + 1, &bh); if (!ep) return -EIO; - dir_entry->entry = dentry; + dir_entry->entry = i; + dir_entry->dir = clu; brelse(bh); ei->hint_bmap.off = EXFAT_DEN_TO_CLU(dentry, sbi); @@ -256,7 +257,7 @@ static int exfat_iterate(struct file *file, struct dir_context *ctx) if (!nb->lfn[0]) goto end_of_dir; - i_pos = ((loff_t)ei->start_clu << 32) | (de.entry & 0xffffffff); + i_pos = ((loff_t)de.dir.dir << 32) | (de.entry & 0xffffffff); tmp = exfat_iget(sb, i_pos); if (tmp) { inum = tmp->i_ino; diff --git a/fs/exfat/exfat_fs.h b/fs/exfat/exfat_fs.h index 28cc18d29236..78be6964a8a0 100644 --- a/fs/exfat/exfat_fs.h +++ b/fs/exfat/exfat_fs.h @@ -204,7 +204,9 @@ struct exfat_entry_set_cache { #define IS_DYNAMIC_ES(es) ((es)->__bh != (es)->bh) struct exfat_dir_entry { + /* the cluster where file dentry is located */ struct exfat_chain dir; + /* the index of file dentry in ->dir */ int entry; unsigned int type; unsigned int start_clu; @@ -290,7 +292,9 @@ struct exfat_sb_info { * EXFAT file system inode in-memory data */ struct exfat_inode_info { + /* the cluster where file dentry is located */ struct exfat_chain dir; + /* the index of file dentry in ->dir */ int entry; unsigned int type; unsigned short attr; diff --git a/fs/exfat/namei.c b/fs/exfat/namei.c index 83786938f06c..8388582c2529 100644 --- a/fs/exfat/namei.c +++ b/fs/exfat/namei.c @@ -288,8 +288,22 @@ static int exfat_check_max_dentries(struct inode *inode) return 0; } -/* find empty directory entry. - * if there isn't any empty slot, expand cluster chain. +/* + * Find an empty directory entry set. + * + * If there isn't any empty slot, expand cluster chain. + * + * in: + * inode: inode of the parent directory + * num_entries: specifies how many dentries in the empty directory entry set + * + * out: + * p_dir: the cluster where the empty directory entry set is located + * es: The found empty directory entry set + * + * return: + * the directory entry index in p_dir is returned on succeeds + * -error code is returned on failure */ static int exfat_find_empty_entry(struct inode *inode, struct exfat_chain *p_dir, int num_entries, @@ -380,7 +394,10 @@ static int exfat_find_empty_entry(struct inode *inode, inode->i_blocks += sbi->cluster_size >> 9; } - return dentry; + p_dir->dir = exfat_sector_to_cluster(sbi, es->bh[0]->b_blocknr); + p_dir->size -= dentry / sbi->dentries_per_clu; + + return dentry & (sbi->dentries_per_clu - 1); } /* @@ -612,15 +629,16 @@ static int exfat_find(struct inode *dir, struct qstr *qname, if (dentry < 0) return dentry; /* -error value */ - info->dir = cdir; - info->entry = dentry; - info->num_subdirs = 0; - /* adjust cdir to the optimized value */ cdir.dir = hint_opt.clu; if (cdir.flags & ALLOC_NO_FAT_CHAIN) cdir.size -= dentry / sbi->dentries_per_clu; dentry = hint_opt.eidx; + + info->dir = cdir; + info->entry = dentry; + info->num_subdirs = 0; + if (exfat_get_dentry_set(&es, sb, &cdir, dentry, ES_2_ENTRIES)) return -EIO; ep = exfat_get_dentry_cached(&es, ES_IDX_FILE);