diff -urN -X dontdiff linux/fs/dcache.c mnt/fs/dcache.c --- linux/fs/dcache.c Tue Aug 15 13:43:01 2000 +++ mnt/fs/dcache.c Tue Aug 15 14:40:28 2000 @@ -1239,6 +1239,9 @@ /* SLAB cache for buffer_head structures */ kmem_cache_t *bh_cachep; +/* SLAB cache for vfsmount structures */ +kmem_cache_t *mnt_cachep; + void __init vfs_caches_init(unsigned long mempages) { bh_cachep = kmem_cache_create("buffer_head", @@ -1258,6 +1261,13 @@ SLAB_HWCACHE_ALIGN, NULL, NULL); if(!filp_cachep) panic("Cannot create filp SLAB cache"); + + mnt_cachep = kmem_cache_create("mnt_cache", + sizeof(struct vfsmount), 0, + SLAB_HWCACHE_ALIGN, NULL, NULL); + if(!mnt_cachep) + panic("Cannot create mnt SLAB cache"); + #if defined (CONFIG_QUOTA) dquot_cachep = kmem_cache_create("dquot", diff -urN -X dontdiff linux/fs/super.c mnt/fs/super.c --- linux/fs/super.c Tue Aug 15 13:43:01 2000 +++ mnt/fs/super.c Tue Aug 15 14:42:25 2000 @@ -303,6 +303,10 @@ * support for such beasts we'll have to change prototype. */ +#define alloc_mnt() \ + ((struct vfsmount *)kmem_cache_alloc(mnt_cachep, SLAB_KERNEL)) +#define free_mnt(mnt) kmem_cache_free(mnt_cachep, (mnt)) + static struct vfsmount *add_vfsmnt(struct nameidata *nd, struct dentry *root, const char *dev_name) @@ -311,7 +315,7 @@ struct super_block *sb = root->d_inode->i_sb; char *name; - mnt = kmalloc(sizeof(struct vfsmount), GFP_KERNEL); + mnt = alloc_mnt(); if (!mnt) goto out; memset(mnt, 0, sizeof(struct vfsmount)); @@ -355,7 +359,7 @@ spin_unlock(&dcache_lock); if (mnt->mnt_devname) kfree(mnt->mnt_devname); - kfree(mnt); + free_mnt(mnt); return NULL; } @@ -424,7 +428,7 @@ dput(mnt->mnt_root); if (mnt->mnt_devname) kfree(mnt->mnt_devname); - kfree(mnt); + free_mnt(mnt); } diff -urN -X dontdiff linux/include/linux/slab.h mnt/include/linux/slab.h --- linux/include/linux/slab.h Tue Aug 15 13:43:01 2000 +++ mnt/include/linux/slab.h Tue Aug 15 14:43:12 2000 @@ -75,6 +75,7 @@ extern kmem_cache_t *bh_cachep; extern kmem_cache_t *fs_cachep; extern kmem_cache_t *sigact_cachep; +extern kmem_cache_t *mnt_cachep; #ifdef CONFIG_SMP extern unsigned long slab_cache_drain_mask;