diff options
author | alc <alc@FreeBSD.org> | 2002-06-22 07:28:06 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2002-06-22 07:28:06 +0000 |
commit | b81ea3e3e56beba1059bab00cba957c257d43be5 (patch) | |
tree | 8dfb9d5f566595da7c5579ebf0c5ea6018c86ca2 /sys/vm/vnode_pager.c | |
parent | 98aa149b31a7845e8d1f7935bdb2b28e695a85d6 (diff) | |
download | FreeBSD-src-b81ea3e3e56beba1059bab00cba957c257d43be5.zip FreeBSD-src-b81ea3e3e56beba1059bab00cba957c257d43be5.tar.gz |
o Replace GIANT_REQUIRED in vnode_pager_alloc() by the acquisition and
release of Giant. (Annotate as MPSAFE.)
o Also, in vnode_pager_alloc(), remove an unnecessary re-initialization
of struct vm_object::flags and move a statement that is duplicated
in both branches of an if-else.
Diffstat (limited to 'sys/vm/vnode_pager.c')
-rw-r--r-- | sys/vm/vnode_pager.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c index 4292a53..32660d3 100644 --- a/sys/vm/vnode_pager.c +++ b/sys/vm/vnode_pager.c @@ -102,6 +102,8 @@ vnode_pager_init(void) /* * Allocate (or lookup) pager for a vnode. * Handle is a vnode pointer. + * + * MPSAFE */ vm_object_t vnode_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, @@ -110,8 +112,6 @@ vnode_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, vm_object_t object; struct vnode *vp; - GIANT_REQUIRED; - /* * Pageout to vnode, no can do yet. */ @@ -120,6 +120,7 @@ vnode_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, vp = (struct vnode *) handle; + mtx_lock(&Giant); /* * Prevent race condition when allocating the object. This * can happen with NFS vnodes since the nfsnode isn't locked. @@ -147,23 +148,21 @@ vnode_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, * And an object of the appropriate size */ object = vm_object_allocate(OBJT_VNODE, OFF_TO_IDX(round_page(size))); - object->flags = 0; object->un_pager.vnp.vnp_size = size; object->handle = handle; vp->v_object = object; - vp->v_usecount++; } else { object->ref_count++; - vp->v_usecount++; } - + vp->v_usecount++; vp->v_flag &= ~VOLOCK; if (vp->v_flag & VOWANT) { vp->v_flag &= ~VOWANT; wakeup(vp); } + mtx_unlock(&Giant); return (object); } |