Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/fs/puffs Reinstante PNODE_DYING. vmlocking had a brief ...
details: https://anonhg.NetBSD.org/src/rev/16da23622554
branches: trunk
changeset: 748809:16da23622554
user: pooka <pooka%NetBSD.org@localhost>
date: Thu Nov 05 19:22:57 2009 +0000
description:
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.
diffstat:
sys/fs/puffs/puffs_sys.h | 3 ++-
sys/fs/puffs/puffs_vnops.c | 24 +++++++++++++++++++-----
2 files changed, 21 insertions(+), 6 deletions(-)
diffs (83 lines):
diff -r 97906da8df48 -r 16da23622554 sys/fs/puffs/puffs_sys.h
--- a/sys/fs/puffs/puffs_sys.h Thu Nov 05 18:39:38 2009 +0000
+++ b/sys/fs/puffs/puffs_sys.h Thu Nov 05 19:22:57 2009 +0000
@@ -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 */
diff -r 97906da8df48 -r 16da23622554 sys/fs/puffs/puffs_vnops.c
--- a/sys/fs/puffs/puffs_vnops.c Thu Nov 05 18:39:38 2009 +0000
+++ b/sys/fs/puffs/puffs_vnops.c Thu Nov 05 19:22:57 2009 +0000
@@ -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",
Home |
Main Index |
Thread Index |
Old Index