diff options
author | dyson <dyson@FreeBSD.org> | 1996-08-21 21:56:23 +0000 |
---|---|---|
committer | dyson <dyson@FreeBSD.org> | 1996-08-21 21:56:23 +0000 |
commit | 966cbc5d29e66792108ec7d19f731b46d171245b (patch) | |
tree | 07a76a1b97882ad9c1e3805d05f820bc976c60bd /sys/kern/vfs_vnops.c | |
parent | 2d0ae2fc91a319615c14ec10da1161bab780f734 (diff) | |
download | FreeBSD-src-966cbc5d29e66792108ec7d19f731b46d171245b.zip FreeBSD-src-966cbc5d29e66792108ec7d19f731b46d171245b.tar.gz |
Even though this looks like it, this is not a complex code change.
The interface into the "VMIO" system has changed to be more consistant
and robust. Essentially, it is now no longer necessary to call vn_open
to get merged VM/Buffer cache operation, and exceptional conditions
such as merged operation of VBLK devices is simpler and more correct.
This code corrects a potentially large set of problems including the
problems with ktrace output and loaded systems, file create/deletes,
etc.
Most of the changes to NFS are cosmetic and name changes, eliminating
a layer of subroutine calls. The direct calls to vput/vrele have
been re-instituted for better cross platform compatibility.
Reviewed by: davidg
Diffstat (limited to 'sys/kern/vfs_vnops.c')
-rw-r--r-- | sys/kern/vfs_vnops.c | 61 |
1 files changed, 5 insertions, 56 deletions
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 2817da1..abc85c4 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)vfs_vnops.c 8.2 (Berkeley) 1/21/94 - * $Id: vfs_vnops.c,v 1.24 1996/03/02 03:45:05 dyson Exp $ + * $Id: vfs_vnops.c,v 1.25 1996/03/09 06:42:15 dyson Exp $ */ #include <sys/param.h> @@ -162,12 +162,13 @@ vn_open(ndp, fmode, cmode) if (error) goto bad; /* - * this is here for VMIO support + * Make sure that a VM object is created for VMIO support. */ if (vp->v_type == VREG) { - if ((error = vn_vmio_open(vp, p, cred)) != 0) + if ((error = vfs_object_create(vp, p, cred, 1)) != 0) goto bad; } + if (fmode & FWRITE) vp->v_writecount++; return (0); @@ -211,7 +212,7 @@ vn_close(vp, flags, cred, p) if (flags & FWRITE) vp->v_writecount--; error = VOP_CLOSE(vp, flags, cred, p); - vn_vmio_close(vp); + vrele(vp); return (error); } @@ -462,55 +463,3 @@ vn_closefile(fp, p) return (vn_close(((struct vnode *)fp->f_data), fp->f_flag, fp->f_cred, p)); } - -int -vn_vmio_open(vp, p, cred) - struct vnode *vp; - struct proc *p; - struct ucred *cred; -{ - struct vattr vat; - int error; - /* - * this is here for VMIO support - */ - if (vp->v_type == VREG || vp->v_type == VBLK) { -retry: - if ((vp->v_flag & VVMIO) == 0) { - if ((error = VOP_GETATTR(vp, &vat, cred, p)) != 0) - return error; - (void) vnode_pager_alloc(vp, OFF_TO_IDX(round_page(vat.va_size)), 0, 0); - vp->v_flag |= VVMIO; - } else { - vm_object_t object; - if ((object = vp->v_object) && - (object->flags & OBJ_DEAD)) { - VOP_UNLOCK(vp); - tsleep(object, PVM, "vodead", 0); - VOP_LOCK(vp); - goto retry; - } - if (!object) - panic("vn_open: VMIO object missing"); - vm_object_reference(object); - } - } - return 0; -} - -void -vn_vmio_close(vp) - struct vnode *vp; -{ - /* - * this code is here for VMIO support, will eventually - * be in vfs code. - */ - if (vp->v_flag & VVMIO) { - vrele(vp); - if (vp->v_object == NULL) - panic("vn_close: VMIO object missing"); - vm_object_deallocate(vp->v_object); - } else - vrele(vp); -} |