From patchwork Wed Oct 30 06:12:01 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: 13855953 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 459FE3398E for ; Wed, 30 Oct 2024 06:12:27 +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=1730268750; cv=fail; b=rJqcgABpoxlhJLApTkz/INXjRC9fspqz1ovX96b5cQHaS+QidrKAsGshs/xNMtuKC1RsuAPatyLUov7eo++csGRCqF0/Ovno9mMbnLIDHddZU8W34v8owxTes2FvM4+E7sq5rn4XWQFYtGNyRaCW3vpRm3v+BQtSq39IMdc+/UY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730268750; c=relaxed/simple; bh=NivdX8AtRVA6JNFvv/TVGM9USOTDI0TcVF/YlAo3/Gs=; h=From:To:CC:Subject:Date:Message-ID:Content-Type:MIME-Version; b=foDsSNf5fA/IopofiV+LY/sm5mPCuS2waANgPKhGwMx/WhAdxASsz9Q4YmxItjx+p5W/NcWDT/8NhN42pKTBzNM3GjxNtTBewFlL0eie+Q/wk4JO6G0EvjlSnsF2fgX29GDXpeR9wn2nDs/8VHTrPKIGdzsKEuRSDf6nbF59v9k= 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=n2JH26qo; 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="n2JH26qo" Received: from pps.filterd (m0209327.ppops.net [127.0.0.1]) by mx08-001d1705.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49U5wJjM018773; Wed, 30 Oct 2024 06:12:05 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=n2JH26qoYR+XRA5U/iMHnGoNCJ6L3pkT1bigE7ZXyDdoW r+OFDZLg8GXh2O4rXxyZpEPE32hR9o+SDZrN5fpAJ13Xxj7HrzyaBDwaGC80CmN9 32Qlfr3po7/yeVt7kM/Ji4n9hHnG875kD+URJZcaROrm5DZg/foWLht1Zl5kYDiR 3ov+TTXRSVT+1DNrDpAbacz017l3HJZkqEWuiOGpmOALnZgf40ZEEpmJuAkAigsV zlFLbmUdoubqMVoo13S7JmiPIubmWgMwuT8ai9wTV5nIbs1XsK8BxILUwu7yaBD+ gwYn0SyKWE+DlZJJp5584ypUerDMRcMW9qIqGkJxw== Received: from apc01-psa-obe.outbound.protection.outlook.com (mail-psaapc01lp2041.outbound.protection.outlook.com [104.47.26.41]) by mx08-001d1705.pphosted.com (PPS) with ESMTPS id 42k2ypgkdm-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 30 Oct 2024 06:12:05 +0000 (GMT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=x75iFzze4m3g9tXrVj0ukOTi4K5m0iTTOCXMnoRDIBpjsp8fF34+pBtmovMbsh3Mst+pwhGF3fCCir/w0aevi6BKsYS/gM7d0G7rGuT7FQKVjU5B6H20lrDh5sNJgPiX1uRLr0rpEOsAB06iWb87Da4IoKrM92PiZ6DyL+tYNHGJW+rChxxBmmPOXCf7yeqWLS9WbJNxJa+KelhauXVk6q7Cg8pF8s0V2OfTfWX3ig98EKlQ4jWWD4WSC+wkgovluN/QEccX7AuK9QWBN6CxKuAkKSY2eYKCsvlQN0MM53eQIKIRIjZjlJ5HrQzyhXbRwcVg91Z10ih1omWEQC988g== 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=q4d8L/Oy+YIg9GHby2Gj07bBbcWorD9ZdWIniVJRY7GYorCIR2+U09wD9BCONVSew8ydCls2Qc1ddhti7rxAP9b1ebTlipTfk4xc65YIYSCADQyeafNgcupCaqxDh+QvbPlP1H7ZmtDVntQ7/a+/dMLinKvnum2KbHScp3xG10If4BpzuBpszfo5CTTfGgjaJi2ihatT9R4zFMgijv8ygkxn/mkFTZojRHE7b3FUl0E7/Bmu5lT3UCos901to3HuasvVw4ONcC7QnUCkd8Ho9WaLqDjmXztkPt1La68q/NX24gRjyPT7kYmTabzSNk6CDlCsbL7NilfCqBh6KMOYfA== 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 TY0PR04MB6268.apcprd04.prod.outlook.com (2603:1096:400:266::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.27; Wed, 30 Oct 2024 06:12:01 +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.8093.024; Wed, 30 Oct 2024 06:12:01 +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 v1 1/6] exfat: remove unnecessary read entry in __exfat_rename() Thread-Topic: [PATCH v1 1/6] exfat: remove unnecessary read entry in __exfat_rename() Thread-Index: AdrpZcjC8JDh6QmXSF2Xe94pYPCVBxBK3sag Date: Wed, 30 Oct 2024 06:12:01 +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_|TY0PR04MB6268:EE_ x-ms-office365-filtering-correlation-id: f32bef25-8e53-4043-37f7-08dcf8a9c4f4 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?mZt7FCyizpoilJM+ZqhAOsT3kWJD852?= =?utf-8?q?wRhUb3sdu2wCE9uaw2J4acfZ031cNoi8WgB7BAEMsj8w6rGQBBWgCO+pSAGRv+FtF?= =?utf-8?q?ILx/xiqgJf6fmydwEKfMji+okI1mvyFoWjPyC0FVm2Z/AtwLwV1gIyC+AkWitwt6W?= =?utf-8?q?X3WlpncOX/GofL5t1HojVSm8mSpedjXqlWEkWrqLCDAr6/c4k/zcZC/zXm1LJ09Z2?= =?utf-8?q?Q8/zFZNgjbVl7nHYMMsaF7xJ8JkVxCOJIgzzzqypOKdbsAnmInORDIg+g9ZNqjjld?= =?utf-8?q?fzvFS3YzoZKNx6DPrkTgMsgSY6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RRyY1C7ReFsQBznN/I01/IYMEG10vQj8auu?= =?utf-8?q?GInDEjAU8XUftvtr782GjjWY4M+BfZsx1AUFN5IGZi4iyuHv8HOQ7N5fsEALCZ6VE?= =?utf-8?q?HROQ5N+CcIWxRoRJrGjNJYIm89HbOWJQcd0t0y4wC7WoywsYGDXB5iIw=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?T6xGRs0iYPzhYtPqDCTsZZ2ULqGR?= =?utf-8?q?GQ/sJ+GOGR7xCT4uJ4+9KNVCC5xrz+TGUOX/g/ZYmQ1IvF00tLkgJKf5gluNpPwV3?= =?utf-8?q?cfEN6kHcPyw469r5Ls98eFS0t44uhLzuiYhd9swQgv/0rP9J/TV3GPDqOc6fVera0?= =?utf-8?q?H9VVUllpmpRxQ4pIUP/6X3CPbPFDnEdnodQtqUX8ef/IQySdU3lM+d+64d5mLZ8GY?= =?utf-8?q?Y5ZSlesszIP9wf8yfkr70kmwVEo44G0tjvcVf7hyNpVZXExC0TiW3xieEppqBpZ9Y?= =?utf-8?q?D6ca27tjBBrku8wckWPTneH9sYvAHeMnJQ1FwmzAkqtP1MDFq6qX12AX2ViqWVie7?= =?utf-8?q?5L87u2oiVPCW+QloLoSm/RKJJaQWjVFlZdjJ0pO591lXmwVcpNPm1QdTgGUY1SFaN?= =?utf-8?q?2gp8aL5Z81/gZJ6TueVa6v4SUnbiK5gYzfsdy2GePOyeYPUdhBhOZNRrCsSdiRlRe?= =?utf-8?q?iJ1CxVJk8DuxGw0yCbdnpFHWHp5C3/9atCWuMfYqZoef4oPG1c9bcUS2DlMkoY5I4?= =?utf-8?q?XEZfUEr7FMp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ftAQevpOZdKHQJYbWjwx7TTQeTtmUtbed724oJobnhXX9DK?= =?utf-8?q?E41pGj/QGvxU9xclgOcFqlhpCU/9aBVVp8IE82rzThJyCtpiKKOySiMqV1O26AfFJ?= =?utf-8?q?tI8zoEfBlTSH?= 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: aICL6Kxvlp91uvq1vwAX31tt8l06o1HXx4FgKFnixEIBJLOnmpJ3TJQWcdizXIL6G+G8S/zf2dkvhShxqDTPZH1n3z1uW5lxpV3/Wo6Z0hbmdeJD25cfc4rTCTKtmhFZvw2y5n/Pa+i7OWpe+t5P4jARLEnlkeNaoS0eZVdFM73HyrQW+QqMQRV8JBVjAUNIiUyLnInOnqs7SHg/YCkG6UuomReQhVGThwpPAa4IBV7ABNn6CAlGPHhstwW3lvnWTAOg0mZC+pKY1lX2ZGi+JxIQliqWCnvzT0dsFPIN/5klhaF7YGCOH1PFfxYcnJkjH+UjiTtnMPftYmlzGseMIYc2tlyebbn61OXg6YmZWj9wAU8LeRQiIE79Go9JXEAZc/RS2FiV1UQ309yEIorHTKWnxa2diVGTv9isw5UiRI8wH4jMfYpOVFHMACkXNk83JVx1MdELWT9lB3peitVuECl0PqJe2MJWaB4zQwVMOAwi6USn6cHqEGihYENujx4hgu7RCnb/Kd29vst3P0lhxKouTwj2PNv+/+UbJ2Hryn5V1ASfxyKljjou2ojgNZnZy7zyMCx/BWWFFp1D9CmtUPOIAzFyg2ILNNlIBs41ZhkZvHPksSrQt2m85eHJY4CR 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: f32bef25-8e53-4043-37f7-08dcf8a9c4f4 X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Oct 2024 06:12:01.6750 (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: DkFFY0E97x8EmzM2LxWCwErrAIHVHjyFNgiMa81R+MLR+q7HHD6V1IBnxSozvL57WtGz1Xv5d0Kqfqd9LUrRwA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY0PR04MB6268 X-Proofpoint-GUID: EUZWk9COespQCFExs9wN_X0PSP38me3a X-Proofpoint-ORIG-GUID: EUZWk9COespQCFExs9wN_X0PSP38me3a X-Sony-Outbound-GUID: EUZWk9COespQCFExs9wN_X0PSP38me3a X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-30_03,2024-10-29_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;