request.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #ifndef _BCACHE_REQUEST_H_
  2. #define _BCACHE_REQUEST_H_
  3. #include <linux/cgroup.h>
  4. struct search {
  5. /* Stack frame for bio_complete */
  6. struct closure cl;
  7. struct closure btree;
  8. struct bcache_device *d;
  9. struct cache_set *c;
  10. struct task_struct *task;
  11. struct bbio bio;
  12. struct bio *orig_bio;
  13. struct bio *cache_miss;
  14. /* Bio to be inserted into the cache */
  15. struct bio *cache_bio;
  16. unsigned cache_bio_sectors;
  17. unsigned inode;
  18. unsigned recoverable:1;
  19. unsigned unaligned_bvec:1;
  20. unsigned write:1;
  21. unsigned writeback:1;
  22. unsigned csum:1;
  23. unsigned bypass:1;
  24. unsigned flush_journal:1;
  25. unsigned insert_data_done:1;
  26. unsigned replace:1;
  27. unsigned insert_collision:1;
  28. uint16_t write_prio;
  29. /* IO error returned to s->bio */
  30. short error;
  31. unsigned long start_time;
  32. struct btree_op op;
  33. /* Anything past this point won't get zeroed in search_alloc() */
  34. struct keylist insert_keys;
  35. BKEY_PADDED(replace_key);
  36. };
  37. unsigned bch_get_congested(struct cache_set *);
  38. void bch_data_insert(struct closure *cl);
  39. void bch_open_buckets_free(struct cache_set *);
  40. int bch_open_buckets_alloc(struct cache_set *);
  41. void bch_cached_dev_request_init(struct cached_dev *dc);
  42. void bch_flash_dev_request_init(struct bcache_device *d);
  43. extern struct kmem_cache *bch_search_cache, *bch_passthrough_cache;
  44. struct bch_cgroup {
  45. #ifdef CONFIG_CGROUP_BCACHE
  46. struct cgroup_subsys_state css;
  47. #endif
  48. /*
  49. * We subtract one from the index into bch_cache_modes[], so that
  50. * default == -1; this makes it so the rest match up with d->cache_mode,
  51. * and we use d->cache_mode if cgrp->cache_mode < 0
  52. */
  53. short cache_mode;
  54. bool verify;
  55. struct cache_stat_collector stats;
  56. };
  57. struct bch_cgroup *bch_bio_to_cgroup(struct bio *bio);
  58. #endif /* _BCACHE_REQUEST_H_ */