Skip to content

Commit

Permalink
xfs: clean out XFS_LI_DIRTY setting boilerplate from ->iop_relog
Browse files Browse the repository at this point in the history
Hoist this dirty flag setting to the ->iop_relog callsite to reduce
boilerplate.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
  • Loading branch information
Darrick J. Wong committed Dec 7, 2023
1 parent bd3a88f commit 3e0958b
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 7 deletions.
9 changes: 7 additions & 2 deletions fs/xfs/libxfs/xfs_defer.c
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,8 @@ 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
Expand Down Expand Up @@ -502,9 +504,12 @@ xfs_defer_relog(
XFS_STATS_INC((*tpp)->t_mountp, defer_relog);

xfs_defer_create_done(*tpp, dfp);
dfp->dfp_intent = xfs_trans_item_relog(dfp->dfp_intent,
dfp->dfp_done, *tpp);
lip = xfs_trans_item_relog(dfp->dfp_intent, dfp->dfp_done,
*tpp);
if (lip)
set_bit(XFS_LI_DIRTY, &lip->li_flags);
dfp->dfp_done = NULL;
dfp->dfp_intent = lip;
}

if ((*tpp)->t_flags & XFS_TRANS_DIRTY)
Expand Down
1 change: 0 additions & 1 deletion fs/xfs/xfs_attr_item.c
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,6 @@ xfs_attri_item_relog(
new_attrp->alfi_attr_filter = old_attrp->alfi_attr_filter;

xfs_trans_add_item(tp, &new_attrip->attri_item);
set_bit(XFS_LI_DIRTY, &new_attrip->attri_item.li_flags);

return &new_attrip->attri_item;
}
Expand Down
2 changes: 1 addition & 1 deletion fs/xfs/xfs_bmap_item.c
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ xfs_bui_item_relog(
memcpy(buip->bui_format.bui_extents, map, count * sizeof(*map));
atomic_set(&buip->bui_next_extent, count);
xfs_trans_add_item(tp, &buip->bui_item);
set_bit(XFS_LI_DIRTY, &buip->bui_item.li_flags);

return &buip->bui_item;
}

Expand Down
2 changes: 1 addition & 1 deletion fs/xfs/xfs_extfree_item.c
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ xfs_efi_item_relog(
memcpy(efip->efi_format.efi_extents, extp, count * sizeof(*extp));
atomic_set(&efip->efi_next_extent, count);
xfs_trans_add_item(tp, &efip->efi_item);
set_bit(XFS_LI_DIRTY, &efip->efi_item.li_flags);

return &efip->efi_item;
}

Expand Down
2 changes: 1 addition & 1 deletion fs/xfs/xfs_refcount_item.c
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ xfs_cui_item_relog(
memcpy(cuip->cui_format.cui_extents, pmap, count * sizeof(*pmap));
atomic_set(&cuip->cui_next_extent, count);
xfs_trans_add_item(tp, &cuip->cui_item);
set_bit(XFS_LI_DIRTY, &cuip->cui_item.li_flags);

return &cuip->cui_item;
}

Expand Down
2 changes: 1 addition & 1 deletion fs/xfs/xfs_rmap_item.c
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ xfs_rui_item_relog(
memcpy(ruip->rui_format.rui_extents, map, count * sizeof(*map));
atomic_set(&ruip->rui_next_extent, count);
xfs_trans_add_item(tp, &ruip->rui_item);
set_bit(XFS_LI_DIRTY, &ruip->rui_item.li_flags);

return &ruip->rui_item;
}

Expand Down

0 comments on commit 3e0958b

Please sign in to comment.