]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blobdiff - libxfs/trans.c
xfs: fold dfops into the transaction
[thirdparty/xfsprogs-dev.git] / libxfs / trans.c
index 9e6883bc432836b6c59d277b856da2a210d9ded0..46ff8b4ae798ec373295ff62eeb85688c9093220 100644 (file)
@@ -147,6 +147,7 @@ xfs_trans_dup(
         */
        ntp->t_mountp = tp->t_mountp;
        INIT_LIST_HEAD(&ntp->t_items);
+       INIT_LIST_HEAD(&ntp->t_dfops);
        ntp->t_firstblock = NULLFSBLOCK;
 
        ASSERT(tp->t_flags & XFS_TRANS_PERM_LOG_RES);
@@ -160,12 +161,8 @@ xfs_trans_dup(
        ntp->t_blk_res = tp->t_blk_res - tp->t_blk_res_used;
        tp->t_blk_res = tp->t_blk_res_used;
 
-       /* copy the dfops pointer if it's external, otherwise move it */
-       xfs_defer_init(ntp, &ntp->t_dfops_internal);
-       if (tp->t_dfops != &tp->t_dfops_internal)
-               ntp->t_dfops = tp->t_dfops;
-       else
-               xfs_defer_move(ntp, tp);
+       /* move deferred ops over to the new tp */
+       xfs_defer_move(ntp, tp);
 
        return ntp;
 }
@@ -264,10 +261,9 @@ libxfs_trans_alloc(
                (flags & XFS_TRANS_NOFS) ? KM_NOFS : KM_SLEEP);
        tp->t_mountp = mp;
        INIT_LIST_HEAD(&tp->t_items);
+       INIT_LIST_HEAD(&tp->t_dfops);
        tp->t_firstblock = NULLFSBLOCK;
 
-       xfs_defer_init(tp, &tp->t_dfops_internal);
-
        error = xfs_trans_reserve(tp, resp, blocks, rtextents);
        if (error) {
                xfs_trans_cancel(tp);
@@ -995,7 +991,7 @@ __xfs_trans_commit(
         * Finish deferred items on final commit. Only permanent transactions
         * should ever have deferred ops.
         */
-       WARN_ON_ONCE(!list_empty(&tp->t_dfops->dop_intake) &&
+       WARN_ON_ONCE(!list_empty(&tp->t_dfops) &&
                     !(tp->t_flags & XFS_TRANS_PERM_LOG_RES));
        if (!regrant && (tp->t_flags & XFS_TRANS_PERM_LOG_RES)) {
                error = xfs_defer_finish_noroll(&tp);