Module Name: src
Committed By: pooka
Date: Thu Nov 5 19:22:58 UTC 2009
Modified Files:
src/sys/fs/puffs: puffs_sys.h puffs_vnops.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/fs/puffs/puffs_sys.h
cvs rdiff -u -r1.136 -r1.137 src/sys/fs/puffs/puffs_vnops.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/fs/puffs/puffs_sys.h
diff -u src/sys/fs/puffs/puffs_sys.h:1.70 src/sys/fs/puffs/puffs_sys.h:1.71
--- src/sys/fs/puffs/puffs_sys.h:1.70 Mon Jan 28 21:06:37 2008
+++ src/sys/fs/puffs/puffs_sys.h Thu Nov 5 19:22:57 2009
@@ -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 @@
#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 */
Index: src/sys/fs/puffs/puffs_vnops.c
diff -u src/sys/fs/puffs/puffs_vnops.c:1.136 src/sys/fs/puffs/puffs_vnops.c:1.137
--- src/sys/fs/puffs/puffs_vnops.c:1.136 Sat Oct 17 23:16:05 2009
+++ src/sys/fs/puffs/puffs_vnops.c Thu Nov 5 19:22:57 2009
@@ -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 @@
* 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 @@
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 @@
* 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 @@
|| (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",