Add vrecyclel() to vrecycle() a vnode with the interlock already held.

Obtained from:	OneFS
Sponsored by:	Dell EMC Isilon
MFC after:	2 weeks
This commit is contained in:
bdrewery 2016-10-06 18:09:22 +00:00
parent 612be51044
commit f3e00c4570
2 changed files with 17 additions and 3 deletions

View File

@ -3160,15 +3160,28 @@ vrecycle(struct vnode *vp)
{
int recycled;
ASSERT_VOP_ELOCKED(vp, "vrecycle");
VI_LOCK(vp);
recycled = vrecyclel(vp);
VI_UNLOCK(vp);
return (recycled);
}
/*
* vrecycle, with the vp interlock held.
*/
int
vrecyclel(struct vnode *vp)
{
int recycled;
ASSERT_VOP_ELOCKED(vp, __func__);
ASSERT_VI_LOCKED(vp, __func__);
CTR2(KTR_VFS, "%s: vp %p", __func__, vp);
recycled = 0;
VI_LOCK(vp);
if (vp->v_usecount == 0) {
recycled = 1;
vgonel(vp);
}
VI_UNLOCK(vp);
return (recycled);
}

View File

@ -659,6 +659,7 @@ int vtruncbuf(struct vnode *vp, struct ucred *cred, off_t length,
void vunref(struct vnode *);
void vn_printf(struct vnode *vp, const char *fmt, ...) __printflike(2,3);
int vrecycle(struct vnode *vp);
int vrecyclel(struct vnode *vp);
int vn_bmap_seekhole(struct vnode *vp, u_long cmd, off_t *off,
struct ucred *cred);
int vn_close(struct vnode *vp,