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;