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_iwalk.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_iwalk.c')
-rw-r--r-- | fs/xfs/xfs_iwalk.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/xfs/xfs_iwalk.c b/fs/xfs/xfs_iwalk.c index 7558486f4937..594ccadb729f 100644 --- a/fs/xfs/xfs_iwalk.c +++ b/fs/xfs/xfs_iwalk.c @@ -670,8 +670,7 @@ xfs_iwalk_threaded( * perag is being handed off to async work, so take another * reference for the async work to release. */ - atomic_inc(&pag->pag_ref); - iwag->pag = pag; + iwag->pag = xfs_perag_bump(pag); iwag->iwalk_fn = iwalk_fn; iwag->data = data; iwag->startino = startino; |