mbcache.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. File: linux/mbcache.h
  3. (C) 2001 by Andreas Gruenbacher, <a.gruenbacher@computer.org>
  4. */
  5. struct mb_cache_entry {
  6. struct list_head e_lru_list;
  7. struct mb_cache *e_cache;
  8. unsigned short e_used;
  9. unsigned short e_queued;
  10. atomic_t e_refcnt;
  11. struct block_device *e_bdev;
  12. sector_t e_block;
  13. struct hlist_bl_node e_block_list;
  14. struct {
  15. struct hlist_bl_node o_list;
  16. unsigned int o_key;
  17. } e_index;
  18. struct hlist_bl_head *e_block_hash_p;
  19. struct hlist_bl_head *e_index_hash_p;
  20. };
  21. struct mb_cache {
  22. struct list_head c_cache_list;
  23. const char *c_name;
  24. atomic_t c_entry_count;
  25. int c_max_entries;
  26. int c_bucket_bits;
  27. struct kmem_cache *c_entry_cache;
  28. struct hlist_bl_head *c_block_hash;
  29. struct hlist_bl_head *c_index_hash;
  30. };
  31. /* Functions on caches */
  32. struct mb_cache *mb_cache_create(const char *, int);
  33. void mb_cache_shrink(struct block_device *);
  34. void mb_cache_destroy(struct mb_cache *);
  35. /* Functions on cache entries */
  36. struct mb_cache_entry *mb_cache_entry_alloc(struct mb_cache *, gfp_t);
  37. int mb_cache_entry_insert(struct mb_cache_entry *, struct block_device *,
  38. sector_t, unsigned int);
  39. void mb_cache_entry_release(struct mb_cache_entry *);
  40. void mb_cache_entry_free(struct mb_cache_entry *);
  41. struct mb_cache_entry *mb_cache_entry_get(struct mb_cache *,
  42. struct block_device *,
  43. sector_t);
  44. struct mb_cache_entry *mb_cache_entry_find_first(struct mb_cache *cache,
  45. struct block_device *,
  46. unsigned int);
  47. struct mb_cache_entry *mb_cache_entry_find_next(struct mb_cache_entry *,
  48. struct block_device *,
  49. unsigned int);