svn commit: r358444 - head/sys/vm
Jeff Roberson
jeff at FreeBSD.org
Fri Feb 28 20:30:55 UTC 2020
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."));
}
More information about the svn-src-all
mailing list