diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2001-11-09 15:32:23 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2001-11-09 15:32:23 +0000 |
commit | 11855386c53f57f05c25aacb08affc798d977eb6 (patch) | |
tree | dc0354314fe570f913df082d9ee7dd8843c86a76 /sys | |
parent | 9e06d79c3675e4b46fe50497145a9c50958b916a (diff) |
Create bufpool - a pool of struct bufs.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/vfs_bio.c | 10 | ||||
-rw-r--r-- | sys/sys/buf.h | 5 |
2 files changed, 13 insertions, 2 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 7c5eba3914c..7d7cafc05a6 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_bio.c,v 1.48 2001/11/06 19:53:20 miod Exp $ */ +/* $OpenBSD: vfs_bio.c,v 1.49 2001/11/09 15:32:22 art Exp $ */ /* $NetBSD: vfs_bio.c,v 1.44 1996/06/11 11:15:36 pk Exp $ */ /*- @@ -56,6 +56,7 @@ #include <sys/vnode.h> #include <sys/mount.h> #include <sys/malloc.h> +#include <sys/pool.h> #include <sys/resourcevar.h> #include <sys/conf.h> #include <sys/kernel.h> @@ -99,6 +100,11 @@ int nobuffers; struct bio_ops bioops; /* + * Buffer pool for I/O buffers. + */ +struct pool bufpool; + +/* * Insq/Remq for the buffer free lists. */ #define binsheadfree(bp, dp) TAILQ_INSERT_HEAD(dp, bp, b_freelist) @@ -183,6 +189,8 @@ bufinit() register int i; int base, residual; + pool_init(&bufpool, sizeof(struct buf), 0, 0, 0, "bufpl", 0, + NULL, NULL, M_DEVBUF); for (dp = bufqueues; dp < &bufqueues[BQUEUES]; dp++) TAILQ_INIT(dp); bufhashtbl = hashinit(nbuf, M_CACHE, M_WAITOK, &bufhash); diff --git a/sys/sys/buf.h b/sys/sys/buf.h index da3db3566de..92855ae36f4 100644 --- a/sys/sys/buf.h +++ b/sys/sys/buf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: buf.h,v 1.31 2001/11/09 15:25:55 art Exp $ */ +/* $OpenBSD: buf.h,v 1.32 2001/11/09 15:32:21 art Exp $ */ /* $NetBSD: buf.h,v 1.25 1997/04/09 21:12:17 mycroft Exp $ */ /* @@ -150,6 +150,7 @@ struct buf { #define B_XXX 0x02000000 /* Debugging flag. */ #define B_DEFERRED 0x04000000 /* Skipped over for cleaning */ #define B_SCANNED 0x08000000 /* Block already pushed during sync */ +#define B_PDAEMON 0x10000000 /* I/O started by pagedaemon */ /* * This structure describes a clustered I/O. It is stored in the b_saveaddr @@ -194,6 +195,8 @@ struct buf *buf; /* The buffer headers. */ char *buffers; /* The buffer contents. */ int bufpages; /* Number of memory pages in the buffer pool. */ +extern struct pool bufpool; + __BEGIN_DECLS void allocbuf __P((struct buf *, int)); void bawrite __P((struct buf *)); |