Reinstante PNODE_DYING. vmlocking had a brief hiatus when it was not

a valid optimization, but that's long gone and once VOP_INACTIVE is
called and the file server says that the vnode is going to be recycled,
it really is going to be recycled extra references gained or not.
This commit is contained in:
pooka 2009-11-05 19:22:57 +00:00
parent 0c8283fe12
commit 1ed7a6beef
2 changed files with 21 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: puffs_sys.h,v 1.70 2008/01/28 21:06:37 pooka Exp $ */
/* $NetBSD: puffs_sys.h,v 1.71 2009/11/05 19:22:57 pooka Exp $ */
/*
* Copyright (c) 2005, 2006 Antti Kantee. All Rights Reserved.
@ -152,6 +152,7 @@ struct puffs_mount {
#define PNODE_NOREFS 0x01 /* no backend reference */
#define PNODE_DYING 0x02 /* NOREFS + inactive */
#define PNODE_SUSPEND 0x04 /* issue all operations as FAF */
#define PNODE_DOINACT 0x08 /* if inactive-on-demand, call inactive */

View File

@ -1,4 +1,4 @@
/* $NetBSD: puffs_vnops.c,v 1.136 2009/10/17 23:16:05 pooka Exp $ */
/* $NetBSD: puffs_vnops.c,v 1.137 2009/11/05 19:22:57 pooka Exp $ */
/*
* Copyright (c) 2005, 2006, 2007 Antti Kantee. All Rights Reserved.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.136 2009/10/17 23:16:05 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.137 2009/11/05 19:22:57 pooka Exp $");
#include <sys/param.h>
#include <sys/buf.h>
@ -1028,7 +1028,10 @@ puffs_vnop_inactive(void *v)
* file server thinks it's gone? then don't be afraid care,
* node's life was already all it would ever be
*/
*ap->a_recycle = ((pnode->pn_stat & PNODE_NOREFS) != 0);
if (pnode->pn_stat & PNODE_NOREFS) {
pnode->pn_stat |= PNODE_DYING;
*ap->a_recycle = true;
}
VOP_UNLOCK(vp, 0);
@ -1295,7 +1298,8 @@ puffs_vnop_fsync(void *v)
pn = VPTOPP(vp);
/* flush out information from our metacache, see vop_setattr */
if (pn->pn_stat & PNODE_METACACHE_MASK) {
if (pn->pn_stat & PNODE_METACACHE_MASK
&& (pn->pn_stat & PNODE_DYING) == 0) {
vattr_null(&va);
error = VOP_SETATTR(vp, &va, FSCRED);
if (error)
@ -1320,7 +1324,7 @@ puffs_vnop_fsync(void *v)
* has references neither in the kernel or the fs server.
* Otherwise we continue to issue fsync() forward.
*/
if (!EXISTSOP(pmp, FSYNC))
if (!EXISTSOP(pmp, FSYNC) || (pn->pn_stat & PNODE_DYING))
return 0;
dofaf = (ap->a_flags & FSYNC_WAIT) == 0 || ap->a_flags == FSYNC_LAZY;
@ -2168,6 +2172,16 @@ puffs_vnop_strategy(void *v)
|| (BUF_ISWRITE(bp) && !EXISTSOP(pmp, WRITE)))
ERROUT(EOPNOTSUPP);
/*
* Short-circuit optimization: don't flush buffer in between
* VOP_INACTIVE and VOP_RECLAIM in case the node has no references.
*/
if (pn->pn_stat & PNODE_DYING) {
KASSERT(BUF_ISWRITE(bp));
bp->b_resid = 0;
goto out;
}
#ifdef DIAGNOSTIC
if (bp->b_bcount > pmp->pmp_msg_maxsize - PUFFS_MSGSTRUCT_MAX)
panic("puffs_strategy: wildly inappropriate buf bcount %d",