diff options
author | Brian Foster <bfoster@redhat.com> | 2018-07-11 22:26:19 -0700 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2018-07-11 22:26:19 -0700 |
commit | bcd2c9f33559764e0d306e226a8aa88bc2e1e6fb (patch) | |
tree | 9fbdeaca5d91293ee5ed2604443893276b3d029e /fs/xfs/libxfs/xfs_attr.c | |
parent | d5669ed58175f85d2c13e914c5c4e2bd3647d893 (diff) |
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/libxfs/xfs_attr.c')
-rw-r--r-- | fs/xfs/libxfs/xfs_attr.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index a14ab9b2669e..8a7e2c0308c4 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/libxfs/xfs_attr.c @@ -253,8 +253,7 @@ xfs_attr_set( rsvd ? XFS_TRANS_RESERVE : 0, &args.trans); if (error) return error; - xfs_defer_init(&dfops, &firstblock); - args.trans->t_dfops = &dfops; + xfs_defer_init(args.trans, &dfops, &firstblock); xfs_ilock(dp, XFS_ILOCK_EXCL); error = xfs_trans_reserve_quota_nblks(args.trans, dp, args.total, 0, @@ -428,8 +427,7 @@ xfs_attr_remove( &args.trans); if (error) return error; - xfs_defer_init(&dfops, &firstblock); - args.trans->t_dfops = &dfops; + xfs_defer_init(args.trans, &dfops, &firstblock); xfs_ilock(dp, XFS_ILOCK_EXCL); /* @@ -600,7 +598,7 @@ xfs_attr_leaf_addname( * Commit that transaction so that the node_addname() call * can manage its own transactions. */ - xfs_defer_init(args->trans->t_dfops, args->firstblock); + xfs_defer_init(NULL, args->trans->t_dfops, args->firstblock); error = xfs_attr3_leaf_to_node(args); if (error) goto out_defer_cancel; @@ -689,7 +687,8 @@ xfs_attr_leaf_addname( * If the result is small enough, shrink it all into the inode. */ if ((forkoff = xfs_attr_shortform_allfit(bp, dp))) { - xfs_defer_init(args->trans->t_dfops, args->firstblock); + xfs_defer_init(NULL, args->trans->t_dfops, + args->firstblock); error = xfs_attr3_leaf_to_shortform(bp, args, forkoff); /* bp is gone due to xfs_da_shrink_inode */ if (error) @@ -754,7 +753,7 @@ xfs_attr_leaf_removename( * If the result is small enough, shrink it all into the inode. */ if ((forkoff = xfs_attr_shortform_allfit(bp, dp))) { - xfs_defer_init(args->trans->t_dfops, args->firstblock); + xfs_defer_init(NULL, args->trans->t_dfops, args->firstblock); error = xfs_attr3_leaf_to_shortform(bp, args, forkoff); /* bp is gone due to xfs_da_shrink_inode */ if (error) @@ -883,7 +882,8 @@ restart: */ xfs_da_state_free(state); state = NULL; - xfs_defer_init(args->trans->t_dfops, args->firstblock); + xfs_defer_init(NULL, args->trans->t_dfops, + args->firstblock); error = xfs_attr3_leaf_to_node(args); if (error) goto out_defer_cancel; @@ -910,7 +910,7 @@ restart: * in the index/blkno/rmtblkno/rmtblkcnt fields and * in the index2/blkno2/rmtblkno2/rmtblkcnt2 fields. */ - xfs_defer_init(args->trans->t_dfops, args->firstblock); + xfs_defer_init(NULL, args->trans->t_dfops, args->firstblock); error = xfs_da3_split(state); if (error) goto out_defer_cancel; @@ -1008,7 +1008,8 @@ restart: * Check to see if the tree needs to be collapsed. */ if (retval && (state->path.active > 1)) { - xfs_defer_init(args->trans->t_dfops, args->firstblock); + xfs_defer_init(NULL, args->trans->t_dfops, + args->firstblock); error = xfs_da3_join(state); if (error) goto out_defer_cancel; @@ -1133,7 +1134,7 @@ xfs_attr_node_removename( * Check to see if the tree needs to be collapsed. */ if (retval && (state->path.active > 1)) { - xfs_defer_init(args->trans->t_dfops, args->firstblock); + xfs_defer_init(NULL, args->trans->t_dfops, args->firstblock); error = xfs_da3_join(state); if (error) goto out_defer_cancel; @@ -1165,7 +1166,8 @@ xfs_attr_node_removename( goto out; if ((forkoff = xfs_attr_shortform_allfit(bp, dp))) { - xfs_defer_init(args->trans->t_dfops, args->firstblock); + xfs_defer_init(NULL, args->trans->t_dfops, + args->firstblock); error = xfs_attr3_leaf_to_shortform(bp, args, forkoff); /* bp is gone due to xfs_da_shrink_inode */ if (error) |