From 38e47abc4afd48fe0e6d234875e3cf8724eaa92f Mon Sep 17 00:00:00 2001 From: alc Date: Mon, 15 Sep 2003 05:58:27 +0000 Subject: [PATCH] Eliminate the use of Giant from vm_object_reference(). --- sys/vm/vm_object.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index fa3cf6f3f0ef..7b0dcc81b589 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -361,22 +361,22 @@ vm_object_allocate(objtype_t type, vm_pindex_t size) void vm_object_reference(vm_object_t object) { + struct vnode *vp; + int flags; + if (object == NULL) return; - if (object != kernel_object && - object != kmem_object) - mtx_lock(&Giant); VM_OBJECT_LOCK(object); object->ref_count++; - VM_OBJECT_UNLOCK(object); if (object->type == OBJT_VNODE) { - while (vget((struct vnode *) object->handle, LK_RETRY, curthread)) { - printf("vm_object_reference: delay in getting object\n"); - } - } - if (object != kernel_object && - object != kmem_object) - mtx_unlock(&Giant); + vp = object->handle; + VI_LOCK(vp); + VM_OBJECT_UNLOCK(object); + for (flags = LK_INTERLOCK; vget(vp, flags, curthread); + flags = 0) + printf("vm_object_reference: delay in vget\n"); + } else + VM_OBJECT_UNLOCK(object); } /*