Index: vm/vm_mmap.c =================================================================== RCS file: /home/ncvs/src/sys/vm/vm_mmap.c,v retrieving revision 1.117 diff -u -r1.117 vm_mmap.c --- vm/vm_mmap.c 2000/11/18 21:01:04 1.117 +++ vm/vm_mmap.c 2001/03/13 06:09:07 @@ -300,7 +300,8 @@ if (fp->f_flag & FPOSIXSHM) flags |= MAP_NOSYNC; vp = (struct vnode *) fp->f_data; - if (vp->v_type != VREG && vp->v_type != VCHR) + if (vp->v_type != VREG && vp->v_type != VCHR && + !vn_isdisk(vp, NULL)) return (EINVAL); if (vp->v_type == VREG) { /* @@ -338,10 +339,8 @@ else disablexworkaround = suser(p); if (vp->v_type == VCHR && disablexworkaround && - (flags & (MAP_PRIVATE|MAP_COPY))) { - error = EINVAL; - goto done; - } + (flags & (MAP_PRIVATE|MAP_COPY)) && + !vn_isdisk(vp, NULL)) /* * Ensure that file and memory protections are * compatible. Note that we only worry about @@ -369,7 +368,8 @@ */ if ((flags & MAP_SHARED) != 0 || - (vp->v_type == VCHR && disablexworkaround)) { + (vp->v_type == VCHR && disablexworkaround && + !vn_isdisk(vp, NULL))) { if ((fp->f_flag & FWRITE) != 0) { struct vattr va; if ((error = @@ -1092,7 +1092,7 @@ foff = 0; } else { vp = (struct vnode *) handle; - if (vp->v_type == VCHR) { + if (vp->v_type == VCHR && !vn_isdisk(vp, NULL)) { type = OBJT_DEVICE; handle = (void *)(intptr_t)vp->v_rdev; } else { Index: kern/vfs_bio.c =================================================================== RCS file: /home/ncvs/src/sys/kern/vfs_bio.c,v retrieving revision 1.273 diff -u -r1.273 vfs_bio.c --- kern/vfs_bio.c 2001/02/28 04:13:07 1.273 +++ kern/vfs_bio.c 2001/03/13 06:09:07 @@ -85,7 +85,6 @@ * but the code is intricate enough already. */ vm_page_t bogus_page; -int vmiodirenable = FALSE; int runningbufspace; static vm_offset_t bogus_offset; @@ -133,8 +132,6 @@ &getnewbufcalls, 0, ""); SYSCTL_INT(_vfs, OID_AUTO, getnewbufrestarts, CTLFLAG_RW, &getnewbufrestarts, 0, ""); -SYSCTL_INT(_vfs, OID_AUTO, vmiodirenable, CTLFLAG_RW, - &vmiodirenable, 0, ""); SYSCTL_INT(_vfs, OID_AUTO, bufdefragcnt, CTLFLAG_RW, &bufdefragcnt, 0, ""); SYSCTL_INT(_vfs, OID_AUTO, buffreekvacnt, CTLFLAG_RW, Index: kern/vfs_subr.c =================================================================== RCS file: /home/ncvs/src/sys/kern/vfs_subr.c,v retrieving revision 1.305 diff -u -r1.305 vfs_subr.c --- kern/vfs_subr.c 2001/02/23 20:05:57 1.305 +++ kern/vfs_subr.c 2001/03/13 06:09:07 @@ -95,6 +95,10 @@ static unsigned long numvnodes; SYSCTL_LONG(_debug, OID_AUTO, numvnodes, CTLFLAG_RD, &numvnodes, 0, ""); +static int vmiodirenable = FALSE; +SYSCTL_INT(_vfs, OID_AUTO, vmiodirenable, CTLFLAG_RW, + &vmiodirenable, 0, ""); + /* * Conversion tables for conversion from vnode types to inode formats * and back. @@ -2993,6 +3000,22 @@ if (errp != NULL) *errp = 0; return (1); +} + +/* + * Check if a vnode should be done with VMIO. + */ +int +vn_canvmio(vp) + struct vnode *vp; +{ + if (!vp) + return (FALSE); + if (vp->v_type == VREG || (vmiodirenable && vp->v_type == VDIR)) + return (TRUE); + if (vn_isdisk(vp, NULL)) + return TRUE; + return FALSE; } /* Index: sys/vnode.h =================================================================== RCS file: /home/ncvs/src/sys/sys/vnode.h,v retrieving revision 1.138 diff -u -r1.138 vnode.h --- sys/vnode.h 2001/03/06 17:28:24 1.138 +++ sys/vnode.h 2001/03/13 06:09:07 @@ -507,20 +508,6 @@ #define VOFFSET(OP) (VDESC(OP)->vdesc_offset) /* - * VMIO support inline - */ - -extern int vmiodirenable; - -static __inline int -vn_canvmio(struct vnode *vp) -{ - if (vp && (vp->v_type == VREG || (vmiodirenable && vp->v_type == VDIR))) - return(TRUE); - return(FALSE); -} - -/* * Finally, include the default set of vnode operations. */ #include "vnode_if.h" @@ -588,6 +575,7 @@ int flags, struct ucred *cred, struct proc *p)); void vn_finished_write __P((struct mount *mp)); int vn_isdisk __P((struct vnode *vp, int *errp)); +int vn_canvmio __P((struct vnode *vp)); int vn_lock __P((struct vnode *vp, int flags, struct proc *p)); #ifdef DEBUG_LOCKS int debug_vn_lock __P((struct vnode *vp, int flags, struct proc *p,