Author: mjg
Date: Fri Aug 30 00:30:03 2019
New Revision: 351617
URL: https://svnweb.freebsd.org/changeset/base/351617

Log:
  nullfs: use VOP_NEED_INACTIVE
  
  Reviewed by:  kib
  Tested by:    pho (previous version)
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/fs/nullfs/null_vnops.c

Modified: head/sys/fs/nullfs/null_vnops.c
==============================================================================
--- head/sys/fs/nullfs/null_vnops.c     Fri Aug 30 00:05:04 2019        
(r351616)
+++ head/sys/fs/nullfs/null_vnops.c     Fri Aug 30 00:30:03 2019        
(r351617)
@@ -732,14 +732,13 @@ null_unlock(struct vop_unlock_args *ap)
  * ours.
  */
 static int
-null_inactive(struct vop_inactive_args *ap __unused)
+null_want_recycle(struct vnode *vp)
 {
-       struct vnode *vp, *lvp;
+       struct vnode *lvp;
        struct null_node *xp;
        struct mount *mp;
        struct null_mount *xmp;
 
-       vp = ap->a_vp;
        xp = VTONULL(vp);
        lvp = NULLVPTOLOWERVP(vp);
        mp = vp->v_mount;
@@ -753,12 +752,31 @@ null_inactive(struct vop_inactive_args *ap __unused)
                 * deleted, then free up the vnode so as not to tie up
                 * the lower vnodes.
                 */
+               return (1);
+       }
+       return (0);
+}
+
+static int
+null_inactive(struct vop_inactive_args *ap)
+{
+       struct vnode *vp;
+
+       vp = ap->a_vp;
+       if (null_want_recycle(vp)) {
                vp->v_object = NULL;
                vrecycle(vp);
        }
        return (0);
 }
 
+static int
+null_need_inactive(struct vop_need_inactive_args *ap)
+{
+
+       return (null_want_recycle(ap->a_vp));
+}
+
 /*
  * Now, the nullfs vnode and, due to the sharing lock, the lower
  * vnode, are exclusively locked, and we shall destroy the null vnode.
@@ -907,7 +925,7 @@ struct vop_vector null_vnodeops = {
        .vop_getattr =          null_getattr,
        .vop_getwritemount =    null_getwritemount,
        .vop_inactive =         null_inactive,
-       .vop_need_inactive =    vop_stdneed_inactive,
+       .vop_need_inactive =    null_need_inactive,
        .vop_islocked =         vop_stdislocked,
        .vop_lock1 =            null_lock,
        .vop_lookup =           null_lookup,
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to