request.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. uint16_t write_prio;
  27. /* IO error returned to s->bio */
  28. short error;
  29. unsigned long start_time;
  30. struct btree_op op;
  31. /* Anything past this point won't get zeroed in search_alloc() */
  32. struct keylist insert_keys;
  33. };
  34. unsigned bch_get_congested(struct cache_set *);
  35. void bch_data_insert(struct closure *cl);
  36. void bch_open_buckets_free(struct cache_set *);
  37. int bch_open_buckets_alloc(struct cache_set *);
  38. void bch_cached_dev_request_init(struct cached_dev *dc);
  39. void bch_flash_dev_request_init(struct bcache_device *d);
  40. extern struct kmem_cache *bch_search_cache, *bch_passthrough_cache;
  41. struct bch_cgroup {
  42. #ifdef CONFIG_CGROUP_BCACHE
  43. struct cgroup_subsys_state css;
  44. #endif
  45. /*
  46. * We subtract one from the index into bch_cache_modes[], so that
  47. * default == -1; this makes it so the rest match up with d->cache_mode,
  48. * and we use d->cache_mode if cgrp->cache_mode < 0
  49. */
  50. short cache_mode;
  51. bool verify;
  52. struct cache_stat_collector stats;
  53. };
  54. struct bch_cgroup *bch_bio_to_cgroup(struct bio *bio);
  55. #endif /* _BCACHE_REQUEST_H_ */