diff -urN -X dontdiff linux/fs/dcache.c fscache/fs/dcache.c --- linux/fs/dcache.c Mon Aug 7 08:57:57 2000 +++ fscache/fs/dcache.c Mon Aug 7 15:50:40 2000 @@ -1240,6 +1240,9 @@ /* SLAB cache for buffer_head structures */ kmem_cache_t *bh_cachep; +/* SLAB cache for fs_struct structures */ +kmem_cache_t *fs_cachep; + void __init vfs_caches_init(unsigned long mempages) { bh_cachep = kmem_cache_create("buffer_head", @@ -1253,6 +1256,12 @@ SLAB_HWCACHE_ALIGN, NULL, NULL); if (!names_cachep) panic("Cannot create names SLAB cache"); + + fs_cachep = kmem_cache_create("fs_cache", + sizeof(struct fs_struct), 0, + SLAB_HWCACHE_ALIGN, NULL, NULL); + if (!fs_cachep) + panic("Cannot create fs_struct SLAB cache"); files_cachep = kmem_cache_create("files_cache", sizeof(struct files_struct), 0, diff -urN -X dontdiff linux/include/linux/slab.h fscache/include/linux/slab.h --- linux/include/linux/slab.h Mon Aug 7 08:57:58 2000 +++ fscache/include/linux/slab.h Mon Aug 7 15:50:49 2000 @@ -72,6 +72,7 @@ extern kmem_cache_t *filp_cachep; extern kmem_cache_t *dquot_cachep; extern kmem_cache_t *bh_cachep; +extern kmem_cache_t *fs_cachep; #ifdef CONFIG_SMP extern unsigned long slab_cache_drain_mask; diff -urN -X dontdiff linux/kernel/exit.c fscache/kernel/exit.c --- linux/kernel/exit.c Mon Aug 7 08:57:58 2000 +++ fscache/kernel/exit.c Mon Aug 7 15:48:26 2000 @@ -229,7 +229,7 @@ dput(fs->altroot); mntput(fs->altrootmnt); } - kfree(fs); + kmem_cache_free(fs_cachep, fs); } } diff -urN -X dontdiff linux/kernel/fork.c fscache/kernel/fork.c --- linux/kernel/fork.c Mon Aug 7 08:57:58 2000 +++ fscache/kernel/fork.c Mon Aug 7 15:49:38 2000 @@ -318,7 +318,7 @@ static inline struct fs_struct *__copy_fs_struct(struct fs_struct *old) { - struct fs_struct *fs = kmalloc(sizeof(*old), GFP_KERNEL); + struct fs_struct *fs = kmem_cache_alloc(fs_cachep, GFP_KERNEL); /* We don't need to lock fs - think why ;-) */ if (fs) { atomic_set(&fs->count, 1);