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
;
39 struct block_device
*e_bdev
;
41 struct list_head e_block_list
;
42 struct mb_cache_entry_index e_indexes
[0];
45 /* Functions on caches */
47 struct mb_cache
* mb_cache_create(const char *, struct mb_cache_op
*, size_t,
49 void mb_cache_shrink(struct mb_cache
*, struct block_device
*);
50 void mb_cache_destroy(struct mb_cache
*);
52 /* Functions on cache entries */
54 struct mb_cache_entry
*mb_cache_entry_alloc(struct mb_cache
*);
55 int mb_cache_entry_insert(struct mb_cache_entry
*, struct block_device
*,
56 sector_t
, unsigned int[]);
57 void mb_cache_entry_rehash(struct mb_cache_entry
*, unsigned int[]);
58 void mb_cache_entry_release(struct mb_cache_entry
*);
59 void mb_cache_entry_takeout(struct mb_cache_entry
*);
60 void mb_cache_entry_free(struct mb_cache_entry
*);
61 struct mb_cache_entry
*mb_cache_entry_dup(struct mb_cache_entry
*);
62 struct mb_cache_entry
*mb_cache_entry_get(struct mb_cache
*,
63 struct block_device
*,
65 #if !defined(MB_CACHE_INDEXES_COUNT) || (MB_CACHE_INDEXES_COUNT > 0)
66 struct mb_cache_entry
*mb_cache_entry_find_first(struct mb_cache
*cache
, int,
67 struct block_device
*,
69 struct mb_cache_entry
*mb_cache_entry_find_next(struct mb_cache_entry
*, int,
70 struct block_device
*,