Use the pool allocator and the "nointr" pool page allocator for LFS inodes.

This commit is contained in:
thorpej 1998-09-01 03:26:05 +00:00
parent 3ae149efac
commit 38cf17f475
4 changed files with 20 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_alloc.c,v 1.14 1998/06/24 20:58:48 sommerfe Exp $ */
/* $NetBSD: lfs_alloc.c,v 1.15 1998/09/01 03:26:05 thorpej Exp $ */
/*
* Copyright (c) 1991, 1993
@ -47,6 +47,7 @@
#include <sys/syslog.h>
#include <sys/mount.h>
#include <sys/malloc.h>
#include <sys/pool.h>
#include <vm/vm.h>
@ -185,7 +186,7 @@ lfs_vcreate(mp, ino, vpp)
ump = VFSTOUFS(mp);
/* Initialize the inode. */
MALLOC(ip, struct inode *, sizeof(struct inode), M_LFSNODE, M_WAITOK);
ip = pool_get(&lfs_inode_pool, PR_WAITOK);
lockinit(&ip->i_lock, PINOD, "lfsinode", 0, 0);
(*vpp)->v_data = ip;
ip->i_vnode = *vpp;

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_extern.h,v 1.9 1998/06/24 20:58:48 sommerfe Exp $ */
/* $NetBSD: lfs_extern.h,v 1.10 1998/09/01 03:26:05 thorpej Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
@ -51,6 +51,8 @@ struct lfs;
struct segment;
struct ucred;
extern struct pool lfs_inode_pool; /* memory pool for inodes */
__BEGIN_DECLS
/* lfs_alloc.c */
int lfs_vcreate __P((struct mount *, ino_t, struct vnode **));

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_vfsops.c,v 1.22 1998/06/24 20:58:48 sommerfe Exp $ */
/* $NetBSD: lfs_vfsops.c,v 1.23 1998/09/01 03:26:05 thorpej Exp $ */
/*
* Copyright (c) 1989, 1991, 1993, 1994
@ -53,6 +53,7 @@
#include <sys/ioctl.h>
#include <sys/errno.h>
#include <sys/malloc.h>
#include <sys/pool.h>
#include <sys/socket.h>
#include <miscfs/specfs/specdev.h>
@ -96,6 +97,8 @@ struct vfsops lfs_vfsops = {
lfs_vnodeopv_descs,
};
struct pool lfs_inode_pool;
/*
* Initialize the filesystem, most work done by ufs_init.
*/
@ -103,6 +106,13 @@ void
lfs_init()
{
ufs_init();
/*
* XXX Same structure as FFS inodes? Should we share a common pool?
*/
pool_init(&lfs_inode_pool, sizeof(struct inode), 0, 0, 0,
"lfsinopl", 0, pool_page_alloc_nointr, pool_page_free_nointr,
M_LFSNODE);
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_vnops.c,v 1.18 1998/06/24 20:58:48 sommerfe Exp $ */
/* $NetBSD: lfs_vnops.c,v 1.19 1998/09/01 03:26:05 thorpej Exp $ */
/*
* Copyright (c) 1986, 1989, 1991, 1993, 1995
@ -48,6 +48,7 @@
#include <sys/mount.h>
#include <sys/vnode.h>
#include <sys/malloc.h>
#include <sys/pool.h>
#include <sys/signalvar.h>
#include <vm/vm.h>
@ -519,7 +520,7 @@ lfs_reclaim(v)
if ((error = ufs_reclaim(vp, ap->a_p)))
return (error);
FREE(vp->v_data, M_LFSNODE);
pool_put(&lfs_inode_pool, vp->v_data);
vp->v_data = NULL;
return (0);
}