From 3ae149efacf5348716c38c2e9a03c0be7bccc3b8 Mon Sep 17 00:00:00 2001 From: thorpej Date: Tue, 1 Sep 1998 03:20:46 +0000 Subject: [PATCH] Use the pool allocator and "nointr" pool page allocator for ext2fs inodes. --- sys/ufs/ext2fs/ext2fs_extern.h | 4 +++- sys/ufs/ext2fs/ext2fs_vfsops.c | 15 ++++++++++++--- sys/ufs/ext2fs/ext2fs_vnops.c | 5 +++-- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/sys/ufs/ext2fs/ext2fs_extern.h b/sys/ufs/ext2fs/ext2fs_extern.h index 3776e6c225cf..1221359f72de 100644 --- a/sys/ufs/ext2fs/ext2fs_extern.h +++ b/sys/ufs/ext2fs/ext2fs_extern.h @@ -1,4 +1,4 @@ -/* $NetBSD: ext2fs_extern.h,v 1.5 1998/06/24 20:58:47 sommerfe Exp $ */ +/* $NetBSD: ext2fs_extern.h,v 1.6 1998/09/01 03:20:46 thorpej Exp $ */ /*- * Copyright (c) 1997 Manuel Bouyer. @@ -53,6 +53,8 @@ struct vnode; struct mbuf; struct componentname; +extern struct pool ext2fs_inode_pool; /* memory pool for inodes */ + __BEGIN_DECLS /* ext2fs_alloc.c */ diff --git a/sys/ufs/ext2fs/ext2fs_vfsops.c b/sys/ufs/ext2fs/ext2fs_vfsops.c index 679d7b287adb..36f029204864 100644 --- a/sys/ufs/ext2fs/ext2fs_vfsops.c +++ b/sys/ufs/ext2fs/ext2fs_vfsops.c @@ -1,4 +1,4 @@ -/* $NetBSD: ext2fs_vfsops.c,v 1.16 1998/08/09 20:15:39 perry Exp $ */ +/* $NetBSD: ext2fs_vfsops.c,v 1.17 1998/09/01 03:20:46 thorpej Exp $ */ /* * Copyright (c) 1997 Manuel Bouyer. @@ -57,6 +57,7 @@ #include #include #include +#include #include #include @@ -105,6 +106,8 @@ struct vfsops ext2fs_vfsops = { ext2fs_vnodeopv_descs, }; +struct pool ext2fs_inode_pool; + extern u_long ext2gennumber; void @@ -116,7 +119,13 @@ ext2fs_init() return; done = 1; ufs_ihashinit(); - return; + + /* + * XXX Same structure as FFS inodes? Should we share a common pool? + */ + pool_init(&ext2fs_inode_pool, sizeof(struct inode), 0, 0, 0, + "ext2fsinopl", 0, pool_page_alloc_nointr, pool_page_free_nointr, + M_EXT2FSNODE); } /* @@ -873,7 +882,7 @@ ext2fs_vget(mp, ino, vpp) lockmgr(&ufs_hashlock, LK_RELEASE, 0); return (error); } - MALLOC(ip, struct inode *, sizeof(struct inode), M_EXT2FSNODE, M_WAITOK); + ip = pool_get(&ext2fs_inode_pool, PR_WAITOK); memset((caddr_t)ip, 0, sizeof(struct inode)); lockinit(&ip->i_lock, PINOD, "inode", 0, 0); vp->v_data = ip; diff --git a/sys/ufs/ext2fs/ext2fs_vnops.c b/sys/ufs/ext2fs/ext2fs_vnops.c index 691d4cd51266..aa68c40f88bb 100644 --- a/sys/ufs/ext2fs/ext2fs_vnops.c +++ b/sys/ufs/ext2fs/ext2fs_vnops.c @@ -1,4 +1,4 @@ -/* $NetBSD: ext2fs_vnops.c,v 1.13 1998/08/09 20:15:39 perry Exp $ */ +/* $NetBSD: ext2fs_vnops.c,v 1.14 1998/09/01 03:20:46 thorpej Exp $ */ /* * Copyright (c) 1997 Manuel Bouyer. @@ -58,6 +58,7 @@ #include #include #include +#include #include #include @@ -1416,7 +1417,7 @@ ext2fs_reclaim(v) ip->i_devvp = 0; } - FREE(vp->v_data, M_EXT2FSNODE); + pool_put(&ext2fs_inode_pool, vp->v_data); vp->v_data = NULL; return (0); }