xfs: Add trace points for per-ag refcount debugging.
Uninline xfs_perag_{get,put} so that tracepoints can be inserted into them to speed debugging of reference count problems. Signed-off-by: Dave Chinner <david@fromorbit.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Alex Elder <aelder@sgi.com>
This commit is contained in:
parent
aed3bb90ab
commit
0fa800fbd5
4 changed files with 65 additions and 23 deletions
|
@ -200,6 +200,38 @@ xfs_uuid_unmount(
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* Reference counting access wrappers to the perag structures.
|
||||
*/
|
||||
struct xfs_perag *
|
||||
xfs_perag_get(struct xfs_mount *mp, xfs_agnumber_t agno)
|
||||
{
|
||||
struct xfs_perag *pag;
|
||||
int ref = 0;
|
||||
|
||||
spin_lock(&mp->m_perag_lock);
|
||||
pag = radix_tree_lookup(&mp->m_perag_tree, agno);
|
||||
if (pag) {
|
||||
ASSERT(atomic_read(&pag->pag_ref) >= 0);
|
||||
/* catch leaks in the positive direction during testing */
|
||||
ASSERT(atomic_read(&pag->pag_ref) < 1000);
|
||||
ref = atomic_inc_return(&pag->pag_ref);
|
||||
}
|
||||
spin_unlock(&mp->m_perag_lock);
|
||||
trace_xfs_perag_get(mp, agno, ref, _RET_IP_);
|
||||
return pag;
|
||||
}
|
||||
|
||||
void
|
||||
xfs_perag_put(struct xfs_perag *pag)
|
||||
{
|
||||
int ref;
|
||||
|
||||
ASSERT(atomic_read(&pag->pag_ref) > 0);
|
||||
ref = atomic_dec_return(&pag->pag_ref);
|
||||
trace_xfs_perag_put(pag->pag_mount, pag->pag_agno, ref, _RET_IP_);
|
||||
}
|
||||
|
||||
/*
|
||||
* Free up the resources associated with a mount structure. Assume that
|
||||
* the structure was initially zeroed, so we can tell which fields got
|
||||
|
@ -433,6 +465,8 @@ xfs_initialize_perag(
|
|||
kmem_free(pag);
|
||||
return -EEXIST;
|
||||
}
|
||||
pag->pag_agno = index;
|
||||
pag->pag_mount = mp;
|
||||
spin_unlock(&mp->m_perag_lock);
|
||||
radix_tree_preload_end();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue