diff options
author | Brian Foster <bfoster@redhat.com> | 2018-07-12 08:26:19 +0300 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2018-07-12 08:26:19 +0300 |
commit | bcd2c9f33559764e0d306e226a8aa88bc2e1e6fb (patch) | |
tree | 9fbdeaca5d91293ee5ed2604443893276b3d029e /fs/xfs/xfs_inode.c | |
parent | d5669ed58175f85d2c13e914c5c4e2bd3647d893 (diff) | |
download | linux-bcd2c9f33559764e0d306e226a8aa88bc2e1e6fb.tar.xz |
xfs: refactor dfops init to attach to transaction
Most callers of xfs_defer_init() immediately attach the dfops
structure to a transaction. Add a transaction parameter to eliminate
much of this boilerplate code. This also helps self-document the
fact that many codepaths now expect a dfops pointer implicitly via
xfs_trans->t_dfops.
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/xfs/xfs_inode.c')
-rw-r--r-- | fs/xfs/xfs_inode.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index f456df2e1394..04e17234e5d7 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c @@ -1195,8 +1195,7 @@ xfs_create( xfs_ilock(dp, XFS_ILOCK_EXCL | XFS_ILOCK_PARENT); unlock_dp_on_error = true; - xfs_defer_init(&dfops, &first_block); - tp->t_dfops = &dfops; + xfs_defer_init(tp, &dfops, &first_block); /* * Reserve disk quota and the inode. @@ -1451,8 +1450,7 @@ xfs_link( goto error_return; } - xfs_defer_init(&dfops, &first_block); - tp->t_dfops = &dfops; + xfs_defer_init(tp, &dfops, &first_block); /* * Handle initial link state of O_TMPFILE inode @@ -1584,8 +1582,7 @@ xfs_itruncate_extents_flags( ASSERT(first_unmap_block < last_block); unmap_len = last_block - first_unmap_block + 1; while (!done) { - xfs_defer_init(&dfops, &first_block); - tp->t_dfops = &dfops; + xfs_defer_init(tp, &dfops, &first_block); error = xfs_bunmapi(tp, ip, first_unmap_block, unmap_len, flags, XFS_ITRUNC_MAX_EXTENTS, &first_block, &done); @@ -1816,8 +1813,7 @@ xfs_inactive_ifree( xfs_ilock(ip, XFS_ILOCK_EXCL); xfs_trans_ijoin(tp, ip, 0); - xfs_defer_init(&dfops, &first_block); - tp->t_dfops = &dfops; + xfs_defer_init(tp, &dfops, &first_block); error = xfs_ifree(tp, ip); if (error) { /* @@ -2661,8 +2657,7 @@ xfs_remove( if (error) goto out_trans_cancel; - xfs_defer_init(&dfops, &first_block); - tp->t_dfops = &dfops; + xfs_defer_init(tp, &dfops, &first_block); error = xfs_dir_removename(tp, dp, name, ip->i_ino, &first_block, resblks); if (error) { @@ -3026,8 +3021,7 @@ xfs_rename( goto out_trans_cancel; } - xfs_defer_init(&dfops, &first_block); - tp->t_dfops = &dfops; + xfs_defer_init(tp, &dfops, &first_block); /* RENAME_EXCHANGE is unique from here on. */ if (flags & RENAME_EXCHANGE) |