@@ -311,6 +311,9 @@ static int exfat_find_empty_entry(struct inode *inode,
311
311
ei -> hint_femp .eidx = EXFAT_HINT_NONE ;
312
312
}
313
313
314
+ exfat_chain_set (p_dir , ei -> start_clu ,
315
+ EXFAT_B_TO_CLU (i_size_read (inode ), sbi ), ei -> flags );
316
+
314
317
while ((dentry = exfat_search_empty_slot (sb , & hint_femp , p_dir ,
315
318
num_entries , es )) < 0 ) {
316
319
if (dentry == - EIO )
@@ -386,14 +389,11 @@ static int exfat_find_empty_entry(struct inode *inode,
386
389
* Zero if it was successful; otherwise nonzero.
387
390
*/
388
391
static int __exfat_resolve_path (struct inode * inode , const unsigned char * path ,
389
- struct exfat_chain * p_dir , struct exfat_uni_name * p_uniname ,
390
- int lookup )
392
+ struct exfat_uni_name * p_uniname , int lookup )
391
393
{
392
394
int namelen ;
393
395
int lossy = NLS_NAME_NO_LOSSY ;
394
396
struct super_block * sb = inode -> i_sb ;
395
- struct exfat_sb_info * sbi = EXFAT_SB (sb );
396
- struct exfat_inode_info * ei = EXFAT_I (inode );
397
397
int pathlen = strlen (path );
398
398
399
399
/*
@@ -432,24 +432,19 @@ static int __exfat_resolve_path(struct inode *inode, const unsigned char *path,
432
432
if ((lossy && !lookup ) || !namelen )
433
433
return (lossy & NLS_NAME_OVERLEN ) ? - ENAMETOOLONG : - EINVAL ;
434
434
435
- exfat_chain_set (p_dir , ei -> start_clu ,
436
- EXFAT_B_TO_CLU (i_size_read (inode ), sbi ), ei -> flags );
437
-
438
435
return 0 ;
439
436
}
440
437
441
438
static inline int exfat_resolve_path (struct inode * inode ,
442
- const unsigned char * path , struct exfat_chain * dir ,
443
- struct exfat_uni_name * uni )
439
+ const unsigned char * path , struct exfat_uni_name * uni )
444
440
{
445
- return __exfat_resolve_path (inode , path , dir , uni , 0 );
441
+ return __exfat_resolve_path (inode , path , uni , 0 );
446
442
}
447
443
448
444
static inline int exfat_resolve_path_for_lookup (struct inode * inode ,
449
- const unsigned char * path , struct exfat_chain * dir ,
450
- struct exfat_uni_name * uni )
445
+ const unsigned char * path , struct exfat_uni_name * uni )
451
446
{
452
- return __exfat_resolve_path (inode , path , dir , uni , 1 );
447
+ return __exfat_resolve_path (inode , path , uni , 1 );
453
448
}
454
449
455
450
static inline loff_t exfat_make_i_pos (struct exfat_dir_entry * info )
@@ -471,7 +466,7 @@ static int exfat_add_entry(struct inode *inode, const char *path,
471
466
int clu_size = 0 ;
472
467
unsigned int start_clu = EXFAT_FREE_CLUSTER ;
473
468
474
- ret = exfat_resolve_path (inode , path , p_dir , & uniname );
469
+ ret = exfat_resolve_path (inode , path , & uniname );
475
470
if (ret )
476
471
goto out ;
477
472
@@ -602,10 +597,13 @@ static int exfat_find(struct inode *dir, struct qstr *qname,
602
597
return - ENOENT ;
603
598
604
599
/* check the validity of directory name in the given pathname */
605
- ret = exfat_resolve_path_for_lookup (dir , qname -> name , & cdir , & uni_name );
600
+ ret = exfat_resolve_path_for_lookup (dir , qname -> name , & uni_name );
606
601
if (ret )
607
602
return ret ;
608
603
604
+ exfat_chain_set (& cdir , ei -> start_clu ,
605
+ EXFAT_B_TO_CLU (i_size_read (dir ), sbi ), ei -> flags );
606
+
609
607
/* check the validation of hint_stat and initialize it if required */
610
608
if (ei -> version != (inode_peek_iversion_raw (dir ) & 0xffffffff )) {
611
609
ei -> hint_stat .clu = cdir .dir ;
@@ -990,8 +988,7 @@ static int exfat_rmdir(struct inode *dir, struct dentry *dentry)
990
988
}
991
989
992
990
static int exfat_rename_file (struct inode * parent_inode ,
993
- struct exfat_chain * p_dir , struct exfat_uni_name * p_uniname ,
994
- struct exfat_inode_info * ei )
991
+ struct exfat_uni_name * p_uniname , struct exfat_inode_info * ei )
995
992
{
996
993
int ret , num_new_entries ;
997
994
struct exfat_dentry * epold , * epnew ;
@@ -1016,9 +1013,10 @@ static int exfat_rename_file(struct inode *parent_inode,
1016
1013
1017
1014
if (old_es .num_entries < num_new_entries ) {
1018
1015
int newentry ;
1016
+ struct exfat_chain dir ;
1019
1017
1020
- newentry = exfat_find_empty_entry (parent_inode , p_dir , num_new_entries ,
1021
- & new_es );
1018
+ newentry = exfat_find_empty_entry (parent_inode , & dir ,
1019
+ num_new_entries , & new_es );
1022
1020
if (newentry < 0 ) {
1023
1021
ret = newentry ; /* -EIO or -ENOSPC */
1024
1022
goto put_old_es ;
@@ -1042,7 +1040,7 @@ static int exfat_rename_file(struct inode *parent_inode,
1042
1040
goto put_old_es ;
1043
1041
1044
1042
exfat_remove_entries (parent_inode , & old_es , ES_IDX_FILE );
1045
- ei -> dir = * p_dir ;
1043
+ ei -> dir = dir ;
1046
1044
ei -> entry = newentry ;
1047
1045
} else {
1048
1046
if (exfat_get_entry_type (epold ) == TYPE_FILE ) {
@@ -1061,12 +1059,12 @@ static int exfat_rename_file(struct inode *parent_inode,
1061
1059
}
1062
1060
1063
1061
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 )
1062
+ struct exfat_uni_name * p_uniname , struct exfat_inode_info * ei )
1066
1063
{
1067
1064
int ret , newentry , num_new_entries ;
1068
1065
struct exfat_dentry * epmov , * epnew ;
1069
1066
struct exfat_entry_set_cache mov_es , new_es ;
1067
+ struct exfat_chain newdir ;
1070
1068
1071
1069
num_new_entries = exfat_calc_num_entries (p_uniname );
1072
1070
if (num_new_entries < 0 )
@@ -1076,8 +1074,8 @@ static int exfat_move_file(struct inode *parent_inode,
1076
1074
if (ret )
1077
1075
return - EIO ;
1078
1076
1079
- newentry = exfat_find_empty_entry (parent_inode , p_newdir , num_new_entries ,
1080
- & new_es );
1077
+ newentry = exfat_find_empty_entry (parent_inode , & newdir ,
1078
+ num_new_entries , & new_es );
1081
1079
if (newentry < 0 ) {
1082
1080
ret = newentry ; /* -EIO or -ENOSPC */
1083
1081
goto put_mov_es ;
@@ -1098,9 +1096,7 @@ static int exfat_move_file(struct inode *parent_inode,
1098
1096
exfat_init_ext_entry (& new_es , num_new_entries , p_uniname );
1099
1097
exfat_remove_entries (parent_inode , & mov_es , ES_IDX_FILE );
1100
1098
1101
- exfat_chain_set (& ei -> dir , p_newdir -> dir , p_newdir -> size ,
1102
- p_newdir -> flags );
1103
-
1099
+ ei -> dir = newdir ;
1104
1100
ei -> entry = newentry ;
1105
1101
1106
1102
ret = exfat_put_dentry_set (& new_es , IS_DIRSYNC (parent_inode ));
@@ -1121,7 +1117,6 @@ static int __exfat_rename(struct inode *old_parent_inode,
1121
1117
struct dentry * new_dentry )
1122
1118
{
1123
1119
int ret ;
1124
- struct exfat_chain newdir ;
1125
1120
struct exfat_uni_name uni_name ;
1126
1121
struct super_block * sb = old_parent_inode -> i_sb ;
1127
1122
struct exfat_sb_info * sbi = EXFAT_SB (sb );
@@ -1165,19 +1160,16 @@ static int __exfat_rename(struct inode *old_parent_inode,
1165
1160
}
1166
1161
1167
1162
/* check the validity of directory name in the given new pathname */
1168
- ret = exfat_resolve_path (new_parent_inode , new_path , & newdir ,
1169
- & uni_name );
1163
+ ret = exfat_resolve_path (new_parent_inode , new_path , & uni_name );
1170
1164
if (ret )
1171
1165
goto out ;
1172
1166
1173
1167
exfat_set_volume_dirty (sb );
1174
1168
1175
1169
if (new_parent_inode == old_parent_inode )
1176
- ret = exfat_rename_file (new_parent_inode , & newdir ,
1177
- & uni_name , ei );
1170
+ ret = exfat_rename_file (new_parent_inode , & uni_name , ei );
1178
1171
else
1179
- ret = exfat_move_file (new_parent_inode , & newdir ,
1180
- & uni_name , ei );
1172
+ ret = exfat_move_file (new_parent_inode , & uni_name , ei );
1181
1173
1182
1174
if (!ret && new_inode ) {
1183
1175
struct exfat_entry_set_cache es ;
0 commit comments