Date: Thu, 6 Oct 2016 18:09:23 +0000 (UTC) From: Bryan Drewery <bdrewery@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r306774 - in head/sys: kern sys Message-ID: <201610061809.u96I9Nv5003541@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: bdrewery Date: Thu Oct 6 18:09:22 2016 New Revision: 306774 URL: https://svnweb.freebsd.org/changeset/base/306774 Log: Add vrecyclel() to vrecycle() a vnode with the interlock already held. Obtained from: OneFS Sponsored by: Dell EMC Isilon MFC after: 2 weeks Modified: head/sys/kern/vfs_subr.c head/sys/sys/vnode.h Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Thu Oct 6 18:05:25 2016 (r306773) +++ head/sys/kern/vfs_subr.c Thu Oct 6 18:09:22 2016 (r306774) @@ -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); } Modified: head/sys/sys/vnode.h ============================================================================== --- head/sys/sys/vnode.h Thu Oct 6 18:05:25 2016 (r306773) +++ head/sys/sys/vnode.h Thu Oct 6 18:09:22 2016 (r306774) @@ -659,6 +659,7 @@ int vtruncbuf(struct vnode *vp, struct u 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,
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201610061809.u96I9Nv5003541>