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.
This commit is contained in:
parent
e816bc9767
commit
89721f6f1a
@ -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 @@ msdosfs_inactive(ap)
|
||||
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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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 @@ msdosfs_inactive(ap)
|
||||
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;
|
||||
}
|
||||
|
@ -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 @@ ufs_inactive(ap)
|
||||
* so that it can be reused immediately.
|
||||
*/
|
||||
if (ip->i_mode == 0)
|
||||
vrecycle(vp, (struct simplelock *)0, p);
|
||||
vp->v_flag |= VAGE;
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user