summaryrefslogtreecommitdiff
path: root/fs/xfs/libxfs/xfs_ag.h
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2022-11-01 11:23:12 -0700
committerDarrick J. Wong <djwong@kernel.org>2022-11-09 19:07:13 -0800
commit560f79d15c063fe8a1b4aa5794aff32452a6003e (patch)
tree8b31bb7398db05316db4604ca98471ccd948c106 /fs/xfs/libxfs/xfs_ag.h
parent70bea602cc3be0e19e578e78c07774087699e899 (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/libxfs/xfs_ag.h')
-rw-r--r--fs/xfs/libxfs/xfs_ag.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/xfs/libxfs/xfs_ag.h b/fs/xfs/libxfs/xfs_ag.h
index 191b22b9a35b..d61b07e60802 100644
--- a/fs/xfs/libxfs/xfs_ag.h
+++ b/fs/xfs/libxfs/xfs_ag.h
@@ -112,6 +112,7 @@ int xfs_initialize_perag_data(struct xfs_mount *mp, xfs_agnumber_t agno);
void xfs_free_perag(struct xfs_mount *mp);
struct xfs_perag *xfs_perag_get(struct xfs_mount *mp, xfs_agnumber_t agno);
+struct xfs_perag *xfs_perag_bump(struct xfs_perag *pag);
struct xfs_perag *xfs_perag_get_tag(struct xfs_mount *mp, xfs_agnumber_t agno,
unsigned int tag);
void xfs_perag_put(struct xfs_perag *pag);