From 4d657aa39d5bcae60c2c11bf8fb66692ddd1c9e7 Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Fri, 28 Jul 2000 23:18:56 +0000 Subject: Merge with 2.4.0-test5 final. --- fs/buffer.c | 8 -------- fs/dcache.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++- fs/dquot.c | 9 --------- fs/ext2/super.c | 1 + fs/file_table.c | 19 +----------------- fs/namei.c | 17 ---------------- fs/openpromfs/inode.c | 2 +- 7 files changed, 56 insertions(+), 54 deletions(-) (limited to 'fs') diff --git a/fs/buffer.c b/fs/buffer.c index 8b5d19bda..dad4fbcfb 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -92,8 +92,6 @@ struct bh_free_head { }; static struct bh_free_head free_list[NR_SIZES]; -kmem_cache_t *bh_cachep; - static int grow_buffers(int size); static void __refile_buffer(struct buffer_head *); @@ -2302,12 +2300,6 @@ void __init buffer_init(unsigned long mempages) for(i = 0; i < NR_LIST; i++) lru_list[i] = NULL; - bh_cachep = kmem_cache_create("buffer_head", - sizeof(struct buffer_head), - 0, - SLAB_HWCACHE_ALIGN, NULL, NULL); - if(!bh_cachep) - panic("Cannot create buffer head SLAB cache\n"); } diff --git a/fs/dcache.c b/fs/dcache.c index 8c27b5f94..729b48855 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -1168,7 +1168,7 @@ out: return ino; } -void __init dcache_init(unsigned long mempages) +static void __init dcache_init(unsigned long mempages) { struct list_head *d; unsigned long order; @@ -1226,3 +1226,55 @@ void __init dcache_init(unsigned long mempages) i--; } while (i); } + +/* SLAB cache for __getname() consumers */ +kmem_cache_t *names_cachep; + +/* SLAB cache for files_struct structures */ +kmem_cache_t *files_cachep; + +/* SLAB cache for file structures */ +kmem_cache_t *filp_cachep; + +/* SLAB cache for dquot structures */ +kmem_cache_t *dquot_cachep; + +/* SLAB cache for buffer_head structures */ +kmem_cache_t *bh_cachep; + +void __init vfs_caches_init(unsigned long mempages) +{ + bh_cachep = kmem_cache_create("buffer_head", + sizeof(struct buffer_head), 0, + SLAB_HWCACHE_ALIGN, NULL, NULL); + if(!bh_cachep) + panic("Cannot create buffer head SLAB cache\n"); + + names_cachep = kmem_cache_create("names_cache", + PAGE_SIZE, 0, + SLAB_HWCACHE_ALIGN, NULL, NULL); + if (!names_cachep) + panic("Cannot create names SLAB cache"); + + files_cachep = kmem_cache_create("files_cache", + sizeof(struct files_struct), 0, + SLAB_HWCACHE_ALIGN, NULL, NULL); + if (!files_cachep) + panic("Cannot create files SLAB cache"); + + filp_cachep = kmem_cache_create("filp", + sizeof(struct file), 0, + SLAB_HWCACHE_ALIGN, NULL, NULL); + if(!filp_cachep) + panic("Cannot create filp SLAB cache"); + +#if defined (CONFIG_QUOTA) + dquot_cachep = kmem_cache_create("dquot", + sizeof(struct dquot), sizeof(unsigned long) * 4, + SLAB_HWCACHE_ALIGN, NULL, NULL); + if (!dquot_cachep) + panic("Cannot create dquot SLAB cache"); +#endif + + dcache_init(mempages); +} diff --git a/fs/dquot.c b/fs/dquot.c index 15f7dad8f..2271f4746 100644 --- a/fs/dquot.c +++ b/fs/dquot.c @@ -64,8 +64,6 @@ int max_dquots = NR_DQUOTS; static char quotamessage[MAX_QUOTA_MESSAGE]; static char *quotatypes[] = INITQFNAMES; -static kmem_cache_t *dquot_cachep; - static inline struct quota_mount_options *sb_dqopt(struct super_block *sb) { return &sb->s_dquot; @@ -1345,13 +1343,6 @@ void __init dquot_init_hash(void) { printk(KERN_NOTICE "VFS: Diskquotas version %s initialized\n", __DQUOT_VERSION__); - dquot_cachep = kmem_cache_create("dquot", sizeof(struct dquot), - sizeof(unsigned long) * 4, - SLAB_HWCACHE_ALIGN, NULL, NULL); - - if (!dquot_cachep) - panic("Cannot create dquot SLAB cache\n"); - memset(dquot_hash, 0, sizeof(dquot_hash)); memset((caddr_t)&dqstats, 0, sizeof(dqstats)); } diff --git a/fs/ext2/super.c b/fs/ext2/super.c index 1ba0b0f79..e395c75a1 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c @@ -653,6 +653,7 @@ int ext2_remount (struct super_block * sb, int * flags, char * data) /* * Allow the "check" option to be passed as a remount option. */ + new_mount_opt = sb->u.ext2_sb.s_mount_opt; if (!parse_options (data, &tmp, &resuid, &resgid, &new_mount_opt)) return -EINVAL; diff --git a/fs/file_table.c b/fs/file_table.c index f50058828..54538ddf0 100644 --- a/fs/file_table.c +++ b/fs/file_table.c @@ -12,9 +12,6 @@ #include #include -/* SLAB cache for filp's. */ -static kmem_cache_t *filp_cache; - /* sysctl tunables... */ struct files_stat_struct files_stat = {0, 0, NR_FILE}; @@ -25,20 +22,6 @@ static LIST_HEAD(free_list); /* public *and* exported. Not pretty! */ spinlock_t files_lock = SPIN_LOCK_UNLOCKED; -void __init file_table_init(void) -{ - filp_cache = kmem_cache_create("filp", sizeof(struct file), - 0, - SLAB_HWCACHE_ALIGN, NULL, NULL); - if(!filp_cache) - panic("VFS: Cannot alloc filp SLAB cache."); - /* - * We could allocate the reserved files here, but really - * shouldn't need to: the normal boot process will create - * plenty of free files. - */ -} - /* Find an unused file structure and return a pointer to it. * Returns NULL, if there are no more free file structures or * we run out of memory. @@ -78,7 +61,7 @@ struct file * get_empty_filp(void) */ if (files_stat.nr_files < files_stat.max_files) { file_list_unlock(); - f = kmem_cache_alloc(filp_cache, SLAB_KERNEL); + f = kmem_cache_alloc(filp_cachep, SLAB_KERNEL); file_list_lock(); if (f) { files_stat.nr_files++; diff --git a/fs/namei.c b/fs/namei.c index b85a6419d..55658cd6b 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -1954,20 +1954,3 @@ struct inode_operations page_symlink_inode_operations = { readlink: page_readlink, follow_link: page_follow_link, }; - -/* SLAB cache for name blocks */ -kmem_cache_t *names_cachep; - -static int __init namecache_init(void) -{ - names_cachep = kmem_cache_create("names_cache", - PAGE_SIZE, - 0, - SLAB_HWCACHE_ALIGN, - NULL, NULL); - if (!names_cachep) - panic("Cannot create names cache"); - return 0; -} - -module_init(namecache_init) diff --git a/fs/openpromfs/inode.c b/fs/openpromfs/inode.c index 430f7b412..abd6ec28e 100644 --- a/fs/openpromfs/inode.c +++ b/fs/openpromfs/inode.c @@ -1,4 +1,4 @@ -/* $Id: inode.c,v 1.11 2000/05/22 07:29:42 davem Exp $ +/* $Id: inode.c,v 1.12 2000/07/13 08:06:42 davem Exp $ * openpromfs.c: /proc/openprom handling routines * * Copyright (C) 1996-1999 Jakub Jelinek (jakub@redhat.com) -- cgit v1.2.3