blk-cgroup.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _BLK_CGROUP_H
  3. #define _BLK_CGROUP_H
  4. /*
  5. * Common Block IO controller cgroup interface
  6. *
  7. * Based on ideas and code from CFQ, CFS and BFQ:
  8. * Copyright (C) 2003 Jens Axboe <[email protected]>
  9. *
  10. * Copyright (C) 2008 Fabio Checconi <[email protected]>
  11. * Paolo Valente <[email protected]>
  12. *
  13. * Copyright (C) 2009 Vivek Goyal <[email protected]>
  14. * Nauman Rafique <[email protected]>
  15. */
  16. #include <linux/types.h>
  17. struct bio;
  18. struct cgroup_subsys_state;
  19. struct gendisk;
  20. #define FC_APPID_LEN 129
  21. #ifdef CONFIG_BLK_CGROUP
  22. extern struct cgroup_subsys_state * const blkcg_root_css;
  23. void blkcg_schedule_throttle(struct gendisk *disk, bool use_memdelay);
  24. void blkcg_maybe_throttle_current(void);
  25. bool blk_cgroup_congested(void);
  26. void blkcg_pin_online(struct cgroup_subsys_state *blkcg_css);
  27. void blkcg_unpin_online(struct cgroup_subsys_state *blkcg_css);
  28. struct list_head *blkcg_get_cgwb_list(struct cgroup_subsys_state *css);
  29. struct cgroup_subsys_state *bio_blkcg_css(struct bio *bio);
  30. #else /* CONFIG_BLK_CGROUP */
  31. #define blkcg_root_css ((struct cgroup_subsys_state *)ERR_PTR(-EINVAL))
  32. static inline void blkcg_maybe_throttle_current(void) { }
  33. static inline bool blk_cgroup_congested(void) { return false; }
  34. static inline struct cgroup_subsys_state *bio_blkcg_css(struct bio *bio)
  35. {
  36. return NULL;
  37. }
  38. #endif /* CONFIG_BLK_CGROUP */
  39. int blkcg_set_fc_appid(char *app_id, u64 cgrp_id, size_t app_id_len);
  40. char *blkcg_get_fc_appid(struct bio *bio);
  41. #endif /* _BLK_CGROUP_H */