]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blobdiff - libxfs/xfs_attr.c
xfs: remove unnecessary dfops init calls in xattr code
[thirdparty/xfsprogs-dev.git] / libxfs / xfs_attr.c
index 2b6e0cf33d872b65daf1721b25479f7c64047599..c14e8a346fcea41da713123b422b54fed027af58 100644 (file)
@@ -197,7 +197,6 @@ xfs_attr_set(
        struct xfs_mount        *mp = dp->i_mount;
        struct xfs_buf          *leaf_bp = NULL;
        struct xfs_da_args      args;
-       struct xfs_defer_ops    dfops;
        struct xfs_trans_res    tres;
        int                     rsvd = (flags & ATTR_ROOT) != 0;
        int                     error, err2, local;
@@ -246,7 +245,6 @@ xfs_attr_set(
                        rsvd ? XFS_TRANS_RESERVE : 0, &args.trans);
        if (error)
                return error;
-       xfs_defer_init(args.trans, &dfops, &args.trans->t_firstblock);
 
        xfs_ilock(dp, XFS_ILOCK_EXCL);
        error = xfs_trans_reserve_quota_nblks(args.trans, dp, args.total, 0,
@@ -310,18 +308,18 @@ xfs_attr_set(
                 */
                error = xfs_attr_shortform_to_leaf(&args, &leaf_bp);
                if (error)
-                       goto out_defer_cancel;
+                       goto out;
                /*
                 * Prevent the leaf buffer from being unlocked so that a
                 * concurrent AIL push cannot grab the half-baked leaf
                 * buffer and run into problems with the write verifier.
                 */
                xfs_trans_bhold(args.trans, leaf_bp);
-               xfs_defer_bjoin(&dfops, leaf_bp);
-               xfs_defer_ijoin(&dfops, dp);
-               error = xfs_defer_finish(&args.trans, &dfops);
+               xfs_defer_bjoin(args.trans->t_dfops, leaf_bp);
+               xfs_defer_ijoin(args.trans->t_dfops, dp);
+               error = xfs_defer_finish(&args.trans, args.trans->t_dfops);
                if (error)
-                       goto out_defer_cancel;
+                       goto out;
 
                /*
                 * Commit the leaf transformation.  We'll need another (linked)
@@ -361,8 +359,6 @@ xfs_attr_set(
 
        return error;
 
-out_defer_cancel:
-       xfs_defer_cancel(&dfops);
 out:
        if (leaf_bp)
                xfs_trans_brelse(args.trans, leaf_bp);
@@ -384,7 +380,6 @@ xfs_attr_remove(
 {
        struct xfs_mount        *mp = dp->i_mount;
        struct xfs_da_args      args;
-       struct xfs_defer_ops    dfops;
        int                     error;
 
        XFS_STATS_INC(mp, xs_attr_remove);
@@ -417,7 +412,6 @@ xfs_attr_remove(
                        &args.trans);
        if (error)
                return error;
-       xfs_defer_init(args.trans, &dfops, &args.trans->t_firstblock);
 
        xfs_ilock(dp, XFS_ILOCK_EXCL);
        /*
@@ -588,8 +582,6 @@ xfs_attr_leaf_addname(
                 * Commit that transaction so that the node_addname() call
                 * can manage its own transactions.
                 */
-               xfs_defer_init(args->trans, args->trans->t_dfops,
-                              &args->trans->t_firstblock);
                error = xfs_attr3_leaf_to_node(args);
                if (error)
                        goto out_defer_cancel;
@@ -678,8 +670,6 @@ 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, args->trans->t_dfops,
-                                      &args->trans->t_firstblock);
                        error = xfs_attr3_leaf_to_shortform(bp, args, forkoff);
                        /* bp is gone due to xfs_da_shrink_inode */
                        if (error)
@@ -744,8 +734,6 @@ 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, args->trans->t_dfops,
-                              &args->trans->t_firstblock);
                error = xfs_attr3_leaf_to_shortform(bp, args, forkoff);
                /* bp is gone due to xfs_da_shrink_inode */
                if (error)
@@ -874,8 +862,6 @@ restart:
                         */
                        xfs_da_state_free(state);
                        state = NULL;
-                       xfs_defer_init(args->trans, args->trans->t_dfops,
-                                      &args->trans->t_firstblock);
                        error = xfs_attr3_leaf_to_node(args);
                        if (error)
                                goto out_defer_cancel;
@@ -902,8 +888,6 @@ restart:
                 * in the index/blkno/rmtblkno/rmtblkcnt fields and
                 * in the index2/blkno2/rmtblkno2/rmtblkcnt2 fields.
                 */
-               xfs_defer_init(args->trans, args->trans->t_dfops,
-                              &args->trans->t_firstblock);
                error = xfs_da3_split(state);
                if (error)
                        goto out_defer_cancel;
@@ -1001,8 +985,6 @@ restart:
                 * Check to see if the tree needs to be collapsed.
                 */
                if (retval && (state->path.active > 1)) {
-                       xfs_defer_init(args->trans, args->trans->t_dfops,
-                                      &args->trans->t_firstblock);
                        error = xfs_da3_join(state);
                        if (error)
                                goto out_defer_cancel;
@@ -1127,8 +1109,6 @@ 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, args->trans->t_dfops,
-                              &args->trans->t_firstblock);
                error = xfs_da3_join(state);
                if (error)
                        goto out_defer_cancel;
@@ -1160,8 +1140,6 @@ xfs_attr_node_removename(
                        goto out;
 
                if ((forkoff = xfs_attr_shortform_allfit(bp, dp))) {
-                       xfs_defer_init(args->trans, args->trans->t_dfops,
-                                      &args->trans->t_firstblock);
                        error = xfs_attr3_leaf_to_shortform(bp, args, forkoff);
                        /* bp is gone due to xfs_da_shrink_inode */
                        if (error)