svn commit: r306774 - in head/sys: kern sys

Bryan Drewery bdrewery at FreeBSD.org
Thu Oct 6 18:09:24 UTC 2016


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,


More information about the svn-src-all mailing list