Add sysctl and support code to allow directories to be VMIO'd. The default

setting for the sysctl is OFF, which is the historical operation.

Submitted by:	dillon
This commit is contained in:
alc 1999-07-26 06:25:53 +00:00
parent 922ea3fe71
commit 743eeab638
8 changed files with 34 additions and 17 deletions

View File

@ -11,7 +11,7 @@
* 2. Absolutely no warranty of function or purpose is made by the author * 2. Absolutely no warranty of function or purpose is made by the author
* John S. Dyson. * John S. Dyson.
* *
* $Id: vfs_bio.c,v 1.222 1999/07/08 17:58:55 mckusick Exp $ * $Id: vfs_bio.c,v 1.223 1999/07/09 16:41:19 peter Exp $
*/ */
/* /*
@ -83,6 +83,7 @@ static void buf_daemon __P((void));
*/ */
vm_page_t bogus_page; vm_page_t bogus_page;
int runningbufspace; int runningbufspace;
int vmiodirenable = FALSE;
static vm_offset_t bogus_offset; static vm_offset_t bogus_offset;
static int bufspace, maxbufspace, vmiospace, static int bufspace, maxbufspace, vmiospace,
@ -136,6 +137,8 @@ SYSCTL_INT(_vfs, OID_AUTO, getnewbufcalls, CTLFLAG_RW,
&getnewbufcalls, 0, ""); &getnewbufcalls, 0, "");
SYSCTL_INT(_vfs, OID_AUTO, getnewbufrestarts, CTLFLAG_RW, SYSCTL_INT(_vfs, OID_AUTO, getnewbufrestarts, CTLFLAG_RW,
&getnewbufrestarts, 0, ""); &getnewbufrestarts, 0, "");
SYSCTL_INT(_vfs, OID_AUTO, vmiodirenable, CTLFLAG_RW,
&vmiodirenable, 0, "");
static int bufhashmask; static int bufhashmask;

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95 * @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95
* $Id: vfs_subr.c,v 1.212 1999/07/19 09:37:59 phk Exp $ * $Id: vfs_subr.c,v 1.213 1999/07/20 09:47:44 phk Exp $
*/ */
/* /*
@ -2622,12 +2622,12 @@ vfs_object_create(vp, p, cred)
vm_object_t object; vm_object_t object;
int error = 0; int error = 0;
if ((vp->v_type != VREG) && (vp->v_type != VBLK)) if (vp->v_type != VBLK && vn_canvmio(vp) == FALSE)
return 0; return 0;
retry: retry:
if ((object = vp->v_object) == NULL) { if ((object = vp->v_object) == NULL) {
if (vp->v_type == VREG) { if (vp->v_type == VREG || vp->v_type == VDIR) {
if ((error = VOP_GETATTR(vp, &vat, cred, p)) != 0) if ((error = VOP_GETATTR(vp, &vat, cred, p)) != 0)
goto retn; goto retn;
object = vnode_pager_alloc(vp, vat.va_size, 0, 0); object = vnode_pager_alloc(vp, vat.va_size, 0, 0);

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94 * @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94
* $Id: vfs_syscalls.c,v 1.122 1999/04/27 11:16:25 phk Exp $ * $Id: vfs_syscalls.c,v 1.123 1999/04/28 11:37:09 phk Exp $
*/ */
/* For 4.3 integer FS ID compatibility */ /* For 4.3 integer FS ID compatibility */
@ -1020,7 +1020,7 @@ open(p, uap)
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
fp->f_flag |= FHASLOCK; fp->f_flag |= FHASLOCK;
} }
if ((vp->v_type == VREG) && (vp->v_object == NULL)) if (vn_canvmio(vp) == TRUE && vp->v_object == NULL)
vfs_object_create(vp, p, p->p_ucred); vfs_object_create(vp, p, p->p_ucred);
VOP_UNLOCK(vp, 0, p); VOP_UNLOCK(vp, 0, p);
p->p_retval[0] = indx; p->p_retval[0] = indx;

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* @(#)vfs_lookup.c 8.4 (Berkeley) 2/16/94 * @(#)vfs_lookup.c 8.4 (Berkeley) 2/16/94
* $Id: vfs_lookup.c,v 1.32 1999/01/27 21:49:58 dillon Exp $ * $Id: vfs_lookup.c,v 1.33 1999/01/28 00:57:47 dillon Exp $
*/ */
#include "opt_ktrace.h" #include "opt_ktrace.h"
@ -163,7 +163,7 @@ namei(ndp)
else else
cnp->cn_flags |= HASBUF; cnp->cn_flags |= HASBUF;
if (ndp->ni_vp && ndp->ni_vp->v_type == VREG && if (vn_canvmio(ndp->ni_vp) == TRUE &&
(cnp->cn_nameiop != DELETE) && (cnp->cn_nameiop != DELETE) &&
((cnp->cn_flags & (NOOBJ|LOCKLEAF)) == ((cnp->cn_flags & (NOOBJ|LOCKLEAF)) ==
LOCKLEAF)) LOCKLEAF))
@ -687,7 +687,7 @@ relookup(dvp, vpp, cnp)
if (!wantparent) if (!wantparent)
vrele(dvp); vrele(dvp);
if (dp->v_type == VREG && if (vn_canvmio(dp) == TRUE &&
((cnp->cn_flags & (NOOBJ|LOCKLEAF)) == LOCKLEAF)) ((cnp->cn_flags & (NOOBJ|LOCKLEAF)) == LOCKLEAF))
vfs_object_create(dp, cnp->cn_proc, cnp->cn_cred); vfs_object_create(dp, cnp->cn_proc, cnp->cn_cred);

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95 * @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95
* $Id: vfs_subr.c,v 1.212 1999/07/19 09:37:59 phk Exp $ * $Id: vfs_subr.c,v 1.213 1999/07/20 09:47:44 phk Exp $
*/ */
/* /*
@ -2622,12 +2622,12 @@ vfs_object_create(vp, p, cred)
vm_object_t object; vm_object_t object;
int error = 0; int error = 0;
if ((vp->v_type != VREG) && (vp->v_type != VBLK)) if (vp->v_type != VBLK && vn_canvmio(vp) == FALSE)
return 0; return 0;
retry: retry:
if ((object = vp->v_object) == NULL) { if ((object = vp->v_object) == NULL) {
if (vp->v_type == VREG) { if (vp->v_type == VREG || vp->v_type == VDIR) {
if ((error = VOP_GETATTR(vp, &vat, cred, p)) != 0) if ((error = VOP_GETATTR(vp, &vat, cred, p)) != 0)
goto retn; goto retn;
object = vnode_pager_alloc(vp, vat.va_size, 0, 0); object = vnode_pager_alloc(vp, vat.va_size, 0, 0);

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94 * @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94
* $Id: vfs_syscalls.c,v 1.122 1999/04/27 11:16:25 phk Exp $ * $Id: vfs_syscalls.c,v 1.123 1999/04/28 11:37:09 phk Exp $
*/ */
/* For 4.3 integer FS ID compatibility */ /* For 4.3 integer FS ID compatibility */
@ -1020,7 +1020,7 @@ open(p, uap)
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
fp->f_flag |= FHASLOCK; fp->f_flag |= FHASLOCK;
} }
if ((vp->v_type == VREG) && (vp->v_object == NULL)) if (vn_canvmio(vp) == TRUE && vp->v_object == NULL)
vfs_object_create(vp, p, p->p_ucred); vfs_object_create(vp, p, p->p_ucred);
VOP_UNLOCK(vp, 0, p); VOP_UNLOCK(vp, 0, p);
p->p_retval[0] = indx; p->p_retval[0] = indx;

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* @(#)vfs_vnops.c 8.2 (Berkeley) 1/21/94 * @(#)vfs_vnops.c 8.2 (Berkeley) 1/21/94
* $Id: vfs_vnops.c,v 1.69 1999/07/02 16:29:15 phk Exp $ * $Id: vfs_vnops.c,v 1.70 1999/07/08 06:05:56 mckusick Exp $
*/ */
#include <sys/param.h> #include <sys/param.h>
@ -171,7 +171,7 @@ vn_open(ndp, fmode, cmode)
/* /*
* Make sure that a VM object is created for VMIO support. * Make sure that a VM object is created for VMIO support.
*/ */
if (vp->v_type == VREG) { if (vn_canvmio(vp) == TRUE) {
if ((error = vfs_object_create(vp, p, cred)) != 0) if ((error = vfs_object_create(vp, p, cred)) != 0)
goto bad; goto bad;
} }

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* @(#)vnode.h 8.7 (Berkeley) 2/4/94 * @(#)vnode.h 8.7 (Berkeley) 2/4/94
* $Id: vnode.h,v 1.90 1999/07/18 14:30:30 phk Exp $ * $Id: vnode.h,v 1.91 1999/07/20 09:47:54 phk Exp $
*/ */
#ifndef _SYS_VNODE_H_ #ifndef _SYS_VNODE_H_
@ -454,6 +454,20 @@ struct vop_generic_args {
#define VDESC(OP) (& __CONCAT(OP,_desc)) #define VDESC(OP) (& __CONCAT(OP,_desc))
#define VOFFSET(OP) (VDESC(OP)->vdesc_offset) #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. * Finally, include the default set of vnode operations.
*/ */