@@ -2117,63 +2117,6 @@ xfs_sort_inodes(
2117
2117
}
2118
2118
}
2119
2119
2120
- static int
2121
- xfs_finish_rename (
2122
- struct xfs_trans * tp )
2123
- {
2124
- /*
2125
- * If this is a synchronous mount, make sure that the rename transaction
2126
- * goes to disk before returning to the user.
2127
- */
2128
- if (xfs_has_wsync (tp -> t_mountp ) || xfs_has_dirsync (tp -> t_mountp ))
2129
- xfs_trans_set_sync (tp );
2130
-
2131
- return xfs_trans_commit (tp );
2132
- }
2133
-
2134
- /*
2135
- * xfs_cross_rename()
2136
- *
2137
- * responsible for handling RENAME_EXCHANGE flag in renameat2() syscall
2138
- */
2139
- STATIC int
2140
- xfs_cross_rename (
2141
- struct xfs_trans * tp ,
2142
- struct xfs_inode * dp1 ,
2143
- struct xfs_name * name1 ,
2144
- struct xfs_inode * ip1 ,
2145
- struct xfs_parent_args * ip1_ppargs ,
2146
- struct xfs_inode * dp2 ,
2147
- struct xfs_name * name2 ,
2148
- struct xfs_inode * ip2 ,
2149
- struct xfs_parent_args * ip2_ppargs ,
2150
- int spaceres )
2151
- {
2152
- struct xfs_dir_update du1 = {
2153
- .dp = dp1 ,
2154
- .name = name1 ,
2155
- .ip = ip1 ,
2156
- .ppargs = ip1_ppargs ,
2157
- };
2158
- struct xfs_dir_update du2 = {
2159
- .dp = dp2 ,
2160
- .name = name2 ,
2161
- .ip = ip2 ,
2162
- .ppargs = ip2_ppargs ,
2163
- };
2164
- int error ;
2165
-
2166
- error = xfs_dir_exchange_children (tp , & du1 , & du2 , spaceres );
2167
- if (error )
2168
- goto out_trans_abort ;
2169
-
2170
- return xfs_finish_rename (tp );
2171
-
2172
- out_trans_abort :
2173
- xfs_trans_cancel (tp );
2174
- return error ;
2175
- }
2176
-
2177
2120
/*
2178
2121
* xfs_rename_alloc_whiteout()
2179
2122
*
@@ -2366,11 +2309,11 @@ xfs_rename(
2366
2309
2367
2310
/* RENAME_EXCHANGE is unique from here on. */
2368
2311
if (flags & RENAME_EXCHANGE ) {
2369
- error = xfs_cross_rename (tp , src_dp , src_name , src_ip ,
2370
- du_src . ppargs , target_dp , target_name ,
2371
- target_ip , du_tgt . ppargs , spaceres );
2372
- nospace_error = 0 ;
2373
- goto out_unlock ;
2312
+ error = xfs_dir_exchange_children (tp , & du_src , & du_tgt ,
2313
+ spaceres );
2314
+ if ( error )
2315
+ goto out_trans_cancel ;
2316
+ goto out_commit ;
2374
2317
}
2375
2318
2376
2319
/*
@@ -2448,7 +2391,15 @@ xfs_rename(
2448
2391
VFS_I (du_wip .ip )-> i_state &= ~I_LINKABLE ;
2449
2392
}
2450
2393
2451
- error = xfs_finish_rename (tp );
2394
+ out_commit :
2395
+ /*
2396
+ * If this is a synchronous mount, make sure that the rename
2397
+ * transaction goes to disk before returning to the user.
2398
+ */
2399
+ if (xfs_has_wsync (tp -> t_mountp ) || xfs_has_dirsync (tp -> t_mountp ))
2400
+ xfs_trans_set_sync (tp );
2401
+
2402
+ error = xfs_trans_commit (tp );
2452
2403
nospace_error = 0 ;
2453
2404
goto out_unlock ;
2454
2405
0 commit comments