Commit 401494b1 authored by Andreas Gruenbacher's avatar Andreas Gruenbacher Committed by Linus Torvalds

[PATCH] ext3/EA: mbcache cleanup

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: default avatarAndreas Gruenbacher <agruen@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent be51a1d9
......@@ -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;
......
......@@ -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;
......
......@@ -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 mb_cache_op *cache_op,
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) +
......
......@@ -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 *,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment