[PATCH 09/67] xfs: hoist xfs_trans_add_item calls to defer ops functions

Darrick J. Wong
2024-03-13T01:55:23Z

From: Darrick J. Wong <djwong@kernel.org>

Source kernel commit: b28852a5bd08654634e4e32eb072fba14c5fae26

Remove even more repeated boilerplate.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
libxfs/xfs_defer.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libxfs/xfs_defer.c b/libxfs/xfs_defer.c
index 42e1c9c0c9a4..27f9938a08d7 100644
--- a/libxfs/xfs_defer.c
+++ b/libxfs/xfs_defer.c
@@ -208,6 +208,7 @@ xfs_defer_create_done(
return;

tp->t_flags |= XFS_TRANS_HAS_INTENT_DONE;
+ xfs_trans_add_item(tp, lip);
set_bit(XFS_LI_DIRTY, &lip->li_flags);
dfp->dfp_done = lip;
}
@@ -236,6 +237,7 @@ xfs_defer_create_intent(
return PTR_ERR(lip);

tp->t_flags |= XFS_TRANS_DIRTY;
+ xfs_trans_add_item(tp, lip);
set_bit(XFS_LI_DIRTY, &lip->li_flags);
dfp->dfp_intent = lip;
return 1;
@@ -501,8 +503,10 @@ xfs_defer_relog(
xfs_defer_create_done(*tpp, dfp);
lip = xfs_trans_item_relog(dfp->dfp_intent, dfp->dfp_done,
*tpp);
- if (lip)
+ if (lip) {
+ xfs_trans_add_item(*tpp, lip);
set_bit(XFS_LI_DIRTY, &lip->li_flags);
+ }
dfp->dfp_done = NULL;
dfp->dfp_intent = lip;
}