diff options
author | Darrick J. Wong <djwong@kernel.org> | 2022-07-14 11:15:05 -0700 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2022-10-14 14:16:59 -0700 |
commit | 553557b88d283a2a20baf0d0ec23b03756e9e9df (patch) | |
tree | 69b3fa47ca3510a2213246c4148dbfa715ce77e5 | |
parent | 38c66c0fa6778cd51305c2a6f8d9b94bcdeeb09d (diff) |
xfs: get rid of cross_renameinode-refactor_2022-10-14
Get rid of the largely pointless xfs_cross_rename now that we've
refactored its parent.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
-rw-r--r-- | fs/xfs/xfs_inode.c | 72 |
1 files changed, 15 insertions, 57 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index b297653b2d27..17974de7f3e3 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c @@ -2159,54 +2159,6 @@ xfs_rename_call_nlink_hooks( ((void)0) #endif /* CONFIG_XFS_LIVE_HOOKS */ -static int -xfs_finish_rename( - struct xfs_trans *tp) -{ - /* - * If this is a synchronous mount, make sure that the rename transaction - * goes to disk before returning to the user. - */ - if (xfs_has_wsync(tp->t_mountp) || xfs_has_dirsync(tp->t_mountp)) - xfs_trans_set_sync(tp); - - return xfs_trans_commit(tp); -} - -/* - * xfs_cross_rename() - * - * responsible for handling RENAME_EXCHANGE flag in renameat2() syscall - */ -STATIC int -xfs_cross_rename( - struct xfs_trans *tp, - struct xfs_inode *dp1, - struct xfs_name *name1, - struct xfs_inode *ip1, - struct xfs_inode *dp2, - struct xfs_name *name2, - struct xfs_inode *ip2, - int spaceres) -{ - int error; - - error = xfs_dir_exchange(tp, dp1, name1, ip1, dp2, name2, ip2, - spaceres); - if (error) - goto out_trans_abort; - - if (xfs_hooks_switched_on(&xfs_nlinks_hooks_switch)) - xfs_rename_call_nlink_hooks(dp1, name1, ip1, dp2, name2, ip2, - NULL, RENAME_EXCHANGE); - - return xfs_finish_rename(tp); - -out_trans_abort: - xfs_trans_cancel(tp); - return error; -} - /* * xfs_rename_alloc_whiteout() * @@ -2359,12 +2311,6 @@ retry: goto out_trans_cancel; } - /* RENAME_EXCHANGE is unique from here on. */ - if (flags & RENAME_EXCHANGE) - return xfs_cross_rename(tp, src_dp, src_name, src_ip, - target_dp, target_name, target_ip, - spaceres); - /* * Try to reserve quota to handle an expansion of the target directory. * We'll allow the rename to continue in reservationless mode if we hit @@ -2416,8 +2362,13 @@ retry: } } - error = xfs_dir_rename(tp, src_dp, src_name, src_ip, target_dp, - target_name, target_ip, spaceres, wip); + if (flags & RENAME_EXCHANGE) + error = xfs_dir_exchange(tp, src_dp, src_name, src_ip, + target_dp, target_name, target_ip, spaceres); + else + error = xfs_dir_rename(tp, src_dp, src_name, src_ip, + target_dp, target_name, target_ip, spaceres, + wip); if (error) goto out_trans_cancel; @@ -2434,7 +2385,14 @@ retry: xfs_rename_call_nlink_hooks(src_dp, src_name, src_ip, target_dp, target_name, target_ip, wip, flags); - error = xfs_finish_rename(tp); + /* + * If this is a synchronous mount, make sure that the rename + * transaction goes to disk before returning to the user. + */ + if (xfs_has_wsync(tp->t_mountp) || xfs_has_dirsync(tp->t_mountp)) + xfs_trans_set_sync(tp); + + error = xfs_trans_commit(tp); if (wip) xfs_irele(wip); return error; |