From: Andreas Gruenbacher There is no need to export struct mb_cache outside mbcache.c. Move struct mb_cache to fs/mbcache.c and remove the superfluous struct mb_cache_entry_index declaration. Signed-off-by: Andreas Gruenbacher Signed-off-by: Andrew Morton --- 25-akpm/fs/ext2/xattr.c | 2 +- 25-akpm/fs/ext3/xattr.c | 2 +- 25-akpm/fs/mbcache.c | 16 +++++++++++++++- 25-akpm/include/linux/mbcache.h | 35 ++++++++--------------------------- 4 files changed, 25 insertions(+), 30 deletions(-) diff -puN fs/ext2/xattr.c~ext3-ea-mbcache-cleanup fs/ext2/xattr.c --- 25/fs/ext2/xattr.c~ext3-ea-mbcache-cleanup Tue Jan 11 14:39:46 2005 +++ 25-akpm/fs/ext2/xattr.c Tue Jan 11 14:39:46 2005 @@ -1016,7 +1016,7 @@ init_ext2_xattr(void) { ext2_xattr_cache = mb_cache_create("ext2_xattr", NULL, sizeof(struct mb_cache_entry) + - sizeof(struct mb_cache_entry_index), 1, 6); + sizeof(((struct mb_cache_entry *) 0)->e_indexes[0]), 1, 6); if (!ext2_xattr_cache) return -ENOMEM; return 0; diff -puN fs/ext3/xattr.c~ext3-ea-mbcache-cleanup fs/ext3/xattr.c --- 25/fs/ext3/xattr.c~ext3-ea-mbcache-cleanup Tue Jan 11 14:39:46 2005 +++ 25-akpm/fs/ext3/xattr.c Tue Jan 11 14:39:46 2005 @@ -1080,7 +1080,7 @@ init_ext3_xattr(void) { ext3_xattr_cache = mb_cache_create("ext3_xattr", NULL, sizeof(struct mb_cache_entry) + - sizeof(struct mb_cache_entry_index), 1, 6); + sizeof(((struct mb_cache_entry *) 0)->e_indexes[0]), 1, 6); if (!ext3_xattr_cache) return -ENOMEM; return 0; diff -puN fs/mbcache.c~ext3-ea-mbcache-cleanup fs/mbcache.c --- 25/fs/mbcache.c~ext3-ea-mbcache-cleanup Tue Jan 11 14:39:46 2005 +++ 25-akpm/fs/mbcache.c Tue Jan 11 14:39:46 2005 @@ -72,6 +72,20 @@ EXPORT_SYMBOL(mb_cache_entry_find_first) EXPORT_SYMBOL(mb_cache_entry_find_next); #endif +struct mb_cache { + struct list_head c_cache_list; + const char *c_name; + struct mb_cache_op c_op; + atomic_t c_entry_count; + int c_bucket_bits; +#ifndef MB_CACHE_INDEXES_COUNT + int c_indexes_count; +#endif + kmem_cache_t *c_entry_cache; + struct list_head *c_block_hash; + struct list_head *c_indexes_hash[0]; +}; + /* * Global data: list of all mbcache's, lru list, and a spinlock for @@ -229,7 +243,7 @@ mb_cache_create(const char *name, struct struct mb_cache *cache = NULL; if(entry_size < sizeof(struct mb_cache_entry) + - indexes_count * sizeof(struct mb_cache_entry_index)) + indexes_count * sizeof(((struct mb_cache_entry *) 0)->e_indexes[0])) return NULL; cache = kmalloc(sizeof(struct mb_cache) + diff -puN include/linux/mbcache.h~ext3-ea-mbcache-cleanup include/linux/mbcache.h --- 25/include/linux/mbcache.h~ext3-ea-mbcache-cleanup Tue Jan 11 14:39:46 2005 +++ 25-akpm/include/linux/mbcache.h Tue Jan 11 14:39:46 2005 @@ -7,31 +7,6 @@ /* Hardwire the number of additional indexes */ #define MB_CACHE_INDEXES_COUNT 1 -struct mb_cache_entry; - -struct mb_cache_op { - int (*free)(struct mb_cache_entry *, int); -}; - -struct mb_cache { - struct list_head c_cache_list; - const char *c_name; - struct mb_cache_op c_op; - atomic_t c_entry_count; - int c_bucket_bits; -#ifndef MB_CACHE_INDEXES_COUNT - int c_indexes_count; -#endif - kmem_cache_t *c_entry_cache; - struct list_head *c_block_hash; - struct list_head *c_indexes_hash[0]; -}; - -struct mb_cache_entry_index { - struct list_head o_list; - unsigned int o_key; -}; - struct mb_cache_entry { struct list_head e_lru_list; struct mb_cache *e_cache; @@ -39,7 +14,14 @@ struct mb_cache_entry { struct block_device *e_bdev; sector_t e_block; struct list_head e_block_list; - struct mb_cache_entry_index e_indexes[0]; + struct { + struct list_head o_list; + unsigned int o_key; + } e_indexes[0]; +}; + +struct mb_cache_op { + int (*free)(struct mb_cache_entry *, int); }; /* Functions on caches */ @@ -54,7 +36,6 @@ void mb_cache_destroy(struct mb_cache *) struct mb_cache_entry *mb_cache_entry_alloc(struct mb_cache *); int mb_cache_entry_insert(struct mb_cache_entry *, struct block_device *, sector_t, unsigned int[]); -void mb_cache_entry_rehash(struct mb_cache_entry *, unsigned int[]); void mb_cache_entry_release(struct mb_cache_entry *); void mb_cache_entry_free(struct mb_cache_entry *); struct mb_cache_entry *mb_cache_entry_get(struct mb_cache *, _