diff options
author | 2009-08-02 16:28:39 +0000 | |
---|---|---|
committer | 2009-08-02 16:28:39 +0000 | |
commit | 89502cd6536ab6296cb0ccd049742273d8af195c (patch) | |
tree | 0f5063329c85893f79d6d7b4d68c7fb299c98486 /sys/kern/vfs_subr.c | |
parent | "ldpctl show lib" output cleanup. (diff) | |
download | wireguard-openbsd-89502cd6536ab6296cb0ccd049742273d8af195c.tar.xz wireguard-openbsd-89502cd6536ab6296cb0ccd049742273d8af195c.zip |
Dynamic buffer cache support - a re-commit of what was backed out
after c2k9
allows buffer cache to be extended and grow/shrink dynamically
tested by many, ok oga@, "why not just commit it" deraadt@
Diffstat (limited to 'sys/kern/vfs_subr.c')
-rw-r--r-- | sys/kern/vfs_subr.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 4b19f59ef2a..7a420752b26 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_subr.c,v 1.179 2009/06/25 15:49:26 thib Exp $ */ +/* $OpenBSD: vfs_subr.c,v 1.180 2009/08/02 16:28:40 beck Exp $ */ /* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */ /* @@ -59,6 +59,7 @@ #include <sys/mbuf.h> #include <sys/syscallargs.h> #include <sys/pool.h> +#include <sys/tree.h> #include <uvm/uvm_extern.h> #include <sys/sysctl.h> @@ -115,6 +116,19 @@ void printlockedvnodes(void); struct pool vnode_pool; +static int rb_buf_compare(struct buf *b1, struct buf *b2); +RB_GENERATE(buf_rb_bufs, buf, b_rbbufs, rb_buf_compare); + +static int +rb_buf_compare(struct buf *b1, struct buf *b2) +{ + if (b1->b_lblkno < b2->b_lblkno) + return(-1); + if (b1->b_lblkno > b2->b_lblkno) + return(1); + return(0); +} + /* * Initialize the vnode management data structures. */ @@ -345,6 +359,7 @@ getnewvnode(enum vtagtype tag, struct mount *mp, int (**vops)(void *), ((TAILQ_FIRST(listhd = &vnode_hold_list) == NULL) || toggle))) { splx(s); vp = pool_get(&vnode_pool, PR_WAITOK | PR_ZERO); + RB_INIT(&vp->v_bufs_tree); numvnodes++; } else { for (vp = TAILQ_FIRST(listhd); vp != NULLVP; |