request.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #ifndef _BCACHE_REQUEST_H_
  2. #define _BCACHE_REQUEST_H_
  3. #include <linux/cgroup.h>
  4. struct data_insert_op {
  5. struct closure cl;
  6. struct cache_set *c;
  7. struct task_struct *task;
  8. struct bio *bio;
  9. unsigned inode;
  10. uint16_t write_prio;
  11. short error;
  12. unsigned bypass:1;
  13. unsigned writeback:1;
  14. unsigned flush_journal:1;
  15. unsigned csum:1;
  16. unsigned replace:1;
  17. unsigned replace_collision:1;
  18. unsigned insert_data_done:1;
  19. /* Anything past this point won't get zeroed in search_alloc() */
  20. struct keylist insert_keys;
  21. BKEY_PADDED(replace_key);
  22. };
  23. unsigned bch_get_congested(struct cache_set *);
  24. void bch_data_insert(struct closure *cl);
  25. void bch_open_buckets_free(struct cache_set *);
  26. int bch_open_buckets_alloc(struct cache_set *);
  27. void bch_cached_dev_request_init(struct cached_dev *dc);
  28. void bch_flash_dev_request_init(struct bcache_device *d);
  29. extern struct kmem_cache *bch_search_cache, *bch_passthrough_cache;
  30. struct bch_cgroup {
  31. #ifdef CONFIG_CGROUP_BCACHE
  32. struct cgroup_subsys_state css;
  33. #endif
  34. /*
  35. * We subtract one from the index into bch_cache_modes[], so that
  36. * default == -1; this makes it so the rest match up with d->cache_mode,
  37. * and we use d->cache_mode if cgrp->cache_mode < 0
  38. */
  39. short cache_mode;
  40. bool verify;
  41. struct cache_stat_collector stats;
  42. };
  43. struct bch_cgroup *bch_bio_to_cgroup(struct bio *bio);
  44. #endif /* _BCACHE_REQUEST_H_ */