xfs: hoist ->create_intent boilerplate to its callsite
authorDarrick J. Wong <djwong@kernel.org>
Thu, 30 Nov 2023 18:58:37 +0000 (10:58 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Thu, 7 Dec 2023 02:45:16 +0000 (18:45 -0800)
Hoist the dirty flag setting code out of each ->create_intent
implementation up to the callsite to reduce boilerplate further.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
fs/xfs/libxfs/xfs_defer.c
fs/xfs/xfs_attr_item.c
fs/xfs/xfs_bmap_item.c
fs/xfs/xfs_extfree_item.c
fs/xfs/xfs_refcount_item.c
fs/xfs/xfs_rmap_item.c

index 6214abedf3940b3f32dd6f56dca83270d2706036..2871c773a12271d737643dfcc23fdf4b97f55272 100644 (file)
@@ -240,6 +240,8 @@ xfs_defer_create_intent(
        if (IS_ERR(lip))
                return PTR_ERR(lip);
 
+       tp->t_flags |= XFS_TRANS_DIRTY;
+       set_bit(XFS_LI_DIRTY, &lip->li_flags);
        dfp->dfp_intent = lip;
        return 1;
 }
index 96438cd38633f61f658b156d4935694a5f6116ea..fc199256fc8e1c1106b97f3cabb8c9dad6aefc27 100644 (file)
@@ -319,9 +319,6 @@ xfs_attr_log_item(
 {
        struct xfs_attri_log_format     *attrp;
 
-       tp->t_flags |= XFS_TRANS_DIRTY;
-       set_bit(XFS_LI_DIRTY, &attrip->attri_item.li_flags);
-
        /*
         * At this point the xfs_attr_intent has been constructed, and we've
         * created the log intent. Fill in the attri log item and log format
index 79d19b5b0e5e0e3cba4497d275c7521bcf9c3ae0..24cf70154a54a5523008cd7b5b8f971f013c217b 100644 (file)
@@ -286,9 +286,6 @@ xfs_bmap_update_log_item(
        uint                            next_extent;
        struct xfs_map_extent           *map;
 
-       tp->t_flags |= XFS_TRANS_DIRTY;
-       set_bit(XFS_LI_DIRTY, &buip->bui_item.li_flags);
-
        /*
         * atomic_inc_return gives us the value after the increment;
         * we want to use it as an array index so we need to subtract 1 from
index 581a70acd1ac36e8735ea02c9fa3a6219f48b256..d07cdc3eb80904ee25d6d1140d1c8d9f9d8a91c7 100644 (file)
@@ -390,9 +390,6 @@ xfs_extent_free_log_item(
        uint                            next_extent;
        struct xfs_extent               *extp;
 
-       tp->t_flags |= XFS_TRANS_DIRTY;
-       set_bit(XFS_LI_DIRTY, &efip->efi_item.li_flags);
-
        /*
         * atomic_inc_return gives us the value after the increment;
         * we want to use it as an array index so we need to subtract 1 from
index 7273f538db2e4e73bef842a89f7cc02ce1d8931b..f604b7e3b77ee5e77ae90d92e112aed82d25198f 100644 (file)
@@ -289,9 +289,6 @@ xfs_refcount_update_log_item(
        uint                            next_extent;
        struct xfs_phys_extent          *pmap;
 
-       tp->t_flags |= XFS_TRANS_DIRTY;
-       set_bit(XFS_LI_DIRTY, &cuip->cui_item.li_flags);
-
        /*
         * atomic_inc_return gives us the value after the increment;
         * we want to use it as an array index so we need to subtract 1 from
index d54fd925b746fda90adc1d6297b69e8109589286..05841548691d46ec661c630639df0d980357b6c1 100644 (file)
@@ -311,9 +311,6 @@ xfs_rmap_update_log_item(
        uint                            next_extent;
        struct xfs_map_extent           *map;
 
-       tp->t_flags |= XFS_TRANS_DIRTY;
-       set_bit(XFS_LI_DIRTY, &ruip->rui_item.li_flags);
-
        /*
         * atomic_inc_return gives us the value after the increment;
         * we want to use it as an array index so we need to subtract 1 from