@@ -779,26 +779,23 @@ static struct dentry *exfat_lookup(struct inode *dir, struct dentry *dentry,
779
779
/* remove an entry, BUT don't truncate */
780
780
static int exfat_unlink (struct inode * dir , struct dentry * dentry )
781
781
{
782
- struct exfat_chain cdir ;
783
782
struct super_block * sb = dir -> i_sb ;
784
783
struct inode * inode = dentry -> d_inode ;
785
784
struct exfat_inode_info * ei = EXFAT_I (inode );
786
785
struct exfat_entry_set_cache es ;
787
- int entry , err = 0 ;
786
+ int err = 0 ;
788
787
789
788
if (unlikely (exfat_forced_shutdown (sb )))
790
789
return - EIO ;
791
790
792
791
mutex_lock (& EXFAT_SB (sb )-> s_lock );
793
- exfat_chain_dup (& cdir , & ei -> dir );
794
- entry = ei -> entry ;
795
792
if (ei -> dir .dir == DIR_DELETED ) {
796
793
exfat_err (sb , "abnormal access to deleted dentry" );
797
794
err = - ENOENT ;
798
795
goto unlock ;
799
796
}
800
797
801
- err = exfat_get_dentry_set (& es , sb , & cdir , entry , ES_ALL_ENTRIES );
798
+ err = exfat_get_dentry_set_by_ei (& es , sb , ei );
802
799
if (err ) {
803
800
err = - EIO ;
804
801
goto unlock ;
@@ -928,21 +925,18 @@ static int exfat_check_dir_empty(struct super_block *sb,
928
925
static int exfat_rmdir (struct inode * dir , struct dentry * dentry )
929
926
{
930
927
struct inode * inode = dentry -> d_inode ;
931
- struct exfat_chain cdir , clu_to_free ;
928
+ struct exfat_chain clu_to_free ;
932
929
struct super_block * sb = inode -> i_sb ;
933
930
struct exfat_sb_info * sbi = EXFAT_SB (sb );
934
931
struct exfat_inode_info * ei = EXFAT_I (inode );
935
932
struct exfat_entry_set_cache es ;
936
- int entry , err ;
933
+ int err ;
937
934
938
935
if (unlikely (exfat_forced_shutdown (sb )))
939
936
return - EIO ;
940
937
941
938
mutex_lock (& EXFAT_SB (inode -> i_sb )-> s_lock );
942
939
943
- exfat_chain_dup (& cdir , & ei -> dir );
944
- entry = ei -> entry ;
945
-
946
940
if (ei -> dir .dir == DIR_DELETED ) {
947
941
exfat_err (sb , "abnormal access to deleted dentry" );
948
942
err = - ENOENT ;
@@ -960,7 +954,7 @@ static int exfat_rmdir(struct inode *dir, struct dentry *dentry)
960
954
goto unlock ;
961
955
}
962
956
963
- err = exfat_get_dentry_set (& es , sb , & cdir , entry , ES_ALL_ENTRIES );
957
+ err = exfat_get_dentry_set_by_ei (& es , sb , ei );
964
958
if (err ) {
965
959
err = - EIO ;
966
960
goto unlock ;
@@ -995,8 +989,8 @@ static int exfat_rmdir(struct inode *dir, struct dentry *dentry)
995
989
return err ;
996
990
}
997
991
998
- static int exfat_rename_file (struct inode * parent_inode , struct exfat_chain * p_dir ,
999
- int oldentry , struct exfat_uni_name * p_uniname ,
992
+ static int exfat_rename_file (struct inode * parent_inode ,
993
+ struct exfat_chain * p_dir , struct exfat_uni_name * p_uniname ,
1000
994
struct exfat_inode_info * ei )
1001
995
{
1002
996
int ret , num_new_entries ;
@@ -1012,7 +1006,7 @@ static int exfat_rename_file(struct inode *parent_inode, struct exfat_chain *p_d
1012
1006
if (num_new_entries < 0 )
1013
1007
return num_new_entries ;
1014
1008
1015
- ret = exfat_get_dentry_set (& old_es , sb , p_dir , oldentry , ES_ALL_ENTRIES );
1009
+ ret = exfat_get_dentry_set_by_ei (& old_es , sb , ei );
1016
1010
if (ret ) {
1017
1011
ret = - EIO ;
1018
1012
return ret ;
@@ -1066,21 +1060,19 @@ static int exfat_rename_file(struct inode *parent_inode, struct exfat_chain *p_d
1066
1060
return ret ;
1067
1061
}
1068
1062
1069
- static int exfat_move_file (struct inode * parent_inode , struct exfat_chain * p_olddir ,
1070
- int oldentry , struct exfat_chain * p_newdir ,
1071
- struct exfat_uni_name * p_uniname , struct exfat_inode_info * ei )
1063
+ static int exfat_move_file (struct inode * parent_inode ,
1064
+ struct exfat_chain * p_newdir , struct exfat_uni_name * p_uniname ,
1065
+ struct exfat_inode_info * ei )
1072
1066
{
1073
1067
int ret , newentry , num_new_entries ;
1074
1068
struct exfat_dentry * epmov , * epnew ;
1075
- struct super_block * sb = parent_inode -> i_sb ;
1076
1069
struct exfat_entry_set_cache mov_es , new_es ;
1077
1070
1078
1071
num_new_entries = exfat_calc_num_entries (p_uniname );
1079
1072
if (num_new_entries < 0 )
1080
1073
return num_new_entries ;
1081
1074
1082
- ret = exfat_get_dentry_set (& mov_es , sb , p_olddir , oldentry ,
1083
- ES_ALL_ENTRIES );
1075
+ ret = exfat_get_dentry_set_by_ei (& mov_es , parent_inode -> i_sb , ei );
1084
1076
if (ret )
1085
1077
return - EIO ;
1086
1078
@@ -1129,8 +1121,7 @@ static int __exfat_rename(struct inode *old_parent_inode,
1129
1121
struct dentry * new_dentry )
1130
1122
{
1131
1123
int ret ;
1132
- int dentry ;
1133
- struct exfat_chain olddir , newdir ;
1124
+ struct exfat_chain newdir ;
1134
1125
struct exfat_uni_name uni_name ;
1135
1126
struct super_block * sb = old_parent_inode -> i_sb ;
1136
1127
struct exfat_sb_info * sbi = EXFAT_SB (sb );
@@ -1147,11 +1138,6 @@ static int __exfat_rename(struct inode *old_parent_inode,
1147
1138
return - ENOENT ;
1148
1139
}
1149
1140
1150
- exfat_chain_set (& olddir , EXFAT_I (old_parent_inode )-> start_clu ,
1151
- EXFAT_B_TO_CLU_ROUND_UP (i_size_read (old_parent_inode ), sbi ),
1152
- EXFAT_I (old_parent_inode )-> flags );
1153
- dentry = ei -> entry ;
1154
-
1155
1141
/* check whether new dir is existing directory and empty */
1156
1142
if (new_inode ) {
1157
1143
ret = - EIO ;
@@ -1186,21 +1172,18 @@ static int __exfat_rename(struct inode *old_parent_inode,
1186
1172
1187
1173
exfat_set_volume_dirty (sb );
1188
1174
1189
- if (olddir . dir == newdir . dir )
1190
- ret = exfat_rename_file (new_parent_inode , & olddir , dentry ,
1175
+ if (new_parent_inode == old_parent_inode )
1176
+ ret = exfat_rename_file (new_parent_inode , & newdir ,
1191
1177
& uni_name , ei );
1192
1178
else
1193
- ret = exfat_move_file (new_parent_inode , & olddir , dentry ,
1194
- & newdir , & uni_name , ei );
1179
+ ret = exfat_move_file (new_parent_inode , & newdir ,
1180
+ & uni_name , ei );
1195
1181
1196
1182
if (!ret && new_inode ) {
1197
1183
struct exfat_entry_set_cache es ;
1198
- struct exfat_chain * p_dir = & (new_ei -> dir );
1199
- int new_entry = new_ei -> entry ;
1200
1184
1201
1185
/* delete entries of new_dir */
1202
- ret = exfat_get_dentry_set (& es , sb , p_dir , new_entry ,
1203
- ES_ALL_ENTRIES );
1186
+ ret = exfat_get_dentry_set_by_ei (& es , sb , new_ei );
1204
1187
if (ret ) {
1205
1188
ret = - EIO ;
1206
1189
goto del_out ;
0 commit comments