summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2001-03-22 00:11:37 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2001-03-22 00:11:37 +0000
commit88e82e5757de59729f6c52b467a8575e69a41a4c (patch)
tree321f57b5896389a440616b932c4b000a8121c8af
parent9f18d5ce67252e97b0042976a12c5109fab05548 (diff)
Change the ffs inode allocation from using malloc to pool.
Saves approx. 256k memory on a GENERIC i386 and moves 670k out of kmem_map.
-rw-r--r--sys/ufs/ffs/ffs_extern.h4
-rw-r--r--sys/ufs/ffs/ffs_vfsops.c14
-rw-r--r--sys/ufs/ffs/ffs_vnops.c9
3 files changed, 18 insertions, 9 deletions
diff --git a/sys/ufs/ffs/ffs_extern.h b/sys/ufs/ffs/ffs_extern.h
index 93dda25df9c..38466edc2c6 100644
--- a/sys/ufs/ffs/ffs_extern.h
+++ b/sys/ufs/ffs/ffs_extern.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ffs_extern.h,v 1.11 2001/02/21 23:24:31 csapuntz Exp $ */
+/* $OpenBSD: ffs_extern.h,v 1.12 2001/03/22 00:11:36 art Exp $ */
/* $NetBSD: ffs_extern.h,v 1.4 1996/02/09 22:22:22 christos Exp $ */
/*-
@@ -167,3 +167,5 @@ extern int (**ffs_fifoop_p) __P((void *));
#else
#define FFS_FIFOOPS NULL
#endif
+
+extern struct pool ffs_ino_pool;
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index 8af365edf8a..503491f0696 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ffs_vfsops.c,v 1.32 2001/03/14 18:46:18 gluk Exp $ */
+/* $OpenBSD: ffs_vfsops.c,v 1.33 2001/03/22 00:11:36 art Exp $ */
/* $NetBSD: ffs_vfsops.c,v 1.19 1996/02/09 22:22:26 christos Exp $ */
/*
@@ -52,6 +52,7 @@
#include <sys/errno.h>
#include <sys/malloc.h>
#include <sys/sysctl.h>
+#include <sys/pool.h>
#include <dev/rndvar.h>
@@ -90,6 +91,8 @@ extern u_long nextgennumber;
* Called by main() when ufs is going to be mounted as root.
*/
+struct pool ffs_ino_pool;
+
int
ffs_mountroot()
{
@@ -967,7 +970,7 @@ ffs_vget(mp, ino, vpp)
struct buf *bp;
struct vnode *vp;
dev_t dev;
- int type, error;
+ int error;
ump = VFSTOUFS(mp);
dev = ump->um_dev;
@@ -984,8 +987,8 @@ retry:
#ifdef LOCKDEBUG
vp->v_flag |= VLOCKSWORK;
#endif
- type = ump->um_devvp->v_tag == VT_MFS ? M_MFSNODE : M_FFSNODE; /* XXX */
- MALLOC(ip, struct inode *, sizeof(struct inode), type, M_WAITOK);
+ /* XXX - we use the same pool for ffs and mfs */
+ ip = pool_get(&ffs_ino_pool, M_WAITOK);
bzero((caddr_t)ip, sizeof(struct inode));
lockinit(&ip->i_lock, PINOD, "inode", 0, 0);
vp->v_data = ip;
@@ -1199,6 +1202,9 @@ int
ffs_init(vfsp)
struct vfsconf *vfsp;
{
+
+ pool_init(&ffs_ino_pool, sizeof(struct inode), 0, 0, 0, "ffsino",
+ 0, pool_page_alloc_nointr, pool_page_free_nointr, M_FFSNODE);
softdep_initialize();
return (ufs_init(vfsp));
}
diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c
index 3044ee611fb..432a2fc0539 100644
--- a/sys/ufs/ffs/ffs_vnops.c
+++ b/sys/ufs/ffs/ffs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ffs_vnops.c,v 1.15 2001/03/20 17:30:07 gluk Exp $ */
+/* $OpenBSD: ffs_vnops.c,v 1.16 2001/03/22 00:11:36 art Exp $ */
/* $NetBSD: ffs_vnops.c,v 1.7 1996/05/11 18:27:24 mycroft Exp $ */
/*
@@ -49,6 +49,7 @@
#include <sys/vnode.h>
#include <sys/malloc.h>
#include <sys/signalvar.h>
+#include <sys/pool.h>
#include <vm/vm.h>
@@ -264,7 +265,7 @@ ffs_fsync(v)
softdep_fsync_mountdev(vp);
/*
- * Flush all dirty buffers associated with a vnode
+ * Flush all dirty buffers associated with a vnode.
*/
passes = NIADDR + 1;
skipmeta = 0;
@@ -357,8 +358,8 @@ ffs_reclaim(v)
if ((error = ufs_reclaim(vp, ap->a_p)) != 0)
return (error);
- FREE(vp->v_data, VFSTOUFS(vp->v_mount)->um_devvp->v_tag == VT_MFS ?
- M_MFSNODE : M_FFSNODE);
+ /* XXX - same for for both mfs and ffs */
+ pool_put(&ffs_ino_pool, vp->v_data);
vp->v_data = NULL;
return (0);
}