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; From patchwork Wed Oct 30 06:12:06 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: 13855954 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 6B4BB1D0E30 for ; Wed, 30 Oct 2024 06:12:29 +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=1730268752; cv=fail; b=gH3zzgd0ygErLnA/7GpUo80Y7DqgncxNY8lrGeqyCD/zZikk/awTrA/w8UDataJjZAYrngjMo2R/CXph/JiYlV6tWQKD0jFztmW1OMBbd5Bqvv3X9H7Szm5OT5KDNCRY4mXGijs3ThCtUKDmC6b5l4mvGfyC6BdvMZFupNHmJyM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730268752; c=relaxed/simple; bh=xB0839turwqbi2GD3wMmJGxWEKoY3MkyQ7UITacQsvw=; h=From:To:CC:Subject:Date:Message-ID:Content-Type:MIME-Version; b=V/FgIJ/+zo7RMUPuy2FDOgeKrcCyoIxdMmNMFCCGYI086esKsnNjcBKoKOdjMurtDVi+u+O/N2ryEsYUeYdEXAArVx1xpbF3lmF5LCczMD+7ygtSOdDVLNVoudGSryAS8dmPI9MSSExGp1b1323lsCm3salbjAFDS07UnsmW3I0= 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=hFX2hPG/; 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="hFX2hPG/" 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 49U66Dk6017975; Wed, 30 Oct 2024 06:12:13 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=xB0839turwqbi2GD3wMmJGxWEKoY3 MkyQ7UITacQsvw=; b=hFX2hPG/5RK6VFLSKHhesTokz4jGZbC/NvLXfFe+qyyLI 6W3OKOdEMhH3bZnigCjEGjj9ZorrQdCWe6Dgo6VzVq53PBp+aHlZrZa3i+8b1UoO KkZQiukNfrEA+Pa1UGAaovKEQDXWDMXqkUgcyG3+qeVQxCdgbW2LnjOVhHohbEB+ +quS+2AYUKY7Nv8JGwZM5wiicWsRBgMPhwMaBPgOBm+iFuDdKqTMhuWTLNXUdbeP IE4tGHb3BaHdp5DiiiInVElfAzL03M/9HaENVUwd6vDr6BIt4aEqpR6yYKd3Qy1B nf54YrZ1obfe2O4UR3q1L5M+pXH0GaGbnu/GNcpxA== Received: from apc01-sg2-obe.outbound.protection.outlook.com (mail-sg2apc01lp2110.outbound.protection.outlook.com [104.47.26.110]) by mx08-001d1705.pphosted.com (PPS) with ESMTPS id 42k2ysrk96-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 30 Oct 2024 06:12:13 +0000 (GMT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=CAV/2LFM2edUcxS9jacqq/GLv/JE0zWvD1k3YoMhcRT4ptEYa+Nhfk0KMKcMsQu6iSOmGkpAqd+xfRgWz4DQgWqbHf0T9XiFomjQ2RRlx3/Of7eDZhZeaRUaJ2eqfACIJ5Mb0kOjFKYItuQLyW/bz6PeVFzDItUpRWV93LT2Cvd3jyDoAgEpRi7pgmI+Uh4DlXkWD/f0GGffhMivzNc3T9hBoJJWjRTmqwVJvT0acngfoA90Q5FJ17T4NwetDONgI3j5BFlTZEuwNYMtCtj3gHqDxvnHfj8GMD+uepxNhq2wQxY3frf6ypmiPHTB41fLlycs0cmtenqMCWjs/fshcA== 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=xB0839turwqbi2GD3wMmJGxWEKoY3MkyQ7UITacQsvw=; b=mEGeJWnNYtguZjPktIN5+yqF4qb9h6eLW9gBNZg1UC1Sy3+1yxjFl4w1LNnvJcP5P1Tz7XBgFVdgTvOFfBhlHYOnDYX0CrIJ8pocTWyXoljc5ZBSz28ophJ0f0VDTsBqlsz95zIginUnPfua+xt1N/6J8EQWCN3G+nctJOMfrfhQk+ZjY1/SwQKSom54eTigrz8ZFK83GorDjmBTcWswNQNrUevk/t33fy2nPnK8lxV8Jyqpr1klwi8fIpDMfrp+OLU9MRilEhTph0pzuueepgVzm0J/UivgNrWTmlpY+wgNyk8IseitDmz4ptKwYuIFTNgxjNwCxVFvCBsaWZcXkw== 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:06 +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:06 +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 2/6] exfat: add exfat_get_dentry_set_by_inode() helper Thread-Topic: [PATCH v1 2/6] exfat: add exfat_get_dentry_set_by_inode() helper Thread-Index: AdsFm7o6eNsq4XfySF6Y9o6kIKDa5gk9Zzag Date: Wed, 30 Oct 2024 06:12:06 +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: 90903757-a21b-4d75-d5fb-08dcf8a9c7cd 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?TgFv/Yzc87iEQOo/Mhfo1s0sh4kGlaU?= =?utf-8?q?7MDkJ6oBG+LuiI21c5f5GwIKmmvobnkcurUhpda/a12Zc+bSUW/fY4BaMbu7P2fwp?= =?utf-8?q?0NLr7QU4yN/duOg9majO/O6WBcpSxNDu5kfUq8tZ/pUAoycyQGG7oiV1JAHY8ey1C?= =?utf-8?q?t0SCYr8Cn7fC6N2tNSKPpqpeTFQpvweOP4TkCqX5xx7RonFvsXc86Jro77QuVbRbl?= =?utf-8?q?U6UapJluRCisgf0RcoBHnx4VlaDkEcAn78XgxNrfApv0mk2wpalcrkcneIkepeHaQ?= =?utf-8?q?kAipfj0mU/DTW+8q/MvEzOzqJShbhhgMPysCAD0E9cs/ytizRREcFnLhow5RI3aXB?= =?utf-8?q?R6VOd1oE5XMCfp3CjZRyFOEyMAWEWDiCz8GdUb6+suzE+wQPn2YAiQy45/Rmohyrn?= =?utf-8?q?p/Lmu0OToPYkasPTF7wr9+n1jqm2AkpDGcJsSvTQLPF0qpBxRr2p2pImHMrLKpoGu?= =?utf-8?q?sNJtGcR267W/nODenAdHxSpA1V65CicAwar4cIKGK9JGHWohI16CSynOIX00104iD?= =?utf-8?q?v6Wu/K0C5m+41E8gR8vr7h9jRKzLKyJ/QZNiNMGHrihZD+vh3i9LHoX3dibqqTrZk?= =?utf-8?q?khMT7pImSZcQQJ/DYw6JQxsOfRjkOWrAPUWh1PHOdDwzrUkXnuI4qswduqa5A+HHJ?= =?utf-8?q?peZk9kX/ceSk5IVZVg9Rg1jY5AgA/lbkiPW1UeOI/xfr1UmjMWfXSUEPYX6X/wVT9?= =?utf-8?q?yjoOmtqMy0W9HUwk2YQRSgk/MgWQFH4fV/7dpXK95koEcubUBiqyB0Xp7r3kzowxs?= =?utf-8?q?LtOsPaFK2I7E1aca/x3mj1nxW5vtXPWFinYCTeNlPgLABM43NVKgvWoIhwwJkpIb4?= =?utf-8?q?GZ/JLMpDJFsQeSzprAOMji3/3oEK7TVzsdnkWHDKERCKVoYaGgzFaeJoLcPmipebG?= =?utf-8?q?v8DulMAxaAIj34oGpfmrUOgwem3fpz71KF/Ldq6nHujRpup4lwHoWk49hRpXiA2rM?= =?utf-8?q?nt/asFSXQUvwyGBLstJv86PsmsJ+GTmcQKTPgpDmFFJPhtB6US5Tt/9RzCInCQDGJ?= =?utf-8?q?yuDFfaICvhhxV9kzh8VLbGS3s8FzrpSCRdU3nO2j7lXbsQga9DDQEsk9qz6/QEKzU?= =?utf-8?q?0Lzx+/buSzMoVBh/dPNgdA8eBwkhwZlyM9Tb2EBAqdx5M+v6cIJmoIjeDlW3DW712?= =?utf-8?q?y16kmYQhCb155qUUKdbNLZVeCNZl4nhgzLvbyKW5WA066v2YEjco7TVsOn0s5JgTq?= =?utf-8?q?lSNjugT+nho21oxrNJAnZpnBJjGGaN85Sl2zZjjBGG+PoPS6vjY+hgioI35HG6+z3?= =?utf-8?q?TQu7saT9MlvwtgyTl/ikRQ7+C+EMFM77wFnZ5Z9FJi/vcsDgEsv69XpM=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?6wTs5Q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cNVUE/FZH3pu/?= =?utf-8?q?p/5F39gnI4JgWInjeWPqagz0ZhGKPuJSMGP1ggVRXFz+JGwViLQ/jQj9fp6U1Rq90?= =?utf-8?q?pJo3k2Hptc7fm8jMm0iR8K+P9PplSb8ejIPKvliLrRMjTu68HY1G82vrZKynJrJIY?= =?utf-8?q?rLTNJns6X9IYuN2QXdbhUH49Y7WXIn+/EouGAQb/v3/Sc0yOud20yme/Ff+0QfSNf?= =?utf-8?q?b2wE2LsOOvAOyC/N9KCvoZSO5uZg0rhpgdW93+nmaN6fcGGjZOfGgohrGKVwVKWMn?= =?utf-8?q?XRrNCM+fbzMXP5Bs20z8woTpyefbf5Lm0quHd7yxxRG+xdwBhZSw3NfIZe1GtI49U?= =?utf-8?q?e/uew+OKn9QtceGoZWzuNnu9dhDa0aiz6WYaOSc5NWjZTxmQ9YgmtPP/7H6KndrOG?= =?utf-8?q?BO8IZtIxY0o3wn+MxxjC0txbeWIu/GRTqTbxlzKPv26lfdIZ46VvRqgFn6tIAUICv?= =?utf-8?q?dH719hxyIYIglrWwYsvGoyzKiKnepzAo8c8eU28Sq4t6SMPOz4jU3XXKb8bdmSpoX?= =?utf-8?q?kqcJ0KeJRyZd9tiMp7OS6xUxiQfRGNiCeCxkuZvqYglrz1kMpSb+AGp1oM4RfSpYf?= =?utf-8?q?9WO77eERkeElZ9hv/Ppp7J2n6D00aWjixWgahSSLC6rUGBaahzhi3BhwgyjCpHXl+?= =?utf-8?q?8Yk0dP8xocES?= 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: N0Cgi7g79SYhjUaYlnh2XjzMXYl4+iZoROgycyvYTR4JazQ1LHEkaWsw1K853L2lE648X7kKBO9t60/MVfKj4kuq/TPZWpTRXYANkRRk92dioEBOYvqchKXORanKFs1z9vcokq4mf4bNqpmesiQ3wHglwFwxdZpwA2d2ebEdXQwp4X5qHghIuQYqyUAcWhoV6vnB2Lk4wMChRkyJG/IRC1UOSFLvpNLuzn/o9pYQvzLRvAGjW8obKTGY0/vTAaZlif3a4f5KG4Rd6iixR6nUXN1tz3GRP8M15yeZdP3A6htenYW7U8D2B3Hn+2r+iOhf1PHiasSqLeD6HSSnNa88gi1aEG9HQPFY/03+WPs9PxOzuG5XpHSs94hbB1q2deZTXg+kCWg5vl1B03IzF7xUbdd1RUyH3QfHuo9sq15+Lfh7fgUmGfs8Gqgd2lwU7wAZe/eHMWLbKv1ahiI1oN4VILNsbGmi2DYsbQjpalO7V/Ah9Yp8JQqbSafVGYxYsv/FwsZAN3P84OAyPzglLqoDTuoEgj3Wcof42jRNIB6P07QOsn0fG/07eKq/Iwtx/EJzVO5QtLOJ8EH1awXEJgstMdYT5Ck+33IsbBuP/z9AgkPsX60gK4q3CClDOP2dWe5G 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: 90903757-a21b-4d75-d5fb-08dcf8a9c7cd X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Oct 2024 06:12:06.4829 (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: hIOWGbiDjow0JwkYXtBlIdSKv67xPiORKXCgm3Q4lBkRUv3biUS7hdEIy+wXnciXnR5dEVqjRprbVcZonjMqBA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY0PR04MB6268 X-Proofpoint-ORIG-GUID: g-Zl_UJ3T8GqW-GdZt2t-dTXzyWHu6Kv X-Proofpoint-GUID: g-Zl_UJ3T8GqW-GdZt2t-dTXzyWHu6Kv X-Sony-Outbound-GUID: g-Zl_UJ3T8GqW-GdZt2t-dTXzyWHu6Kv 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 This helper gets the directory entry set of the file for the 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/dir.c | 9 +++++++++ fs/exfat/exfat_fs.h | 2 ++ fs/exfat/inode.c | 2 +- fs/exfat/namei.c | 48 +++++++++++++-------------------------------- 4 files changed, 26 insertions(+), 35 deletions(-) diff --git a/fs/exfat/dir.c b/fs/exfat/dir.c index 7446bf09a04a..61221c59547d 100644 --- a/fs/exfat/dir.c +++ b/fs/exfat/dir.c @@ -873,6 +873,15 @@ int exfat_get_dentry_set(struct exfat_entry_set_cache *es, return -EIO; } +int exfat_get_dentry_set_by_inode(struct exfat_entry_set_cache *es, + struct inode *inode) +{ + struct exfat_inode_info *ei = EXFAT_I(inode); + + return exfat_get_dentry_set(es, inode->i_sb, &ei->dir, ei->entry, + ES_ALL_ENTRIES); +} + static int exfat_validate_empty_dentry_set(struct exfat_entry_set_cache *es) { struct exfat_dentry *ep; diff --git a/fs/exfat/exfat_fs.h b/fs/exfat/exfat_fs.h index 3cdc1de362a9..7b5f962f074d 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); +int exfat_get_dentry_set_by_inode(struct exfat_entry_set_cache *es, + struct inode *inode); 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..d338a59c27f7 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_inode(&es, inode)) 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 6723396deae8..050a936efbcb 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_inode(&es, inode); 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_inode(&es, inode); if (err) { err = -EIO; goto unlock; @@ -983,8 +977,7 @@ static int exfat_rmdir(struct inode *dir, struct dentry *dentry) } static int exfat_rename_file(struct inode *inode, struct exfat_chain *p_dir, - int oldentry, 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; @@ -999,7 +992,7 @@ static int exfat_rename_file(struct inode *inode, struct exfat_chain *p_dir, 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_inode(&old_es, &ei->vfs_inode); if (ret) { ret = -EIO; return ret; @@ -1053,21 +1046,18 @@ 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, - int oldentry, struct exfat_chain *p_newdir, +static int exfat_move_file(struct inode *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 = 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_inode(&mov_es, &ei->vfs_inode); if (ret) return -EIO; @@ -1116,8 +1106,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 +1123,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 +1157,17 @@ 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_inode(&es, new_inode); if (ret) { ret = -EIO; goto del_out; From patchwork Wed Oct 30 06:12:12 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: 13855955 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 E3C981D0E35 for ; Wed, 30 Oct 2024 06:12:29 +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=1730268752; cv=fail; b=s/CwCJ2rd493Swws5PnUU0eTBtFhdB9z8UKEMyxlKZKWfpBymVISyZbJRgNLGAoL676TsuynyEROfKlNf0+FL19poPL1zZoTP5H1g+zbowc4rNBEtscqa9BrV1AV1ywffY4kFlSy9fmvbG4mxZpWTx0cF4dpTRpA8j7kyURQjZg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730268752; c=relaxed/simple; bh=PAltGoQnS/uJ3gLMNB0n6W3IUryu2YBytgVKdUCzYAw=; h=From:To:CC:Subject:Date:Message-ID:Content-Type:MIME-Version; b=cnSPa29GCgQmrdhR+OM6x0g5ewWeihl8L5hJL7JlUjpRlGYXMO6fwvhDn+31JUh3KlnCmyjd2hmoxRiB9wnf54bHogixNhXvR3Ds/FXuGlSt3/Iu9qZfJz32G7avLFhVQmCmZ7l4ryLHAUxSvQ7ZQdB3+8IexwWpioDbHdPWxVw= 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=TqVhgKew; 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="TqVhgKew" 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 49U5pfSR030520; Wed, 30 Oct 2024 06:12:19 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=PAltGoQnS/uJ3gLMNB0n6W3IUryu2 YBytgVKdUCzYAw=; b=TqVhgKewD/3zpcOp3jC+wogCwDgJCgLTPef2Y9i9nk6S7 3ODQ2/k/YLSk0GE6axy/Ek6L7/vgluZ7Y3xPeAZB3YlOBds1GMW6tunrmFYvlVM4 0zpJaSv23YjlsIkbQfR52n2d10/93B2s8qGCtZcwJbbKKa22gAyfcOv6ZlLGogRg 9lQunskNBOVlQ+LRAfM6pMIYBm6PkgSCAJswQzl0bbYyT7nKbe1RAwIpxGeAN0wr VFdKX8FUQPGe/lfFmqa7DRRIUS5V+Db3Wr/eYuE6nJwWBbZAhTHEC/CCX6nwwxk2 vfLi6Vxl1xS2Z6Egvwf28qrYXmmtPjJ66j50TnWGg== Received: from apc01-sg2-obe.outbound.protection.outlook.com (mail-sg2apc01lp2107.outbound.protection.outlook.com [104.47.26.107]) by mx08-001d1705.pphosted.com (PPS) with ESMTPS id 42k2ypgkbr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 30 Oct 2024 06:12:19 +0000 (GMT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=QK/y5vcYxffRkze4FO9lAWEWH+CcR6aFkroKEMRy/rgPoybA4ZrE2ECjAuuFbDL9zfXjmt9uLNit4e3yvBZcHUZ+loh3BbIaKQLxhyHrb9MC59G2xTQg6vNMuCNGBWgw1UFfJI0PRLh268o1BqMfCCJYMPfMVa4N/ELwOLof6iV30wXUqKzbzOxzVcfuDi+E/YEjdUE/BRC+xHND+PVoy6aFH0KRg25IM9hQIJUA0rEFBDeyCDItXHNIhijyMLxxJ9wGhDWJ8c5dX7NGoiozQseMW5irGfkYwQnj8j7mwfeR1hH57QtxtOOBrv3zkA+6X2wv2xWM/n9B8puU9N9Buw== 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=PAltGoQnS/uJ3gLMNB0n6W3IUryu2YBytgVKdUCzYAw=; b=d9xA8bPaR/ckVm3GhVKi9kNkT3JU0k0EbS6r9CKreObr44g2DCCxGRo3VF7k9ddLZx8A0tZiRkUpYb7F25qPpeHOV9fwhHnh+JF9wPy8/cyq6wRFhUT2S1b9lsiZHVhU5hfvGArdKLZTF0Ne29lpumR6TsaXZ0pcicZb0PTidzs+7rkXiPo9MDLbc2uTZQ0IPsmRfmxJCQDGsi2O85ccuWpMdkH6fINCiA0OP8KNNCpU6ibMW+2l3os7rDYvVzA7rw7XSJGxME4hzSFapcKIs55tmQJc63HUWRHn/EdvXpP5Y9P57NRa4cHLpUqGki8WE0f8MJLGoVgAHkExFIZFZA== 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:12 +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:12 +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 3/6] exfat: move exfat_chain_set() out of __exfat_resolve_path() Thread-Topic: [PATCH v1 3/6] exfat: move exfat_chain_set() out of __exfat_resolve_path() Thread-Index: AdsFxBC7bzWlHqpxQd6l0nhCVt5kHgkzZmJg Date: Wed, 30 Oct 2024 06:12:12 +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: 84eb2a53-edf3-4883-610f-08dcf8a9cb74 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?G4tZ8E4Y1Ev6JPzB0wc4JKnjaNlYN3Q?= =?utf-8?q?mjhE4hPagUNqxBPX4OhlDeod1ud32Fkta/ZwkEcpt+ViYSQrhbij1AIJuODicjQt4?= =?utf-8?q?7M6sAsYxmyxivvpqMlVIbIo9xJ80DwaXIbUx28I6OzGS4m4oCSacidf9PbggTmiPX?= =?utf-8?q?HwiFaScBIyd1qVUlhCjr8dSA6KwrkaN1Mj5tm4w8znAwtL5me2XCdC4kX67+Xb+wH?= =?utf-8?q?33WTCg3yQwLbwsfIOaqRqiggopl/G5ck7cViV2YttMoKKv8ZmcS3V6UgSLkTf6rIW?= =?utf-8?q?wkpNvUqResPyxyvpUj1CubbDCjkbHCrJLZxP8A/KSj2nqPnk2GgWrDhWF3AAL3Hld?= =?utf-8?q?QLjP9i1bqszf0DnmqfLhHOV71h+3CwcXy0h5rZZCuGFn9AiuvtD595iKIzG5neAa5?= =?utf-8?q?Ld0JPRmV9+sHwQtDrrCg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mECbreoGICy4cpJk37qsC580jqpZT7s=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?e/tw114EliULUWCL1b1aG+coy/2N?= =?utf-8?q?dT+bTRzRZqKoqmLl1yb30n9/tummObHNUfjUjEOSAxRPjcN0VPOyMgCl+x3OBB7u3?= =?utf-8?q?nck0K+jxAu898a7qwe0gwCe9PTwbPim+M5Qsdlqo7qWB18V9AvhX5DpK2/9VN1fXV?= =?utf-8?q?8SvT+EcPSMs0M2Pzb3toeSwreqE3ZcE8/ell2NUoBWNMb8Ld1rlD0ANq90ajURdrs?= =?utf-8?q?ItoglnK6bYpROkI8mIrYkFWaQC1WQVPhHTXnyQmZZmn1IcVvC3xwJDYZ126Er7ZK5?= =?utf-8?q?TPJjZOvolSwnSfDZnd4z//ToQbtRVBJLdugOJ8iN+JiFqokbSX7cboZ8h4d+tIBl4?= =?utf-8?q?R7mAlmwfhtjy1ob4m2pktqIX6DmQAjOZbVN+xa/ZtJInlazDk6QcZ2fAlW3IFqD18?= =?utf-8?q?yw0kaPuK4zi4114nW7F0C5okHC/X9V1RJ6SZxAe/PseUGmRGQtxXy5xCP1ojpagFS?= =?utf-8?q?xt67pFwaIJtQT8NI8foHJmmMFYlVRshC2yJ8IgObbMheRxIncmzmf2S5zIWdRU7XY?= =?utf-8?q?AtINTxI7sesud+A0wjf4NL/V9bT1L/QlvA3djsHBhE8gXAc7pighSKRosFMIfS2kT?= =?utf-8?q?yPe9G/7YOwych2zA2TN3xET3LANZh+dAx3L92QcYoKFce7s+i88rYYcI3pAqyxXHZ?= =?utf-8?q?lTYnIIyXAB7SaB0c/XHqxxHDR4jIhm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ailing-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: E3t2HDmX3NJFBUyxJDBcI3ZG8qsJbRqkr9LboLZ2faTsYDtvuOAsvFv3UO4APihVSCXZlVMoP0LLtEZTcHFnsle1lEwK3ZZJWqn/8rlV9r7ogz37Q4qUkwDU/jcaGbwLbk7+TksqbENVOnV5mTzAEKxaiwsnsQ9d01Y73YSyoMm/bQIPB1qvr3rWkdLzpVvtYpcyTUovxv6PioAj8vIsd/ikos4kx3GOR6ZmZfstE3yjrVxi6CPtEm+xaUmFYPgxapabpUBkdg/xEtVrXWIDr8I/Bjf3yJNGCwhApoC3SDasglPvL5D4tNDVzP/MAmRnGJBesATNU5+imwN3aSFLfvIiNQ3M246IuiefAAXpqdk0VHtjRD6mIJPj2aCB5+QAHDx2J2g38zTfBb83Ej+alw9Iagq/OymeZgzzZc8mxQ4alHD/nIhKxPhMy+tfsnpyQOPVlcweDXw1EM7keEgM9t/VrF3uof9D6mfnQSoHOB+eDIr04BBqj/sYsIg9XhNCnqX9QnvXDHpTca5NM60c7qEnbXc1VNp0Yew5urF4rpq3SNzSjhjVhtJdPyeiX1DLukbmUz69xXf0MogQnzFNzZwkUFN9EuCYrWro+dObPVO9Kry4g8EAhL9PCew6L6rG 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: 84eb2a53-edf3-4883-610f-08dcf8a9cb74 X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Oct 2024 06:12:12.6287 (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: oy8NgNnIlzneQ7F343+tT/i4OX80BrfKclqDBdIZb5o4NRESvfhACIp05OVs7pnO7ZrvrXo2QH4BzqcRLsyeCg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY0PR04MB6268 X-Proofpoint-ORIG-GUID: 2tRcmSBz27EvuzWlMOi5huVOqRKeFjtx X-Proofpoint-GUID: 2tRcmSBz27EvuzWlMOi5huVOqRKeFjtx X-Sony-Outbound-GUID: 2tRcmSBz27EvuzWlMOi5huVOqRKeFjtx 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 __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 | 53 ++++++++++++++++++++++-------------------------- 1 file changed, 24 insertions(+), 29 deletions(-) diff --git a/fs/exfat/namei.c b/fs/exfat/namei.c index 050a936efbcb..90066d8ec9a0 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; @@ -976,7 +974,7 @@ 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 *inode, struct exfat_uni_name *p_uniname, struct exfat_inode_info *ei) { int ret, num_new_entries; @@ -1002,8 +1000,9 @@ static int exfat_rename_file(struct inode *inode, struct exfat_chain *p_dir, if (old_es.num_entries < num_new_entries) { int newentry; + struct exfat_chain dir; - newentry = exfat_find_empty_entry(inode, p_dir, num_new_entries, + newentry = exfat_find_empty_entry(inode, &dir, num_new_entries, &new_es); if (newentry < 0) { ret = newentry; /* -EIO or -ENOSPC */ @@ -1028,7 +1027,7 @@ static int exfat_rename_file(struct inode *inode, struct exfat_chain *p_dir, goto put_old_es; exfat_remove_entries(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) { @@ -1046,12 +1045,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_newdir, +static int exfat_move_file(struct inode *inode, 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) @@ -1061,7 +1061,7 @@ static int exfat_move_file(struct inode *inode, struct exfat_chain *p_newdir, if (ret) return -EIO; - newentry = exfat_find_empty_entry(inode, p_newdir, num_new_entries, + newentry = exfat_find_empty_entry(inode, &newdir, num_new_entries, &new_es); if (newentry < 0) { ret = newentry; /* -EIO or -ENOSPC */ @@ -1083,9 +1083,7 @@ static int exfat_move_file(struct inode *inode, struct exfat_chain *p_newdir, exfat_init_ext_entry(&new_es, num_new_entries, p_uniname); exfat_remove_entries(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(inode)); @@ -1106,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); @@ -1150,18 +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 Wed Oct 30 06:12:17 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: 13855956 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 1B99B1D0F47 for ; Wed, 30 Oct 2024 06:12:39 +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=1730268762; cv=fail; b=C5qE310JKZsCOgMtgA2SBKTtSKWqrnVvJNMJuyzM1S98XXlHloZvJwtJ2WENJCZSC5BO59TWyoZIbheOY11Qoae1Z1CmI0qrt8Tw9uS9LQJJi/IKvTj7UyqS2SN6i9T67ElHp6Ugkz2UXl8LLge/90OLi1w1qwHNUd4SlTN5Y6I= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730268762; c=relaxed/simple; bh=Dj9oV0VufnK1f62WhDumq5kse5Jw87jpIybm0DSdcrI=; h=From:To:CC:Subject:Date:Message-ID:Content-Type:MIME-Version; b=oDFuNm+yOcwFp9HojWU7zW8ekoSXjROZ0nMLJyxY671yj+jYoeMLKxdABCIOpkUmhp1ya+sKpMLM2SzGu76MV5x9KwrIiIoGO2IiKUojBvSOguDHu00pV0ZZbu2BgXZrNPAG89kAcbGupFA0VlOn82O6widxyzWNslApyClmxnQ= 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=kh/OG7Nl; 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="kh/OG7Nl" Received: from pps.filterd (m0209319.ppops.net [127.0.0.1]) by mx08-001d1705.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49U4mBsl001183; Wed, 30 Oct 2024 06:12:24 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=Dj9oV0VufnK1f62WhDumq5kse5Jw8 7jpIybm0DSdcrI=; b=kh/OG7NlifEuhoebDvGidbOXlJMOhGmz6wTSvHPmejzPe OV5e9l8ugtGrQvg7bHJNdzGfrhpCC8ilVYoYpq6I6rpXpbIxfLL/fVqDP96dm/Sh yEGop/vItXrdo/VHkSB2urRhSrU5AkijeEmbJbbGRjlKnHBifgDuNc6o1EdwNhqn KLPDVUdGnAeSTBJgISYh19oz/AR9pChqEhERWrZ/MAQk6RcJ1p8agVS5U+XKXIAj 1zCx5vOmr/F5aEvWB4+gHdRGW91yOHjyrmdtP53+TW3pv0r7vmdvjT/kdXfrQSe1 RvbyfpJvQbvjVLM2bkTFejYwb1vNJN4mWcnmg52vw== Received: from apc01-sg2-obe.outbound.protection.outlook.com (mail-sg2apc01lp2113.outbound.protection.outlook.com [104.47.26.113]) by mx08-001d1705.pphosted.com (PPS) with ESMTPS id 42k2yq8hy7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 30 Oct 2024 06:12:24 +0000 (GMT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=NOiOevqYX59myQMdySAIh9QaMxDDhE+JFPOTErEfgJRcEedLq21BHzfmO2kF2FKvy7mPv7WtWJm2oR5ybG/28/RyYTYWEdfveI4vgSA/QZCM+vlDCrJXMNVghucypvA1I0yZd1pv2/CDfp3yMc6KZSUeHTHpzvxe6qfSVSnFL0Od081wEXEeIWZtkDWUvd3JPcF94ziZKI+OGXSr5jbsMDfWQgU6V4KkGd6MRuJbjtQ4BIqgNw3Jq9hLWbmf84LdK6DQTBPSrp4NRsEdzTOa786gNqG22tgQFDqWsKR4O8azGzZ5d7PfZeRxtJ4ArZkYPjH1+Mccd6bhtBlWlJTypg== 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=Dj9oV0VufnK1f62WhDumq5kse5Jw87jpIybm0DSdcrI=; b=VmA8WwIFGbZZT34GQb9Y3k6+R6Ek3RusItebvZoC2hG9jH2NR+nxC1ib9FGNE7vYCgTUVDUltCeVs7n0URroslVLYQd55diwWjriz6WCH1Ng+0SHkK1YfKBouI9xO/FD+DgSQ8bT1ey1b8htGh+MhV6RS/0apBt87TsrSJL5o2n+J8JmIwtWH7V2mqOe3So/MhxIl8Xht4SZaNNVhPg7WeIBreo/F48sy5XKrSEBbBMsCA1/fP02Vfl75h758DdT62fgfFSOK49ZlERsDJY5e6QnmS2zOoiLIg34+eGPWZqutaYLvQlu4ePXR81WsRZj+XoeI4VngHL7J3tkLZeqZg== 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:17 +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:17 +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 4/6] exfat: remove argument 'p_dir' from exfat_add_entry() Thread-Topic: [PATCH v1 4/6] exfat: remove argument 'p_dir' from exfat_add_entry() Thread-Index: AdsAKdCLZqiXRnDsTO6ekxDSVI0J0QqZ/fqw Date: Wed, 30 Oct 2024 06:12:17 +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: 11718297-cf8a-476a-1cf3-08dcf8a9ce49 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?2FnRG9ZsB6vnOcCt7P6rstdlXvR/Sg/?= =?utf-8?q?xzRwlL4kxqO+6kRkvh8bcder70AM8PiIP7+zvdxJNc7BgHH481Aw9c4lc5ml6sClP?= =?utf-8?q?E//pkvFEzg8SlIFLmha6HbDtxbOGKkEqEJiJAy2qaMwm3H4rkacVJZXGzAto+x33s?= =?utf-8?q?S4PrYZUZW8jUcXPQfGZlxVcQeY8S1TBa9neybQ0dvF5fGqlCplOCp1BG90X1QpoQf?= =?utf-8?q?zAr0/L7XQTOoRtKIDukgcIEuq/5aAD2yKRZrey+RRSO0qkmztoHAk5NTKWCxUgtUY?= =?utf-8?q?4v1D5KGH/qHzNpaV1w9YdQuySIcGQu/D1/6vKACwglxBdN+RatKVnigLbu56W8UPm?= =?utf-8?q?gYR/ph7tA+NvShT2KdhQe4IhGl1EktxT3NhHbT7n2OvZ6ADzR0ZbMVmu3VtRnjiGE?= =?utf-8?q?NMKOU3rDk4rNoR0W7N3Yp6BDW/Hrek9Qr2evU+ZQzalMvHGu2BA5+acYN5vyydpCS?= =?utf-8?q?oUEqZZxI99aVS/CRanPg1IaR5HONPMc/ysUXZaYDTl/CUS6YYHBwiiz2ixvjlwbYf?= =?utf-8?q?ujPp5n8McD5Ka8KkIVI/tM20+yeVvgwIGFack72683I7WoeZ2qTb5CxPOAqk0xF0W?= =?utf-8?q?3QFd86K2wA/zFNtxPxZ0H2f0P++2d1vLRrYSHhV45GZyfB2ltUUaNUbrvIGYVcygL?= =?utf-8?q?UALdU3MFWvsrpE9QzKpiL88MfFG+JurMfrcXfYD4MDKwEgtwxW2CQhQjoprqAeRX7?= =?utf-8?q?ZNb0lzx5GoHFCa8sIxpMeztOP+l886Nf3CVldkJFNEObRc4YJgfjH0tBMCXWpDSpg?= =?utf-8?q?Az1ddPXqHBB/UdFDgpW55ZYYbcHQemMKs/C5vDjmOhOmBl7yq8u2xuFicxzV9Xd9n?= =?utf-8?q?174GG6vtzwK0TDAsIZMRfZarOWqUFpMy84rRJGqZ2fw7jSw++a06ijUa+2V1b1rzp?= =?utf-8?q?mgv5Q0uhk07vzbFIUnbseYKl7DPnMZ6we2VpEUrFwVmVrxmy9zps+PwFVsWmhB5jq?= =?utf-8?q?/G/O3Fz6zXHEJvEAHdhZrdZTjlCETsXu6osHWcDBJGfChjKOfLGuzmxiBnaFsAxnR?= =?utf-8?q?OnJ8KhGUt09x77KCVLFFnhTbrdBIb1uAkzS83jgDR1CkaFTMNQ49VYqJ577bTepbX?= =?utf-8?q?Z9Qud881vKaFDObbD3wnrUX+N4BA8Rz3MB41Y7l9FP5bYs08Cfi8e5y1VNwrfwXLb?= =?utf-8?q?fbkm3mtuuLJiV6BEfI63w+uRUuEoMjjxhhJyd+tSoP28Srgp19gOiW8VpKgKNucjX?= =?utf-8?q?8D+0VJpG8OZQYRjNtuSwx/jJAq3DlqfdQ2tOPgpCu8+UIGlP/wqr2hm5jvsi3SoWN?= =?utf-8?q?5JClH5uvRpRs0dcFioOnlsVzthiSZJ/B43NQ7BdBUJqLyhdbxBI9hqbI=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?2TE4ieIewiR1odwreVKHXxtzj5cp?= =?utf-8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?utf-8?q?mYMf4WTyiTqA4al+PtH6bS70R+xNL6SGbXN1cxpMIpqzdciEk7gv8IC9+JW29f3B0?= =?utf-8?q?rNILNsujCOCPfSGhs/60r+8MF9OpcKXdpUtgY1trpBWzEYVoTjEjpzbUykIr6eYy4?= =?utf-8?q?VXP5n5oZzaUtMLo16i8tL4coSCQtksCeEg4FHByTzN+9xSXm0FIo9T292qEFr81wI?= =?utf-8?q?gkBzStSi9RFEyWPV/D7POcg5z4H5+vr5t6I5FjI1HlXghejixcsVafGwThHbngrtF?= =?utf-8?q?KX4CDjVDYdASJ8ikT9xMdMI+dzzvYmJX9dMcFjl//AHTJI0YZB3TzX7FGgKkFW1SJ?= =?utf-8?q?rIQMl4BPZcLqF3I2FlnE7mjdo+o+SYLctDsiKeW49VAn0C3rfBr6h3rdmCXchchOZ?= =?utf-8?q?4rg8gCcFzVBrRn6/DMlV3SrSzqY7NFGi1Sg1rPqeZOIzjo2Tp/qouXs9siTDoR+Gm?= =?utf-8?q?sebk63XTMbWSK8cAbU8O413zbEnDs4zZHTWc0J1nUuHqk3dCzQ5/1VK0N0eOvkrdS?= =?utf-8?q?RADEslpP1c72OEyixUVcf1T+z8Qfd06RTxJoc+b3uGC5ULiSvyg85tWgnQk+XIfRx?= =?utf-8?q?2qmw21PwpNnD28IMwYSyjggrln0VXL6auTAlrteoEcTSQK+KZ/8bT3meA+zrOtkGu?= =?utf-8?q?+qNb7AAiz+rO?= 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: 9HkdL5U+2/SRkUD8EGaZFQxB6eZ+181tZDLF3sAxhcSugOlabn84+udbZFtGNt8I49etuQBUrk+C48RA1CrCODQ8CjsTyieQD7skSUgsNkx606YzVuWdxG4uRvh/1/zWj4ac9fpgv5DWdlp0Lqu+9xx4ZASrNHbDNYwI4D84hDuy6OzaYY59vmAI0JRdX9LPjUxq90vdE3U8DD6XljKGxqVkGBWjCKORbNvcIdUKHqtvygRgSqbADuCs4f9Sd/1JvV5AD5ynpL9fwwXZDGcRcEe9Obfr+IFS3b0upo8KLSqf3qa+Gt9dW/weMuz43x/KqYfiIsqxz3vQyDx0q3tG/oRKV3mbQhx4TF2ivbVfpWTzp/vqQyRNEinwgGQVK8QIl4TmmWESZf7nVzzxNSnNOpLGFLAgwfBvPBPTBPyzu/WqJS27410EZtR+xyABwus3CZFn9iAEu7JuWTiA3X14a027uPW6B2Ptdo78YgCKPLuJKBqbfgrjo3keqK1E8jRqpCEYW7TNs6+Ydo3JaLqHdBBMWI7MvhDhIDG83Yax3Hj2kReKsyb+y7VoHxjJN8XuGIB19k8d9tNFfL0zhlBeQ1+XUQqfC2VIqfSEWalkHNx6wKviZCauGf47V9fvVaHx 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: 11718297-cf8a-476a-1cf3-08dcf8a9ce49 X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Oct 2024 06:12:17.3372 (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: Ms7B1ehGgl7Q7MDuoiGJFphLNQ1Ihxu+Vd4QRpRQMC+IacirWM88iRhLMi1ckwJKQddnPTE9l/LglFkrgXSryA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY0PR04MB6268 X-Proofpoint-ORIG-GUID: e0bJuBQhPTgOg2sYam4I48_ufhxpwInl X-Proofpoint-GUID: e0bJuBQhPTgOg2sYam4I48_ufhxpwInl X-Sony-Outbound-GUID: e0bJuBQhPTgOg2sYam4I48_ufhxpwInl 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 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 90066d8ec9a0..39297d449dd3 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 Wed Oct 30 06:12:21 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: 13855958 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 7B78D1D0F74 for ; Wed, 30 Oct 2024 06:12:46 +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=1730268769; cv=fail; b=CHHTBTNUpFBUhcj/YohDFEF2HYu8td1/uo2/ZHF4/T7H71JbcK/9gwi9EqP/zY2R3VLISlnXkobJQGTLfvszuoL+i6DdEcLp9xRhLweRIPcG39T7+47x+kKcgO/iPL7Lhf7I9+fd88hhhvx3hKSb6NPNBZx/drxiURvcZfng+Ew= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730268769; c=relaxed/simple; bh=HLLAjmP0VQImJyvzcMRKGxpig8Eevi73YdUOjHllyV4=; h=From:To:CC:Subject:Date:Message-ID:Content-Type:MIME-Version; b=irTlhlAr6H5Gp7JnOAf5e9bQ3FnTGAX2pGZ286JxLSOjG+s4b5MW6AVYaLaLTnxsRi4hj5fU6Y3caOXkHAVMvjdTEPAeEZfUTqFElhFArHoSLyeiFmRgjJ+e4Az9+tKY/Leq26U7QTR9zcK2lc/TRvVP7TH+JKrD9fnay5Hlj7A= 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=R18ilEUv; 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="R18ilEUv" Received: from pps.filterd (m0209318.ppops.net [127.0.0.1]) by mx08-001d1705.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49U5rtij020979; Wed, 30 Oct 2024 06:12:35 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=HLLAjmP0VQImJyvzcMRKGxpig8Eev i73YdUOjHllyV4=; b=R18ilEUvwCO5J/MdWYusrZ8Aa/NRkHfIDl8zG2QrUw8cG 9hXq2MVhdiPSooR/u+anQDWBqE69faCD/ewVnakHgAg7/KV1JJ3oqPvecu2UVaTc o9zfGeXc9ZjQGjJ9cVgaajq3BLk95T6TIEg/NuHQETFafPNtekD/gBXYJFQ3hZvj DDywlKKpYKkZjwAzZBPw7TxQf9yTbYh+gyy9XzhlqH2rGbNadbC3YAtbcJ6oTATz PHK/w4QR2A9Q+5cnPj1WiPnfSvJJl4fIUBxesaZAzuJrYtp5s9EHKvieyqHQAU4n 8QvqAiDsew3cSEDM5//4e4XLW0WaKfci0TZjNjIsA== Received: from hk3pr03cu002.outbound.protection.outlook.com (mail-eastasiaazlp17011029.outbound.protection.outlook.com [40.93.128.29]) by mx08-001d1705.pphosted.com (PPS) with ESMTPS id 42k2yq8hs8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 30 Oct 2024 06:12:34 +0000 (GMT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=mblONxvEn9lvPuOARpABdha9Tk/4ydvfyMhZkdYCCG4eSB3Iaw8m+wBwCLz0dwAFn0wOkPg+yjFR84VVYY9V4HBDqZd1fwbcn/SqliUUFibNRJeZCeKNoMkrmgh7zbsDWLwSOdz3SJNkXKPeYStmaUvg66pR7w3pKAeo5bkxfNZXgcfl9q2PV0z3rxZ9hycfCer5CtWRGemdEdVt0iGm9b0QfhfVb25lc7g3Y4WKK3dze6kbuxSz0ah+yMgngNOyFDycWUtLR0xOvOu6oe61WZJ+WxkzSy37xuF8GxMfayJ2xdFmpxk40lhyEJWTpmsGufOXs5bVgVdVCqVcRJa+WQ== 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=HLLAjmP0VQImJyvzcMRKGxpig8Eevi73YdUOjHllyV4=; b=JPHnXM2Q7Mp093OJkHm7oYukYAmDxf23hIVtw/Ab5+/Rjbay1wZiEefvjGbQOr476RUTe0/ZygMDYqqvLo6ZOtyG9vtcPkDBHtXD0edbe7650wGK4xh7KWq7KRI3Ml+qrDw8Czaick3C1HbzS6a3IeUp3bdp7rO1pkJ9rD9c6OJUjwDRHTwe4cIXDLhLnBf816eK5O59VFsD0fyFvYEW9hv+DE7NQWZuicyBJlF3A8PIC+a+oPY+4xpled/ooOARC9tI3o6mMHDJwn1ai6NrYqch7ygacHy1mkq9EeFP9/uyRNGt+IO1aoOLyIruLtahrNIb+GWH9+FaQj138mRmtg== 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 SI2PR04MB6115.apcprd04.prod.outlook.com (2603:1096:4:1fb::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.29; Wed, 30 Oct 2024 06:12:22 +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:21 +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 5/6] exfat: code cleanup for exfat_readdir() Thread-Topic: [PATCH v1 5/6] exfat: code cleanup for exfat_readdir() Thread-Index: AdsE8yC3ez3tc0L+Tei8vqLbbtrSjglnt1DA Date: Wed, 30 Oct 2024 06:12:21 +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_|SI2PR04MB6115:EE_ x-ms-office365-filtering-correlation-id: 68a0a6d1-bacd-47b4-2576-08dcf8a9d0fa 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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Qm1och00sb31Ope5YVacI3xJd09nFSORjkNnk+HARe3nPk233JCQijkfaWJYvQq?= =?utf-8?q?oAwJxRfm4WdpcLYersbYOAj+4qqoWrC+YWQzmrg9QweUYMC/91huIn5nDBO4wfL1J?= =?utf-8?q?/79zxkoWsUzFGlIb9dJplIFLQHgAEsSs5iZbUz/U+li9NDyhgVzD9LGXuMlSZbHKk?= =?utf-8?q?UItLN214ZB2BwMTHQnFHpfwvzpnIHdDRvIWmMYaRgnhhq1aQtILj9MmOy4J9P8ycC?= =?utf-8?q?PYdnZwbf8zjmx9o4Pu5N5Mnpe4UHk4/HaGDA3l2dVo4FqYoivC1vV8nja/HvuWEtS?= =?utf-8?q?HsnVDGkR+Nmrxan8a/iTX2VkLV5F/8DmBjhd3F0cNFyWwDFa2S0ivx/u5Ng8ux6oc?= =?utf-8?q?YVJq9eUwjniYN8bpxxJ1AFRbcXaJYa6B1jvteH7F/AD43D5MeX/Td+jVfEcieZ348?= =?utf-8?q?9iTBr7Vm0ACUiepkAdaUdbbPdD7Zuyz1s9RRh6fyRsEyLY0Hvn/b7Ilg=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?i2wz1h8946BLw1wZrCbEzXF5GOOo?= =?utf-8?q?Ikshiy+Ka3DPSRACABhyBvDfL2N4L+Rdze7Gg0bzapHN84eIsMyD91DIDR84MJhN1?= =?utf-8?q?jY/ZvJ3R3G42UYA5EyWfgN2CzYWDQ68dvcszhEXYDYaBr4yeIwrevjaksi2wK1qLX?= =?utf-8?q?4lw5FjIeMWRECzgUINwLLk3S7m74DVUHhTW7Ocs1Ag62LbFf1NRxypV4lZfLZJW0L?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utf-8?q?vpUevdtc0XLOOBaYiNrF8RkhuhQp1h2x9CXZj93rAMyNW7T7+gUyTjVePdnZbx8TT?= =?utf-8?q?Mvm4+HuhVMp0hvwTQXRTBihqP9G+2sQQ27DbPZZBqHTNY/DGLN66/2LDu4nB7Ae/g?= =?utf-8?q?Fcw/ZBB1YW3rv3ctcEyH8haQO2xTzUFCuEp2ARjmSxlUkQakw2ZBNQaFKk+VgK094?= =?utf-8?q?I6GpNozfLwH6QFm0iw5WkJpaHUslRPoDTWtSM+2tGPFrOJjd0HpY+/LRp1GX+XGyR?= =?utf-8?q?1K/dUBxe9g/qICmhjQBFzONRr4Er+lpjLRXuTY5qMTSenkF4R4pVeLHxt+SnBC48f?= =?utf-8?q?D1dq0wVf/kS6SMVHyjQYaMfStZhxoQr0N1OtH7Zf4BisL8zw927P8iCM4YsTOI/4O?= =?utf-8?q?RCj4er1i27hvWIHV7USmDLu+dSpiZ652V11Ay9VjMOJ9eAk9svO3X+6vGorCf1bmH?= =?utf-8?q?6q8wVS/RSShB?= 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: L/yfX2S7sIVaSjS8GIY4WqKyfYPIcPhHZPuq+Ywo1bR3NCZQYtAFEuxXxrJ2am+I/FJHtndsGCOeDdGX7/kc0rTGYSLhEamlpZ3ODpDJyiQ5WhzAuTd2dQ1+m+XJdN8Q8QPadd2NszMFiAXyFRxWdBnTBy9UQewiI+RyZx5EXLXlT3ZsLsQFnBpXulwfxShLJXLZDPzsX7rMBOywaiTDNqImIrb7G3DXqmantwTIv9An4gtXzxx6iFYI++7lALV/gOJ6FQISb1ymMZ2wtICPbndE8yuIgtpGHoQ1TZoezoRpYeud8NkwHx/GkxoZTVsSmkZ+CbLq1o8TrpcZiNt3cgzSgDWV8WVPCug0oIq0H4lwxZupYPl4ufBoLHTRIJ4ZFJwwL69pNfkLsPrRsyILVu2Tkzj2r3Ws7/ObxAvtXRBH+qJXiu+zNpAkpq+AZOX27qYMjHwJGGwDehKkpKUoeDjh9d1fGIZ8F9G4SB4TqexiYz3HG3y5F326B92zonrCW3fBcEE2eMWqn36mPxWayZe0qIsECQgRogzE1xRNuXFqwVKPBeh8PvdDRAz0PZ8ecv+YiBzu5kjvQDQspNRAgkgylc+9kz09Z+dqs+28fndbtsGmErsb0iI9r5obm5jw 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: 68a0a6d1-bacd-47b4-2576-08dcf8a9d0fa X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Oct 2024 06:12:21.8698 (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: Mk8qatuFTM2hTNN1xIWGZA/nwIL4uKupxLSJ/uFdogC24kqMAXyDiI8Ieab3xkmdBvfQzVZ3Rrl3nm9vc1nPiw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SI2PR04MB6115 X-Proofpoint-GUID: 0eX2Ly4VKz3s4_5Qj3yHxAYU_A2eR8hA X-Proofpoint-ORIG-GUID: 0eX2Ly4VKz3s4_5Qj3yHxAYU_A2eR8hA X-Sony-Outbound-GUID: 0eX2Ly4VKz3s4_5Qj3yHxAYU_A2eR8hA 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 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 61221c59547d..e2d3a06fb5e3 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 Wed Oct 30 06:12:26 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: 13855957 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 73D491D0F47 for ; Wed, 30 Oct 2024 06:12:45 +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=1730268768; cv=fail; b=SiNA/lseuZx91EpjoCtIVgp3JV3G8wd8B6IVAPmAvcBDv+4IDjFYBPLgtg+hhAdvDqXl+UFbOEbi2zikso7fjTejY1bCiPhSNwI/Z54XFCqY3NQ/9njAML5n8cC4/NnZJyMB2TTSQs3w8G6NhOjKlBDCsiqAva+JUNwDZeyXM6c= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730268768; c=relaxed/simple; bh=xMehnAoOA0YVJI3CGAFLzJSQX6AE7G5cZ9Ylvy/2qVs=; h=From:To:CC:Subject:Date:Message-ID:Content-Type:MIME-Version; b=g+AchnW8zEeBBs8pifEN1xRyfikVvapYtKcZKk49OT9WWb+YwyVTYb1oqt6JB+HXAkbm+V/5Ymk9AAUr7dmu5t2bqTQQxxGnCgEZOcrLERu8Yg2wuddtsHP5VgrJJ0n17PnINIZH5lyFGM46IdRyooeaXVWBf9WCH6zH9bUh2U8= 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=QNz/20XC; 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="QNz/20XC" Received: from pps.filterd (m0209318.ppops.net [127.0.0.1]) by mx08-001d1705.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49U5rtik020979; Wed, 30 Oct 2024 06:12:36 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=xMehnAoOA0YVJI3CGAFLzJSQX6AE7 G5cZ9Ylvy/2qVs=; b=QNz/20XCNJWp0qZ0Q4WPHd2gISmYsQ5/uVSVgsO0UOdk0 iakUCRhJ3H7OQBqpXTB+u10xmuDFzMTUuYdqwOwIPVSxD+WMCOdsyfOO9NZafRp/ 8zbkhbeqRLBsWRssmIGFUqImDjzv9QSK6kCB5TfwhJNc9oI4/F7nJBa2AVpYLbsY iZ7uJ/e3vKSHzM9qlxRcZuXlypuup6Yq0n5MHJCIHIYnyQj1amFt2lyesHwPlUrk 76Q/oHNmLT6c1i7NlCwENmMKI+lOYCN4u8fuFowIflsByznrfITM9dawCWZDd8sx qV2PkqhG3jDStMx27Pu7AXafVMO1hkKry7XTZ4eHw== Received: from hk3pr03cu002.outbound.protection.outlook.com (mail-eastasiaazlp17011029.outbound.protection.outlook.com [40.93.128.29]) by mx08-001d1705.pphosted.com (PPS) with ESMTPS id 42k2yq8hs8-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 30 Oct 2024 06:12:35 +0000 (GMT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=WkB2YgmOCMsYpL5pCM1nzECXG3PC8qwZuASHSItM0Bjkk1Za1hyCUGXhkhHUFBMYYMO6CIReNH9LlP9yuMfBA4m2LDgJrDIYMPRGzboP3frGvcC2L+97tpSPywkpbCZYGzWmMZI5uDQDQ5rCGjFVegrXYIchFBW+oY5kkY1YVdQN1EXnbRSKYwqK8w8pAW5X6F+5HX+98giJHNfPYot1tFCjeVw6+ISPb6VFO9bWFokmaeIkUVkX5o8bKs/D2D9sW4wUoTjInpeoZNSwjcorDVHJAmDOd8o16t3ZxHnaY5Pb8kETFW+W1dSwnr22PAaMKwP04cDDuiBKmjseZQQx4g== 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=xMehnAoOA0YVJI3CGAFLzJSQX6AE7G5cZ9Ylvy/2qVs=; b=x34F+F3oxLRbLTSzkhuPvOUg1w6KtEIHQJs2uke2ol94G5YNVVOzX2OQUkUVD3s8M4AXkdBpak9yMt5Qs5Bq2zqQY6khoFO5ty/pmqepy42f0/GNyMEuiV2H6vs6fZm0kBQvMOVy0tkFxvbHppb2iTkf3Nrd7EmylMZUWsbmbig0udNuqwgo3N0J9RgPSwed47AdpBkfl7qBWDoBHXHHdvSCaZWEkfmaXVipPK6mSJT6nXLGXaUqEqNoo29jkyW+HTynCCZWFzYh1sn1KqUZCqfOcH/pRAnk+Ambh2NStxrvpcnxY0JYSUkF6esfYGJnvykcrhnVla+OTAQAMeT/kA== 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 SI2PR04MB6115.apcprd04.prod.outlook.com (2603:1096:4:1fb::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.29; Wed, 30 Oct 2024 06:12:26 +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:26 +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 6/6] exfat: reduce FAT chain traversal Thread-Topic: [PATCH v1 6/6] exfat: reduce FAT chain traversal Thread-Index: AdsE8b4RuEBQExP8QOeg0VhYfcJWAQloFkDA Date: Wed, 30 Oct 2024 06:12:26 +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_|SI2PR04MB6115:EE_ x-ms-office365-filtering-correlation-id: 505e397e-5cab-4aad-63e4-08dcf8a9d3b2 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-antispam-message-info: =?utf-8?q?nb8qkpeWE1B5Oi/QZ2+S90k3bubDMLS?= =?utf-8?q?V/5sknxvmtePF+yJcTadb1akDMUbXyDJ3Hb0OMvnNnLWnm6j72V8mCW0bRwAnY8yY?= =?utf-8?q?n8JT4r001iMIgmDS5us44KCgIByBEs9HbSN+ejAc8DL71Po3Euo5evuM8dqRFGV1a?= =?utf-8?q?pBwFPZQS34SNqsqjZ/fuHBdhYsmPOZS3Tyu7+WZ8xS0KLclWeW+WYMZ12KjJUA9Fw?= =?utf-8?q?MkDuJm7e5TKKETznfJ8OTqB1S3v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AZYcpbr+O8Z9j0CA+NfbJcQwSYPS8hwd+eMm9s?= =?utf-8?q?nAvlMTIKWiO+DxXSoStC7ThDK78muI9rr/NWXo1EX1iZBs1YfI44/O9sEbDuh14qe?= =?utf-8?q?vJ/BANjXR67dnnN89QZaDrw+Saa8bjbVG4LUh9mDqjUD0Ou2MK5R985AOen56GV0c?= =?utf-8?q?/NATWYfHkrwIG8px4yndAWBaCXJpPGSHsg3DnJe3wGq5jjTYZtbErsNg=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?ZL0T2E8/9KCGIcIpkhZhQYRNWDse?= =?utf-8?q?NR9Ath8tHeauc3hJef7gdATIFONBRoV3Da5I7ev+Pinm8+b6ry2vHSJLV+kekf3yU?= =?utf-8?q?iNxpYhV7snloeE1gu2r+jnYudV3fldHKer/9kbNVmW1AEj9Dtgm+Q8e6By39KwLuZ?= =?utf-8?q?5Oy+sccEnq8Jp6KnEXIraCQwMM0qU2o1nnFYDUB+kx79WggLdUuiIj47c7H1Km05q?= =?utf-8?q?1QYTy96RwNOmGrVEGhaM78IQiab3IsxCcjjeLlc2pQrTfYsm5b+K70quLLkmTuULu?= =?utf-8?q?4EzC8QJfSs/ab1fodCRJjpjwPqmUhsEUK/jBlOwPh/+uSkvtHdBYX2mArHFDCZGwx?= =?utf-8?q?ytQPqs/H6wyma4KcG5e2KEZJCuWpdiybvE/37gwhzLUAHMdMfmZP8yuGSQk9q16vL?= =?utf-8?q?7MjeaeSEybB7XJs4OsLDzkBs51XqAKNa0iJ4GxVK7jFCogHvGLZykNpM00Eqgy9/A?= =?utf-8?q?qV5qLBi3gn8FQt2mRvRAk25g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GIr/f4uQD5fVf175KVY2S+2XyptypdVLgUEm9forCKxx0a?= =?utf-8?q?SI0FaQoZ0MDc1QP159g51j5muZl9wyi2zNqb9EJGgXQcrwUrJA4wB/c3sv2roJG5p?= =?utf-8?q?3VmLhC1Q106zM0KXeIBaW6Pi6CtlQdLc2Rrr9etidDT4rXwqoNiz7SzovKQsuyPjv?= =?utf-8?q?JJwGWK/ErCYj?= 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: 3mixlnrQCtSjuvNgIPuqTWxuevjcYK1SaXMtRJyz4D0j5r1P2iJDcX9tKJDNVX7ikMm2oW6+ILKVYKbIgPX/dnzi8BXv5kp6mPrMVuM8r2BAF20IMEOftZkjj39tUImblwXu1/aqZmISTMRYt4vmRl7Rt3uEjpjdpcpVkhtNE3phEV9ji6+9xSoUQaanqYz5QRkWX+qwboD2Y0c2ZAR4xS+3KyXlC/ml/EdzuVpuIbVG18vH0Nw2K4tljiEQKE+SJeBDxmruuBDLkQvuHZcyifUFXjbpPZL8gelbHBgyKRzwC7aPg7SH+F89vItofTAieorJ3g1HhHN7VOe3dnsKA5WIt3HnGVRFkmCKZPRajVo9g+8N5KZX03O8k0D+GH+Gv4ICUHdGAqn8PGuvCwUmpaS/G1h7aQHaHCGjUDfZbIHvQEr95fJUtkyYdc7vhFHdiG8lgsmVASJ9f9xdI31tvrRLkUy1of0UJiHSWh/S0C/8TVaPhqmR1fcQW5px0dp71IVnaQOaiz96+0XVYQ4nvRyGJuhavV5n8IawNBYDw6JcjDxJxa8vLV31t1kElzzVf4SDMRBC3dWt+wSLdPWm02iv5SJ+3Yyah9uHJIdrYX2SHprmviInbKOg6OSSBk6w 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: 505e397e-5cab-4aad-63e4-08dcf8a9d3b2 X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Oct 2024 06:12:26.4113 (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: ykbpUBajYzl6w7Sxv28UySro8oKezVaTpsJpCTvQprrYeFI+Lw7hRATkDD1k8yE3oo62RGq22h+UL2kf142OUQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SI2PR04MB6115 X-Proofpoint-GUID: DL65XRzm4G86MUjqzO3eDAoXPDGMa6Px X-Proofpoint-ORIG-GUID: DL65XRzm4G86MUjqzO3eDAoXPDGMa6Px X-Sony-Outbound-GUID: DL65XRzm4G86MUjqzO3eDAoXPDGMa6Px 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 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/namei.c | 32 +++++++++++++++++++++++++------- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/fs/exfat/dir.c b/fs/exfat/dir.c index e2d3a06fb5e3..d1cc58aabbe0 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/namei.c b/fs/exfat/namei.c index 39297d449dd3..5f5bbbdde194 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);