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?kAipfj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KdbNLZVeCNZl4nhgzLvbyKW5WA066v2YEjco7TVsOn0s5JgTq?= =?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?6wTs5QJLc2IJRz7CqYgG+RrAwAYu?= =?utf-8?q?tYFjbnhIX3pX5IkSLR3OHfLh79ANAwz/zmZDUr59ThpR0/lNSWKp80yx6Uol+76O9?= =?utf-8?q?Tqvt/OyAr9HKdlKlWP3MlexrQCBePiWJUnLpkm42nNVgJAfjrvobSiuItAen8ZyrA?= =?utf-8?q?RgUeNyHUhRQoiebtJA2+ZGrsz+T8G9rtqTDcb2P8wvmfrfI5A33jFkitl5IfLxyaF?= =?utf-8?q?wJ6RUxMlM/LHahNyI0YugtKEG14fc6a4J0d6QhybrHVwaYfPJuBBkYt628bws4neD?= =?utf-8?q?YgF0d/fOmUcog+X7w9ULdhZt9WGwbRqs4IG5z35GCI9gdHrB59xFuIo14KVreoBHt?= =?utf-8?q?ojJwLTCVfStUuR+9A7vAq0jBwuwsUoulKVo15lIn4GM/Ge2DWftrKvRGzbY6kAJu4?= =?utf-8?q?Z8U6U3f1gDjoKYivkrAweam/ObKAfP9JgaFba9VzsdbqCpbG0LL9Bib6R+bZsRFC2?= =?utf-8?q?CEbWVWr2+k+HmaduD3yCS77F3zdbzaYIweXwpXkZPB0PN5FWibU1h2YRicqfOPXYv?= =?utf-8?q?cwpXlNkyMVSY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d9tiMp7OS6xUxiQfRGNiCeCxkuZvqYglrz1kMpSb+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;