Skip to content

Commit 47d4d59

Browse files
author
Darrick J. Wong
committed
xfs: get rid of trivial rename helpers
Get rid of the largely pointless xfs_cross_rename and xfs_finish_rename now that we've refactored its parent. Signed-off-by: Darrick J. Wong <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]>
1 parent 62bbf50 commit 47d4d59

File tree

1 file changed

+14
-63
lines changed

1 file changed

+14
-63
lines changed

fs/xfs/xfs_inode.c

Lines changed: 14 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -2117,63 +2117,6 @@ xfs_sort_inodes(
21172117
}
21182118
}
21192119

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-
21772120
/*
21782121
* xfs_rename_alloc_whiteout()
21792122
*
@@ -2366,11 +2309,11 @@ xfs_rename(
23662309

23672310
/* RENAME_EXCHANGE is unique from here on. */
23682311
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;
23742317
}
23752318

23762319
/*
@@ -2448,7 +2391,15 @@ xfs_rename(
24482391
VFS_I(du_wip.ip)->i_state &= ~I_LINKABLE;
24492392
}
24502393

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);
24522403
nospace_error = 0;
24532404
goto out_unlock;
24542405

0 commit comments

Comments
 (0)