]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: move ->iop_relog to struct xfs_defer_op_type
authorDarrick J. Wong <djwong@kernel.org>
Mon, 15 Apr 2024 23:07:32 +0000 (16:07 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Wed, 17 Apr 2024 21:06:24 +0000 (14:06 -0700)
Source kernel commit: a49c708f9a445457f6a5905732081871234f61c6

The only log items that need relogging are the ones created for deferred
work operations, and the only part of the code base that relogs log
items is the deferred work machinery.  Move the function pointers.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Bill O'Donnell <bodonnel@redhat.com>
include/xfs_trans.h
libxfs/xfs_defer.c
libxfs/xfs_defer.h

index ee250d521118d0a202e2859edccc11f4836e60c1..ab298ccfe5565e9e26609492a46e3e3d72098e3d 100644 (file)
@@ -158,7 +158,6 @@ libxfs_trans_read_buf(
 }
 
 #define xfs_log_item_in_current_chkpt(lip)     (false)
-#define xfs_trans_item_relog(lip, dontcare, tp)        (NULL)
 
 /* Contorted mess to make gcc shut up about unused vars. */
 #define xlog_grant_push_threshold(log, need)    \
index 27f9938a08d70cad1452f602eddd8fae615f644c..29ec0bd8138c30d80cd90477e68b22b31866a6e4 100644 (file)
@@ -453,6 +453,25 @@ xfs_defer_cancel_list(
                xfs_defer_pending_cancel_work(mp, dfp);
 }
 
+static inline void
+xfs_defer_relog_intent(
+       struct xfs_trans                *tp,
+       struct xfs_defer_pending        *dfp)
+{
+       struct xfs_log_item             *lip;
+       const struct xfs_defer_op_type  *ops = defer_op_types[dfp->dfp_type];
+
+       xfs_defer_create_done(tp, dfp);
+
+       lip = ops->relog_intent(tp, dfp->dfp_intent, dfp->dfp_done);
+       if (lip) {
+               xfs_trans_add_item(tp, lip);
+               set_bit(XFS_LI_DIRTY, &lip->li_flags);
+       }
+       dfp->dfp_done = NULL;
+       dfp->dfp_intent = lip;
+}
+
 /*
  * Prevent a log intent item from pinning the tail of the log by logging a
  * done item to release the intent item; and then log a new intent item.
@@ -471,8 +490,6 @@ xfs_defer_relog(
        ASSERT((*tpp)->t_flags & XFS_TRANS_PERM_LOG_RES);
 
        list_for_each_entry(dfp, dfops, dfp_list) {
-               struct xfs_log_item     *lip;
-
                /*
                 * If the log intent item for this deferred op is not a part of
                 * the current log checkpoint, relog the intent item to keep
@@ -500,15 +517,7 @@ xfs_defer_relog(
                trace_xfs_defer_relog_intent((*tpp)->t_mountp, dfp);
                XFS_STATS_INC((*tpp)->t_mountp, defer_relog);
 
-               xfs_defer_create_done(*tpp, dfp);
-               lip = xfs_trans_item_relog(dfp->dfp_intent, dfp->dfp_done,
-                               *tpp);
-               if (lip) {
-                       xfs_trans_add_item(*tpp, lip);
-                       set_bit(XFS_LI_DIRTY, &lip->li_flags);
-               }
-               dfp->dfp_done = NULL;
-               dfp->dfp_intent = lip;
+               xfs_defer_relog_intent(*tpp, dfp);
        }
 
        if ((*tpp)->t_flags & XFS_TRANS_DIRTY)
index ef86a7f9b059508280d42994924210205b3f876d..78d6dcd1af2cd6649fa56e228abb5a2c3b1369f3 100644 (file)
@@ -59,6 +59,9 @@ struct xfs_defer_op_type {
        void (*cancel_item)(struct list_head *item);
        int (*recover_work)(struct xfs_defer_pending *dfp,
                            struct list_head *capture_list);
+       struct xfs_log_item *(*relog_intent)(struct xfs_trans *tp,
+                       struct xfs_log_item *intent,
+                       struct xfs_log_item *done_item);
        unsigned int            max_items;
 };