Changeset View
Changeset View
Standalone View
Standalone View
head/sys/kern/vfs_subr.c
Show First 20 Lines • Show All 3,040 Lines • ▼ Show 20 Lines | |||||
#ifdef INVARIANTS | #ifdef INVARIANTS | ||||
int old = atomic_fetchadd_int(&vp->v_usecount, 1); | int old = atomic_fetchadd_int(&vp->v_usecount, 1); | ||||
VNASSERT(old > 0, vp, ("%s: wrong use count %d", __func__, old)); | VNASSERT(old > 0, vp, ("%s: wrong use count %d", __func__, old)); | ||||
#else | #else | ||||
refcount_acquire(&vp->v_usecount); | refcount_acquire(&vp->v_usecount); | ||||
#endif | #endif | ||||
} | } | ||||
void | |||||
vrefactn(struct vnode *vp, u_int n) | |||||
{ | |||||
CTR2(KTR_VFS, "%s: vp %p", __func__, vp); | |||||
#ifdef INVARIANTS | |||||
int old = atomic_fetchadd_int(&vp->v_usecount, n); | |||||
VNASSERT(old > 0, vp, ("%s: wrong use count %d", __func__, old)); | |||||
#else | |||||
atomic_add_int(&vp->v_usecount, n); | |||||
#endif | |||||
} | |||||
/* | /* | ||||
* Return reference count of a vnode. | * Return reference count of a vnode. | ||||
* | * | ||||
* The results of this call are only guaranteed when some mechanism is used to | * The results of this call are only guaranteed when some mechanism is used to | ||||
* stop other processes from gaining references to the vnode. This may be the | * stop other processes from gaining references to the vnode. This may be the | ||||
* case if the caller holds the only reference. This is also useful when stale | * case if the caller holds the only reference. This is also useful when stale | ||||
* data is acceptable as race conditions may be accounted for by some other | * data is acceptable as race conditions may be accounted for by some other | ||||
* means. | * means. | ||||
▲ Show 20 Lines • Show All 3,333 Lines • Show Last 20 Lines |