From 25e67656df365dc742ef9b23471d781550fda24e Mon Sep 17 00:00:00 2001 From: phk Date: Mon, 9 Oct 2000 14:18:07 +0000 Subject: Don't hold an extra reference to vnodes. Devfs vnodes are sufficiently cheap to setup that it doesn't really matter that we recycle device vnodes at kleenex speed. Implement first cut try at killing cloned devices when they are not needed anymore. For now only the bpf driver is involved in this experiment. Cloned devices can set the SI_CHEAPCLONE flag which allows us to destroy_dev() it when the vcount() drops to zero and the vnode is reclaimed. For now it's a requirement that the driver doesn't keep persistent state from close to (re)open. Some whitespace changes. --- sys/fs/devfs/devfs_vfsops.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'sys/fs/devfs/devfs_vfsops.c') diff --git a/sys/fs/devfs/devfs_vfsops.c b/sys/fs/devfs/devfs_vfsops.c index 00951ae..0c5d1bb 100644 --- a/sys/fs/devfs/devfs_vfsops.c +++ b/sys/fs/devfs/devfs_vfsops.c @@ -133,12 +133,14 @@ devfs_unmount(mp, mntflags, p) fmp = VFSTODEVFS(mp); if (mntflags & MNT_FORCE) flags |= FORCECLOSE; - if (rootvp->v_usecount > 1) + if (rootvp->v_usecount > 2) { + vrele(rootvp); return (EBUSY); - devfs_purge(fmp->dm_rootdir); + } error = vflush(mp, rootvp, flags); if (error) return (error); + devfs_purge(fmp->dm_rootdir); vput(rootvp); vrele(rootvp); vgone(rootvp); -- cgit v1.1