summaryrefslogtreecommitdiff
path: root/fs/xfs/libxfs/xfs_ag.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/libxfs/xfs_ag.c')
-rw-r--r--fs/xfs/libxfs/xfs_ag.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/xfs/libxfs/xfs_ag.c b/fs/xfs/libxfs/xfs_ag.c
index 8de4143a5899..fed965831f2d 100644
--- a/fs/xfs/libxfs/xfs_ag.c
+++ b/fs/xfs/libxfs/xfs_ag.c
@@ -57,6 +57,21 @@ xfs_perag_get(
return pag;
}
+/* Get our own reference to a perag, given an existing active reference. */
+struct xfs_perag *
+xfs_perag_bump(
+ struct xfs_perag *pag)
+{
+ if (!atomic_inc_not_zero(&pag->pag_ref)) {
+ ASSERT(0);
+ return NULL;
+ }
+
+ trace_xfs_perag_bump(pag->pag_mount, pag->pag_agno,
+ atomic_read(&pag->pag_ref), _RET_IP_);
+ return pag;
+}
+
/*
* search from @first to find the next perag with the given tag set.
*/