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 17c97ab271SChristoph Hellwig #include <linux/types.h> 18c97ab271SChristoph Hellwig 19c97ab271SChristoph Hellwig struct bio; 20c97ab271SChristoph Hellwig struct cgroup_subsys_state; 21*de185b56SChristoph Hellwig struct gendisk; 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 28*de185b56SChristoph Hellwig void blkcg_schedule_throttle(struct gendisk *disk, 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 blkcg_maybe_throttle_current(void)40d09d8df3SJosef Bacikstatic inline void blkcg_maybe_throttle_current(void) { } blk_cgroup_congested(void)41d09d8df3SJosef Bacikstatic inline bool blk_cgroup_congested(void) { return false; } bio_blkcg_css(struct bio * bio)42bbb1ebe7SChristoph Hellwigstatic inline struct cgroup_subsys_state *bio_blkcg_css(struct bio *bio) 43bbb1ebe7SChristoph Hellwig { 44bbb1ebe7SChristoph Hellwig return NULL; 45bbb1ebe7SChristoph Hellwig } 46eea8f41cSTejun Heo #endif /* CONFIG_BLK_CGROUP */ 47d2bcbeabSMuneendra Kumar 48db056284SChristoph Hellwig int blkcg_set_fc_appid(char *app_id, u64 cgrp_id, size_t app_id_len); 49db056284SChristoph Hellwig char *blkcg_get_fc_appid(struct bio *bio); 50d2bcbeabSMuneendra Kumar 51eea8f41cSTejun Heo #endif /* _BLK_CGROUP_H */ 52