diff options
author | Darrick J. Wong <djwong@kernel.org> | 2022-11-01 11:23:12 -0700 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2022-11-09 19:07:13 -0800 |
commit | 560f79d15c063fe8a1b4aa5794aff32452a6003e (patch) | |
tree | 8b31bb7398db05316db4604ca98471ccd948c106 /fs/xfs/xfs_iunlink_item.c | |
parent | 70bea602cc3be0e19e578e78c07774087699e899 (diff) |
xfs: create a function to duplicate an active perag referencepass-perag-refs_2022-11-09
There a few object constructor functions throughout XFS where a caller
provides an active perag reference and the constructor wants to give the
new object its own active reference. Replace the open-coded logic with
a common function to do this instead of open-coding atomic_inc logic.
This new function adds a few safeguards -- it checks that there's at
least one active reference to the perag structure passed in, and it
records the refcount bump in the ftrace information. This makes it much
easier to debug refcounting problems.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Diffstat (limited to 'fs/xfs/xfs_iunlink_item.c')
-rw-r--r-- | fs/xfs/xfs_iunlink_item.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/fs/xfs/xfs_iunlink_item.c b/fs/xfs/xfs_iunlink_item.c index 43005ce8bd48..5024a59f0c75 100644 --- a/fs/xfs/xfs_iunlink_item.c +++ b/fs/xfs/xfs_iunlink_item.c @@ -168,9 +168,7 @@ xfs_iunlink_log_inode( iup->ip = ip; iup->next_agino = next_agino; iup->old_agino = ip->i_next_unlinked; - - atomic_inc(&pag->pag_ref); - iup->pag = pag; + iup->pag = xfs_perag_bump(pag); xfs_trans_add_item(tp, &iup->item); tp->t_flags |= XFS_TRANS_DIRTY; |