Author: jeff
Date: Fri Feb 28 20:30:53 2020
New Revision: 358444
URL: https://svnweb.freebsd.org/changeset/base/358444

Log:
  Simplify vref() code in object_reference.  The local temporary is no longer
  necessary.  Fix formatting errors.
  
  Reported by:  mjg
  Discussed with:       kib

Modified:
  head/sys/vm/vm_object.c

Modified: head/sys/vm/vm_object.c
==============================================================================
--- head/sys/vm/vm_object.c     Fri Feb 28 20:29:53 2020        (r358443)
+++ head/sys/vm/vm_object.c     Fri Feb 28 20:30:53 2020        (r358444)
@@ -484,7 +484,6 @@ vm_object_allocate_anon(vm_pindex_t size, vm_object_t 
 static void
 vm_object_reference_vnode(vm_object_t object)
 {
-       struct vnode *vp;
        u_int old;
 
        /*
@@ -494,10 +493,8 @@ vm_object_reference_vnode(vm_object_t object)
        if (!refcount_acquire_if_gt(&object->ref_count, 0)) {
                VM_OBJECT_RLOCK(object);
                old = refcount_acquire(&object->ref_count);
-               if (object->type == OBJT_VNODE && old == 0) {
-                       vp = object->handle;
-                       vref(vp);
-               }
+               if (object->type == OBJT_VNODE && old == 0)
+                       vref(object->handle);
                VM_OBJECT_RUNLOCK(object);
        }
 }
@@ -532,13 +529,12 @@ vm_object_reference(vm_object_t object)
 void
 vm_object_reference_locked(vm_object_t object)
 {
-       struct vnode *vp;
        u_int old;
 
        VM_OBJECT_ASSERT_LOCKED(object);
        old = refcount_acquire(&object->ref_count);
-       if (object->type == OBJT_VNODE && old == 0) {
-               vp = object->handle; vref(vp); }
+       if (object->type == OBJT_VNODE && old == 0)
+               vref(object->handle);
        KASSERT((object->flags & OBJ_DEAD) == 0,
            ("vm_object_reference: Referenced dead object."));
 }
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to