xfs: factor out xfs_defer_pending_abort
authorLong Li <leo.lilong@huawei.com>
Mon, 31 Jul 2023 12:46:17 +0000 (20:46 +0800)
committerChandan Babu R <chandanbabu@kernel.org>
Mon, 13 Nov 2023 03:38:33 +0000 (09:08 +0530)
Factor out xfs_defer_pending_abort() from xfs_defer_trans_abort(), which
not use transaction parameter, so it can be used after the transaction
life cycle.

Signed-off-by: Long Li <leo.lilong@huawei.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>
fs/xfs/libxfs/xfs_defer.c

index bcfb6a4..88388e1 100644 (file)
@@ -245,21 +245,18 @@ xfs_defer_create_intents(
        return ret;
 }
 
-/* Abort all the intents that were committed. */
 STATIC void
-xfs_defer_trans_abort(
-       struct xfs_trans                *tp,
-       struct list_head                *dop_pending)
+xfs_defer_pending_abort(
+       struct xfs_mount                *mp,
+       struct list_head                *dop_list)
 {
        struct xfs_defer_pending        *dfp;
        const struct xfs_defer_op_type  *ops;
 
-       trace_xfs_defer_trans_abort(tp, _RET_IP_);
-
        /* Abort intent items that don't have a done item. */
-       list_for_each_entry(dfp, dop_pending, dfp_list) {
+       list_for_each_entry(dfp, dop_list, dfp_list) {
                ops = defer_op_types[dfp->dfp_type];
-               trace_xfs_defer_pending_abort(tp->t_mountp, dfp);
+               trace_xfs_defer_pending_abort(mp, dfp);
                if (dfp->dfp_intent && !dfp->dfp_done) {
                        ops->abort_intent(dfp->dfp_intent);
                        dfp->dfp_intent = NULL;
@@ -267,6 +264,16 @@ xfs_defer_trans_abort(
        }
 }
 
+/* Abort all the intents that were committed. */
+STATIC void
+xfs_defer_trans_abort(
+       struct xfs_trans                *tp,
+       struct list_head                *dop_pending)
+{
+       trace_xfs_defer_trans_abort(tp, _RET_IP_);
+       xfs_defer_pending_abort(tp->t_mountp, dop_pending);
+}
+
 /*
  * Capture resources that the caller said not to release ("held") when the
  * transaction commits.  Caller is responsible for zero-initializing @dres.