diff options
author | dyson <dyson@FreeBSD.org> | 1997-08-22 03:56:37 +0000 |
---|---|---|
committer | dyson <dyson@FreeBSD.org> | 1997-08-22 03:56:37 +0000 |
commit | 042ae4067bba3eae3265578a9102ff76e6dce755 (patch) | |
tree | 4beb51a09aae46f7638c09229ce923131f36f6c9 /sys | |
parent | e9d26b3a32965b6150b17744dbec021d7c66105a (diff) | |
download | FreeBSD-src-042ae4067bba3eae3265578a9102ff76e6dce755.zip FreeBSD-src-042ae4067bba3eae3265578a9102ff76e6dce755.tar.gz |
This is a trial improvement for the vnode reference count while on the vnode
free list problem. Also, the vnode age flag is no longer used by the
vnode pager. (It is actually incorrect to use then.) Constructive
feedback welcome -- just be kind.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/fs/msdosfs/msdosfs_denode.c | 6 | ||||
-rw-r--r-- | sys/kern/vfs_export.c | 35 | ||||
-rw-r--r-- | sys/kern/vfs_subr.c | 35 | ||||
-rw-r--r-- | sys/msdosfs/msdosfs_denode.c | 6 | ||||
-rw-r--r-- | sys/ufs/ufs/ufs_inode.c | 4 | ||||
-rw-r--r-- | sys/vm/vnode_pager.c | 3 |
6 files changed, 49 insertions, 40 deletions
diff --git a/sys/fs/msdosfs/msdosfs_denode.c b/sys/fs/msdosfs/msdosfs_denode.c index e1d5610..5973265 100644 --- a/sys/fs/msdosfs/msdosfs_denode.c +++ b/sys/fs/msdosfs/msdosfs_denode.c @@ -1,4 +1,4 @@ -/* $Id: msdosfs_denode.c,v 1.22 1997/02/22 09:40:46 peter Exp $ */ +/* $Id: msdosfs_denode.c,v 1.23 1997/02/26 14:23:11 bde Exp $ */ /* $NetBSD: msdosfs_denode.c,v 1.9 1994/08/21 18:44:00 ws Exp $ */ /*- @@ -750,7 +750,9 @@ out: printf("msdosfs_inactive(): v_usecount %d, de_Name[0] %x\n", vp->v_usecount, dep->de_Name[0]); #endif + if (dep->de_Name[0] == SLOT_DELETED) - vrecycle(vp, (struct simplelock *)0, p); + vp->v_flag |= VAGE; + return error; } diff --git a/sys/kern/vfs_export.c b/sys/kern/vfs_export.c index 7f01c7b..5d66054 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.91 1997/08/16 19:15:08 wollman Exp $ + * $Id: vfs_subr.c,v 1.92 1997/08/21 20:33:39 bde Exp $ */ /* @@ -1089,11 +1089,11 @@ vputrele(vp, put) panic("vputrele: null vp"); #endif simple_lock(&vp->v_interlock); - vp->v_usecount--; - if ((vp->v_usecount == 1) && + if ((vp->v_usecount == 2) && vp->v_object && (vp->v_object->flags & OBJ_VFS_REF)) { + vp->v_usecount--; vp->v_object->flags &= ~OBJ_VFS_REF; if (put) { VOP_UNLOCK(vp, LK_INTERLOCK, p); @@ -1104,7 +1104,8 @@ vputrele(vp, put) return; } - if (vp->v_usecount > 0) { + if (vp->v_usecount > 1) { + vp->v_usecount--; if (put) { VOP_UNLOCK(vp, LK_INTERLOCK, p); } else { @@ -1113,23 +1114,12 @@ vputrele(vp, put) return; } - if (vp->v_usecount < 0) { + if (vp->v_usecount < 1) { #ifdef DIAGNOSTIC vprint("vputrele: negative ref count", vp); #endif panic("vputrele: negative ref cnt"); } - simple_lock(&vnode_free_list_slock); - if (vp->v_flag & VAGE) { - vp->v_flag &= ~VAGE; - if(vp->v_tag != VT_TFS) - TAILQ_INSERT_HEAD(&vnode_free_list, vp, v_freelist); - } else { - if(vp->v_tag != VT_TFS) - TAILQ_INSERT_TAIL(&vnode_free_list, vp, v_freelist); - } - freevnodes++; - simple_unlock(&vnode_free_list_slock); /* * If we are doing a vput, the node is already locked, and we must @@ -1142,6 +1132,19 @@ vputrele(vp, put) } else if (vn_lock(vp, LK_EXCLUSIVE | LK_INTERLOCK, p) == 0) { VOP_INACTIVE(vp, p); } + + vp->v_usecount--; + simple_lock(&vnode_free_list_slock); + if (vp->v_flag & VAGE) { + vp->v_flag &= ~VAGE; + if(vp->v_tag != VT_TFS) + TAILQ_INSERT_HEAD(&vnode_free_list, vp, v_freelist); + } else { + if(vp->v_tag != VT_TFS) + TAILQ_INSERT_TAIL(&vnode_free_list, vp, v_freelist); + } + freevnodes++; + simple_unlock(&vnode_free_list_slock); } /* diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 7f01c7b..5d66054 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.91 1997/08/16 19:15:08 wollman Exp $ + * $Id: vfs_subr.c,v 1.92 1997/08/21 20:33:39 bde Exp $ */ /* @@ -1089,11 +1089,11 @@ vputrele(vp, put) panic("vputrele: null vp"); #endif simple_lock(&vp->v_interlock); - vp->v_usecount--; - if ((vp->v_usecount == 1) && + if ((vp->v_usecount == 2) && vp->v_object && (vp->v_object->flags & OBJ_VFS_REF)) { + vp->v_usecount--; vp->v_object->flags &= ~OBJ_VFS_REF; if (put) { VOP_UNLOCK(vp, LK_INTERLOCK, p); @@ -1104,7 +1104,8 @@ vputrele(vp, put) return; } - if (vp->v_usecount > 0) { + if (vp->v_usecount > 1) { + vp->v_usecount--; if (put) { VOP_UNLOCK(vp, LK_INTERLOCK, p); } else { @@ -1113,23 +1114,12 @@ vputrele(vp, put) return; } - if (vp->v_usecount < 0) { + if (vp->v_usecount < 1) { #ifdef DIAGNOSTIC vprint("vputrele: negative ref count", vp); #endif panic("vputrele: negative ref cnt"); } - simple_lock(&vnode_free_list_slock); - if (vp->v_flag & VAGE) { - vp->v_flag &= ~VAGE; - if(vp->v_tag != VT_TFS) - TAILQ_INSERT_HEAD(&vnode_free_list, vp, v_freelist); - } else { - if(vp->v_tag != VT_TFS) - TAILQ_INSERT_TAIL(&vnode_free_list, vp, v_freelist); - } - freevnodes++; - simple_unlock(&vnode_free_list_slock); /* * If we are doing a vput, the node is already locked, and we must @@ -1142,6 +1132,19 @@ vputrele(vp, put) } else if (vn_lock(vp, LK_EXCLUSIVE | LK_INTERLOCK, p) == 0) { VOP_INACTIVE(vp, p); } + + vp->v_usecount--; + simple_lock(&vnode_free_list_slock); + if (vp->v_flag & VAGE) { + vp->v_flag &= ~VAGE; + if(vp->v_tag != VT_TFS) + TAILQ_INSERT_HEAD(&vnode_free_list, vp, v_freelist); + } else { + if(vp->v_tag != VT_TFS) + TAILQ_INSERT_TAIL(&vnode_free_list, vp, v_freelist); + } + freevnodes++; + simple_unlock(&vnode_free_list_slock); } /* diff --git a/sys/msdosfs/msdosfs_denode.c b/sys/msdosfs/msdosfs_denode.c index e1d5610..5973265 100644 --- a/sys/msdosfs/msdosfs_denode.c +++ b/sys/msdosfs/msdosfs_denode.c @@ -1,4 +1,4 @@ -/* $Id: msdosfs_denode.c,v 1.22 1997/02/22 09:40:46 peter Exp $ */ +/* $Id: msdosfs_denode.c,v 1.23 1997/02/26 14:23:11 bde Exp $ */ /* $NetBSD: msdosfs_denode.c,v 1.9 1994/08/21 18:44:00 ws Exp $ */ /*- @@ -750,7 +750,9 @@ out: printf("msdosfs_inactive(): v_usecount %d, de_Name[0] %x\n", vp->v_usecount, dep->de_Name[0]); #endif + if (dep->de_Name[0] == SLOT_DELETED) - vrecycle(vp, (struct simplelock *)0, p); + vp->v_flag |= VAGE; + return error; } diff --git a/sys/ufs/ufs/ufs_inode.c b/sys/ufs/ufs/ufs_inode.c index 25df2a5..29b5dff 100644 --- a/sys/ufs/ufs/ufs_inode.c +++ b/sys/ufs/ufs/ufs_inode.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)ufs_inode.c 8.9 (Berkeley) 5/14/95 - * $Id: ufs_inode.c,v 1.11 1997/02/22 09:47:48 peter Exp $ + * $Id: ufs_inode.c,v 1.12 1997/03/22 06:53:44 bde Exp $ */ #include "opt_quota.h" @@ -104,7 +104,7 @@ out: * so that it can be reused immediately. */ if (ip->i_mode == 0) - vrecycle(vp, (struct simplelock *)0, p); + vp->v_flag |= VAGE; return (error); } diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c index d258351..fab8b99 100644 --- a/sys/vm/vnode_pager.c +++ b/sys/vm/vnode_pager.c @@ -38,7 +38,7 @@ * SUCH DAMAGE. * * from: @(#)vnode_pager.c 7.5 (Berkeley) 4/20/91 - * $Id: vnode_pager.c,v 1.70 1997/03/08 04:33:47 dyson Exp $ + * $Id: vnode_pager.c,v 1.71 1997/05/19 14:36:56 dfr Exp $ */ /* @@ -199,7 +199,6 @@ vnode_pager_dealloc(object) vp->v_object = NULL; vp->v_flag &= ~(VTEXT | VVMIO); - vp->v_flag |= VAGE; vrele(vp); } |