From 1d9d9332f59835f828359c79e936f25576c9480d Mon Sep 17 00:00:00 2001 From: pooka Date: Fri, 18 May 2007 15:53:07 +0000 Subject: [PATCH] Use SETBACK_NOREF instead of SETBACK_INACT to control node removal. Avoids one round of inactive (wheee!). --- share/examples/puffs/dtfs/dtfs.c | 3 +-- share/examples/puffs/dtfs/dtfs_vnops.c | 18 ++++-------------- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/share/examples/puffs/dtfs/dtfs.c b/share/examples/puffs/dtfs/dtfs.c index ceb495c3ed85..abaada06654e 100644 --- a/share/examples/puffs/dtfs/dtfs.c +++ b/share/examples/puffs/dtfs/dtfs.c @@ -1,4 +1,4 @@ -/* $NetBSD: dtfs.c,v 1.25 2007/05/18 13:55:21 pooka Exp $ */ +/* $NetBSD: dtfs.c,v 1.26 2007/05/18 15:53:07 pooka Exp $ */ /* * Copyright (c) 2006 Antti Kantee. All Rights Reserved. @@ -192,7 +192,6 @@ main(int argc, char *argv[]) PUFFSOP_SET(pops, dtfs, node, symlink); PUFFSOP_SET(pops, dtfs, node, readlink); PUFFSOP_SET(pops, dtfs, node, mknod); - PUFFSOP_SET(pops, dtfs, node, inactive); PUFFSOP_SET(pops, dtfs, node, reclaim); srandom(time(NULL)); /* for random generation numbers */ diff --git a/share/examples/puffs/dtfs/dtfs_vnops.c b/share/examples/puffs/dtfs/dtfs_vnops.c index 0a1411c4e7e3..7ddfcffac19a 100644 --- a/share/examples/puffs/dtfs/dtfs_vnops.c +++ b/share/examples/puffs/dtfs/dtfs_vnops.c @@ -1,4 +1,4 @@ -/* $NetBSD: dtfs_vnops.c,v 1.26 2007/05/18 13:55:21 pooka Exp $ */ +/* $NetBSD: dtfs_vnops.c,v 1.27 2007/05/18 15:53:07 pooka Exp $ */ /* * Copyright (c) 2006 Antti Kantee. All Rights Reserved. @@ -192,8 +192,8 @@ dtfs_node_remove(struct puffs_cc *pcc, void *opc, void *targ, dtfs_nukenode(targ, pn_parent, pcn->pcn_name); - /* call inactive for removed node when its time comes */ - puffs_setback(pcc, PUFFS_SETBACK_INACT_N2); + if (pn->pn_va.va_nlink == 0) + puffs_setback(pcc, PUFFS_SETBACK_NOREF_N2); return 0; } @@ -224,6 +224,7 @@ dtfs_node_rmdir(struct puffs_cc *pcc, void *opc, void *targ, return ENOTEMPTY; dtfs_nukenode(targ, pn_parent, pcn->pcn_name); + puffs_setback(pcc, PUFFS_SETBACK_NOREF_N2); return 0; } @@ -497,14 +498,3 @@ dtfs_node_reclaim(struct puffs_cc *pcc, void *opc, pid_t pid) return 0; } - -int -dtfs_node_inactive(struct puffs_cc *pcc, void *opc, pid_t pid, - int *refcount) -{ - struct puffs_node *pn = opc; - - *refcount = pn->pn_va.va_nlink; - - return 0; -}