summaryrefslogtreecommitdiffstats
path: root/sys/fs
diff options
context:
space:
mode:
authordyson <dyson@FreeBSD.org>1998-01-06 05:26:17 +0000
committerdyson <dyson@FreeBSD.org>1998-01-06 05:26:17 +0000
commitcb2800cd94015c1a5a07a78ac1299961c8cbfee8 (patch)
tree458fd90f400f25f9120e71fd368963d5190181bb /sys/fs
parent082257799eb016d17f2ea10684dc8c250c8dce19 (diff)
downloadFreeBSD-src-cb2800cd94015c1a5a07a78ac1299961c8cbfee8.zip
FreeBSD-src-cb2800cd94015c1a5a07a78ac1299961c8cbfee8.tar.gz
Make our v_usecount vnode reference count work identically to the
original BSD code. The association between the vnode and the vm_object no longer includes reference counts. The major difference is that vm_object's are no longer freed gratuitiously from the vnode, and so once an object is created for the vnode, it will last as long as the vnode does. When a vnode object reference count is incremented, then the underlying vnode reference count is incremented also. The two "objects" are now more intimately related, and so the interactions are now much less complex. When vnodes are now normally placed onto the free queue with an object still attached. The rundown of the object happens at vnode rundown time, and happens with exactly the same filesystem semantics of the original VFS code. There is absolutely no need for vnode_pager_uncache and other travesties like that anymore. A side-effect of these changes is that SMP locking should be much simpler, the I/O copyin/copyout optimizations work, NFS should be more ponderable, and further work on layered filesystems should be less frustrating, because of the totally coherent management of the vnode objects and vnodes. Please be careful with your system while running this code, but I would greatly appreciate feedback as soon a reasonably possible.
Diffstat (limited to 'sys/fs')
-rw-r--r--sys/fs/procfs/procfs_map.c4
-rw-r--r--sys/fs/procfs/procfs_vnops.c9
-rw-r--r--sys/fs/specfs/spec_vnops.c25
3 files changed, 23 insertions, 15 deletions
diff --git a/sys/fs/procfs/procfs_map.c b/sys/fs/procfs/procfs_map.c
index 184cee9..7033e1c 100644
--- a/sys/fs/procfs/procfs_map.c
+++ b/sys/fs/procfs/procfs_map.c
@@ -36,7 +36,7 @@
*
* @(#)procfs_status.c 8.3 (Berkeley) 2/17/94
*
- * $Id: procfs_map.c,v 1.12 1997/08/02 14:32:12 bde Exp $
+ * $Id: procfs_map.c,v 1.13 1997/11/14 22:57:46 tegge Exp $
*/
#include <sys/param.h>
@@ -101,7 +101,7 @@ procfs_domap(curp, p, pfs, uio)
continue;
obj = entry->object.vm_object;
- if (obj && (obj->ref_count == 1))
+ if (obj && (obj->shadow_count == 1))
privateresident = obj->resident_page_count;
else
privateresident = 0;
diff --git a/sys/fs/procfs/procfs_vnops.c b/sys/fs/procfs/procfs_vnops.c
index b8bd8e9..00cca89 100644
--- a/sys/fs/procfs/procfs_vnops.c
+++ b/sys/fs/procfs/procfs_vnops.c
@@ -36,7 +36,7 @@
*
* @(#)procfs_vnops.c 8.18 (Berkeley) 5/21/95
*
- * $Id: procfs_vnops.c,v 1.50 1997/12/27 02:56:25 bde Exp $
+ * $Id: procfs_vnops.c,v 1.51 1998/01/06 01:37:12 sef Exp $
*/
/*
@@ -186,7 +186,7 @@ procfs_close(ap)
* vnode. While one would expect v_usecount to be 1 at
* that point, it seems that (according to John Dyson)
* the VM system will bump up the usecount. So: if the
- * usecount is 2, and VVMIO is set, then this is really
+ * usecount is 2, and VOBJBUF is set, then this is really
* the last close. Otherwise, if the usecount is < 2
* then it is definitely the last close.
* If this is the last close, then it checks to see if
@@ -197,10 +197,7 @@ procfs_close(ap)
* told to stop on an event, but then the requesting process
* has gone away or forgotten about it.
*/
- if (((ap->a_vp->v_usecount == 2
- && ap->a_vp->v_object
- && (ap->a_vp->v_flag & VVMIO)) ||
- (ap->a_vp->v_usecount < 2))
+ if ((ap->a_vp->v_usecount < 2)
&& (p = pfind(pfs->pfs_pid))
&& !(p->p_pfsflags & PF_LINGER)) {
p->p_stops = 0;
diff --git a/sys/fs/specfs/spec_vnops.c b/sys/fs/specfs/spec_vnops.c
index 6da09a6..3bad030 100644
--- a/sys/fs/specfs/spec_vnops.c
+++ b/sys/fs/specfs/spec_vnops.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)spec_vnops.c 8.14 (Berkeley) 5/21/95
- * $Id: spec_vnops.c,v 1.51 1997/10/27 13:33:42 bde Exp $
+ * $Id: spec_vnops.c,v 1.52 1997/12/29 00:23:16 dyson Exp $
*/
#include <sys/param.h>
@@ -232,6 +232,7 @@ spec_open(ap)
(ap->a_mode & FWRITE) &&
(bdevsw[maj]->d_flags & D_TYPEMASK) == D_DISK)
return (EPERM);
+
/*
* Do not allow opens of block devices that are
* currently mounted.
@@ -392,10 +393,14 @@ spec_write(ap)
brelse(bp);
return (error);
}
+ if (vp->v_flag & VOBJBUF)
+ bp->b_flags |= B_CLUSTEROK;
error = uiomove((char *)bp->b_data + on, n, uio);
if (n + on == bsize) {
- /* bawrite(bp); */
- cluster_write(bp, 0);
+ if ((vp->v_flag & VOBJBUF) && (on == 0))
+ vfs_bio_awrite(bp);
+ else
+ bawrite(bp);
} else
bdwrite(bp);
} while (error == 0 && uio->uio_resid > 0 && n != 0);
@@ -499,10 +504,15 @@ loop:
continue;
if ((bp->b_flags & B_DELWRI) == 0)
panic("spec_fsync: not dirty");
- bremfree(bp);
- bp->b_flags |= B_BUSY;
- splx(s);
- bawrite(bp);
+ if ((vp->v_flag & VOBJBUF) && (bp->b_flags & B_CLUSTEROK)) {
+ vfs_bio_awrite(bp);
+ splx(s);
+ } else {
+ bremfree(bp);
+ bp->b_flags |= B_BUSY;
+ splx(s);
+ bawrite(bp);
+ }
goto loop;
}
if (ap->a_waitfor == MNT_WAIT) {
@@ -631,6 +641,7 @@ spec_close(ap)
error = vinvalbuf(vp, V_SAVE, ap->a_cred, ap->a_p, 0, 0);
if (error)
return (error);
+
/*
* We do not want to really close the device if it
* is still in use unless we are trying to close it
OpenPOWER on IntegriCloud