1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 2eea8f41cSTejun Heo #ifndef _BLK_CGROUP_H 3eea8f41cSTejun Heo #define _BLK_CGROUP_H 4eea8f41cSTejun Heo /* 5eea8f41cSTejun Heo * Common Block IO controller cgroup interface 6eea8f41cSTejun Heo * 7eea8f41cSTejun Heo * Based on ideas and code from CFQ, CFS and BFQ: 8eea8f41cSTejun Heo * Copyright (C) 2003 Jens Axboe <[email protected]> 9eea8f41cSTejun Heo * 10eea8f41cSTejun Heo * Copyright (C) 2008 Fabio Checconi <[email protected]> 11eea8f41cSTejun Heo * Paolo Valente <[email protected]> 12eea8f41cSTejun Heo * 13eea8f41cSTejun Heo * Copyright (C) 2009 Vivek Goyal <[email protected]> 14eea8f41cSTejun Heo * Nauman Rafique <[email protected]> 15eea8f41cSTejun Heo */ 16eea8f41cSTejun Heo 17*c97ab271SChristoph Hellwig #include <linux/types.h> 18*c97ab271SChristoph Hellwig 19*c97ab271SChristoph Hellwig struct bio; 20*c97ab271SChristoph Hellwig struct cgroup_subsys_state; 21*c97ab271SChristoph Hellwig struct request_queue; 22eea8f41cSTejun Heo 23d2bcbeabSMuneendra Kumar #define FC_APPID_LEN 129 24d2bcbeabSMuneendra Kumar 25eea8f41cSTejun Heo #ifdef CONFIG_BLK_CGROUP 26496d5e75STejun Heo extern struct cgroup_subsys_state * const blkcg_root_css; 27eea8f41cSTejun Heo 28672fdcf0SMing Lei void blkcg_schedule_throttle(struct request_queue *q, bool use_memdelay); 29672fdcf0SMing Lei void blkcg_maybe_throttle_current(void); 30216889aaSChristoph Hellwig bool blk_cgroup_congested(void); 31397c9f46SChristoph Hellwig void blkcg_pin_online(struct cgroup_subsys_state *blkcg_css); 32397c9f46SChristoph Hellwig void blkcg_unpin_online(struct cgroup_subsys_state *blkcg_css); 33dec223c9SChristoph Hellwig struct list_head *blkcg_get_cgwb_list(struct cgroup_subsys_state *css); 34bbb1ebe7SChristoph Hellwig struct cgroup_subsys_state *bio_blkcg_css(struct bio *bio); 3559b57717SDennis Zhou (Facebook) 36eea8f41cSTejun Heo #else /* CONFIG_BLK_CGROUP */ 37eea8f41cSTejun Heo 38496d5e75STejun Heo #define blkcg_root_css ((struct cgroup_subsys_state *)ERR_PTR(-EINVAL)) 39496d5e75STejun Heo 40d09d8df3SJosef Bacik static inline void blkcg_maybe_throttle_current(void) { } 41d09d8df3SJosef Bacik static inline bool blk_cgroup_congested(void) { return false; } 42d09d8df3SJosef Bacik static inline void blkcg_schedule_throttle(struct request_queue *q, bool use_memdelay) { } 43bbb1ebe7SChristoph Hellwig static inline struct cgroup_subsys_state *bio_blkcg_css(struct bio *bio) 44bbb1ebe7SChristoph Hellwig { 45bbb1ebe7SChristoph Hellwig return NULL; 46bbb1ebe7SChristoph Hellwig } 47eea8f41cSTejun Heo #endif /* CONFIG_BLK_CGROUP */ 48d2bcbeabSMuneendra Kumar 49db056284SChristoph Hellwig int blkcg_set_fc_appid(char *app_id, u64 cgrp_id, size_t app_id_len); 50db056284SChristoph Hellwig char *blkcg_get_fc_appid(struct bio *bio); 51d2bcbeabSMuneendra Kumar 52eea8f41cSTejun Heo #endif /* _BLK_CGROUP_H */ 53