4 (C) 2001 by Andreas Gruenbacher, <a.gruenbacher@computer.org>
7 /* Hardwire the number of additional indexes */
8 #define MB_CACHE_INDEXES_COUNT 1
10 struct mb_cache_entry;
13 int (*free)(struct mb_cache_entry *, int);
17 struct list_head c_cache_list;
19 struct mb_cache_op c_op;
20 atomic_t c_entry_count;
22 #ifndef MB_CACHE_INDEXES_COUNT
25 kmem_cache_t *c_entry_cache;
26 struct list_head *c_block_hash;
27 struct list_head *c_indexes_hash[0];
30 struct mb_cache_entry_index {
31 struct list_head o_list;
35 struct mb_cache_entry {
36 struct list_head e_lru_list;
37 struct mb_cache *e_cache;
38 unsigned short e_used;
39 unsigned short e_queued;
40 struct block_device *e_bdev;
42 struct list_head e_block_list;
43 struct mb_cache_entry_index e_indexes[0];
46 /* Functions on caches */
48 struct mb_cache * mb_cache_create(const char *, struct mb_cache_op *, size_t,
50 void mb_cache_shrink(struct mb_cache *, struct block_device *);
51 void mb_cache_destroy(struct mb_cache *);
53 /* Functions on cache entries */
55 struct mb_cache_entry *mb_cache_entry_alloc(struct mb_cache *);
56 int mb_cache_entry_insert(struct mb_cache_entry *, struct block_device *,
57 sector_t, unsigned int[]);
58 void mb_cache_entry_rehash(struct mb_cache_entry *, unsigned int[]);
59 void mb_cache_entry_release(struct mb_cache_entry *);
60 void mb_cache_entry_free(struct mb_cache_entry *);
61 struct mb_cache_entry *mb_cache_entry_get(struct mb_cache *,
62 struct block_device *,
64 #if !defined(MB_CACHE_INDEXES_COUNT) || (MB_CACHE_INDEXES_COUNT > 0)
65 struct mb_cache_entry *mb_cache_entry_find_first(struct mb_cache *cache, int,
66 struct block_device *,
68 struct mb_cache_entry *mb_cache_entry_find_next(struct mb_cache_entry *, int,
69 struct block_device *,