diff options
author | dyson <dyson@FreeBSD.org> | 1998-01-17 09:17:02 +0000 |
---|---|---|
committer | dyson <dyson@FreeBSD.org> | 1998-01-17 09:17:02 +0000 |
commit | b130b30c96fd365316e5a4f21ec0965be052e78b (patch) | |
tree | 5fa8acd32fec5f8fc8f142f0696ee005c2542f64 /sys/kern | |
parent | de471d9a3b481d2b4870deedad64835148e99c26 (diff) | |
download | FreeBSD-src-b130b30c96fd365316e5a4f21ec0965be052e78b.zip FreeBSD-src-b130b30c96fd365316e5a4f21ec0965be052e78b.tar.gz |
Tie up some loose ends in vnode/object management. Remove an unneeded
config option in pmap. Fix a problem with faulting in pages. Clean-up
some loose ends in swap pager memory management.
The system should be much more stable, but all subtile bugs aren't fixed yet.
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/vfs_bio.c | 16 | ||||
-rw-r--r-- | sys/kern/vfs_export.c | 35 | ||||
-rw-r--r-- | sys/kern/vfs_subr.c | 35 |
3 files changed, 53 insertions, 33 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 5a1633a..d00bffe 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -11,7 +11,7 @@ * 2. Absolutely no warranty of function or purpose is made by the author * John S. Dyson. * - * $Id: vfs_bio.c,v 1.141 1998/01/06 05:15:55 dyson Exp $ + * $Id: vfs_bio.c,v 1.142 1998/01/12 01:46:25 dyson Exp $ */ /* @@ -793,11 +793,6 @@ vfs_vmio_release(bp) vp = bp->b_vp; vm_page_protect(m, VM_PROT_NONE); vm_page_free(m); - if (vp && VSHOULDFREE(vp) && - (vp->v_flag & (VFREE|VTBFREE)) == 0) { - TAILQ_INSERT_TAIL(&vnode_tobefree_list, vp, v_freelist); - vp->v_flag |= VTBFREE; - } } } else { /* @@ -892,7 +887,9 @@ vfs_bio_awrite(struct buf * bp) splx(s); return nwritten; } - } else if ((vp->v_flag & VOBJBUF) && (vp->v_type == VBLK) && + } +#if 0 + else if ((vp->v_flag & VOBJBUF) && (vp->v_type == VBLK) && ((size = bp->b_bufsize) >= PAGE_SIZE)) { maxcl = MAXPHYS / size; for (i = 1; i < maxcl; i++) { @@ -913,11 +910,11 @@ vfs_bio_awrite(struct buf * bp) */ if (ncl != 1) { nwritten = cluster_wbuild(vp, size, lblkno, ncl); - printf("Block cluster: (%d, %d)\n", lblkno, nwritten); splx(s); return nwritten; } } +#endif bremfree(bp); splx(s); @@ -1086,6 +1083,7 @@ trytofreespace: brelvp(bp); fillbuf: + /* we are not free, nor do we contain interesting data */ if (bp->b_rcred != NOCRED) { crfree(bp->b_rcred); @@ -1112,7 +1110,7 @@ fillbuf: bp->b_npages = 0; bp->b_dirtyoff = bp->b_dirtyend = 0; bp->b_validoff = bp->b_validend = 0; - bp->b_usecount = 4; + bp->b_usecount = 5; maxsize = (maxsize + PAGE_MASK) & ~PAGE_MASK; diff --git a/sys/kern/vfs_export.c b/sys/kern/vfs_export.c index 8ae2ba4..3b0eb61 100644 --- a/sys/kern/vfs_export.c +++ b/sys/kern/vfs_export.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95 - * $Id: vfs_subr.c,v 1.122 1998/01/12 01:46:30 dyson Exp $ + * $Id: vfs_subr.c,v 1.123 1998/01/12 03:15:01 dyson Exp $ */ /* @@ -66,6 +66,7 @@ #include <vm/vm_extern.h> #include <vm/pmap.h> #include <vm/vm_map.h> +#include <vm/vm_pager.h> #include <vm/vnode_pager.h> #include <sys/sysctl.h> @@ -77,7 +78,6 @@ static void insmntque __P((struct vnode *vp, struct mount *mp)); #ifdef DDB static void printlockedvnodes __P((void)); #endif -static void vbusy __P((struct vnode *)); static void vclean __P((struct vnode *vp, int flags, struct proc *p)); static void vfree __P((struct vnode *)); static void vgonel __P((struct vnode *vp, struct proc *p)); @@ -110,7 +110,7 @@ SYSCTL_INT(_debug, OID_AUTO, wantfreevnodes, CTLFLAG_RW, &wantfreevnodes, 0, "") static u_long freevnodes = 0; SYSCTL_INT(_debug, OID_AUTO, freevnodes, CTLFLAG_RD, &freevnodes, 0, ""); -int vfs_ioopt = 2; +int vfs_ioopt = 0; SYSCTL_INT(_vfs, OID_AUTO, ioopt, CTLFLAG_RW, &vfs_ioopt, 0, ""); struct mntlist mountlist; /* mounted filesystem list */ @@ -374,8 +374,11 @@ getnewvnode(tag, mp, vops, vpp) for (vp = TAILQ_FIRST(&vnode_tobefree_list); vp; vp = nvp) { nvp = TAILQ_NEXT(vp, v_freelist); TAILQ_REMOVE(&vnode_tobefree_list, vp, v_freelist); - TAILQ_INSERT_TAIL(&vnode_tmp_list, vp, v_freelist); + TAILQ_INSERT_TAIL(&vnode_free_list, vp, v_freelist); vp->v_flag &= ~VTBFREE; + vp->v_flag |= VFREE; + if (vp->v_usecount) + panic("tobe free vnode isn't"); freevnodes++; } @@ -1171,9 +1174,6 @@ vclean(vp, flags, p) if ((active = vp->v_usecount)) vp->v_usecount++; - if (vp->v_object) { - vp->v_object->flags |= OBJ_DEAD; - } /* * Prevent the vnode from being recycled or brought into use while we * clean it out. @@ -1193,10 +1193,21 @@ vclean(vp, flags, p) /* * Clean out any buffers associated with the vnode. */ - if (vp->v_object) - vm_object_terminate(vp->v_object); - else - vinvalbuf(vp, V_SAVE, NOCRED, p, 0, 0); + vinvalbuf(vp, V_SAVE, NOCRED, p, 0, 0); + if (vp->v_object) { + if (vp->v_object->ref_count == 0) { + /* + * This is a normal way of shutting down the object/vnode + * association. + */ + vm_object_terminate(vp->v_object); + } else { + /* + * Woe to the process that tries to page now :-). + */ + vm_pager_deallocate(vp->v_object); + } + } /* * If purging an active vnode, it must be closed and @@ -2186,7 +2197,7 @@ vfree(vp) splx(s); } -static void +void vbusy(vp) struct vnode *vp; { diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 8ae2ba4..3b0eb61 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95 - * $Id: vfs_subr.c,v 1.122 1998/01/12 01:46:30 dyson Exp $ + * $Id: vfs_subr.c,v 1.123 1998/01/12 03:15:01 dyson Exp $ */ /* @@ -66,6 +66,7 @@ #include <vm/vm_extern.h> #include <vm/pmap.h> #include <vm/vm_map.h> +#include <vm/vm_pager.h> #include <vm/vnode_pager.h> #include <sys/sysctl.h> @@ -77,7 +78,6 @@ static void insmntque __P((struct vnode *vp, struct mount *mp)); #ifdef DDB static void printlockedvnodes __P((void)); #endif -static void vbusy __P((struct vnode *)); static void vclean __P((struct vnode *vp, int flags, struct proc *p)); static void vfree __P((struct vnode *)); static void vgonel __P((struct vnode *vp, struct proc *p)); @@ -110,7 +110,7 @@ SYSCTL_INT(_debug, OID_AUTO, wantfreevnodes, CTLFLAG_RW, &wantfreevnodes, 0, "") static u_long freevnodes = 0; SYSCTL_INT(_debug, OID_AUTO, freevnodes, CTLFLAG_RD, &freevnodes, 0, ""); -int vfs_ioopt = 2; +int vfs_ioopt = 0; SYSCTL_INT(_vfs, OID_AUTO, ioopt, CTLFLAG_RW, &vfs_ioopt, 0, ""); struct mntlist mountlist; /* mounted filesystem list */ @@ -374,8 +374,11 @@ getnewvnode(tag, mp, vops, vpp) for (vp = TAILQ_FIRST(&vnode_tobefree_list); vp; vp = nvp) { nvp = TAILQ_NEXT(vp, v_freelist); TAILQ_REMOVE(&vnode_tobefree_list, vp, v_freelist); - TAILQ_INSERT_TAIL(&vnode_tmp_list, vp, v_freelist); + TAILQ_INSERT_TAIL(&vnode_free_list, vp, v_freelist); vp->v_flag &= ~VTBFREE; + vp->v_flag |= VFREE; + if (vp->v_usecount) + panic("tobe free vnode isn't"); freevnodes++; } @@ -1171,9 +1174,6 @@ vclean(vp, flags, p) if ((active = vp->v_usecount)) vp->v_usecount++; - if (vp->v_object) { - vp->v_object->flags |= OBJ_DEAD; - } /* * Prevent the vnode from being recycled or brought into use while we * clean it out. @@ -1193,10 +1193,21 @@ vclean(vp, flags, p) /* * Clean out any buffers associated with the vnode. */ - if (vp->v_object) - vm_object_terminate(vp->v_object); - else - vinvalbuf(vp, V_SAVE, NOCRED, p, 0, 0); + vinvalbuf(vp, V_SAVE, NOCRED, p, 0, 0); + if (vp->v_object) { + if (vp->v_object->ref_count == 0) { + /* + * This is a normal way of shutting down the object/vnode + * association. + */ + vm_object_terminate(vp->v_object); + } else { + /* + * Woe to the process that tries to page now :-). + */ + vm_pager_deallocate(vp->v_object); + } + } /* * If purging an active vnode, it must be closed and @@ -2186,7 +2197,7 @@ vfree(vp) splx(s); } -static void +void vbusy(vp) struct vnode *vp; { |