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 17eea8f41cSTejun Heo #include <linux/cgroup.h> 18f7331648STejun Heo #include <linux/percpu.h> 1924bdb8efSTejun Heo #include <linux/percpu_counter.h> 20f7331648STejun Heo #include <linux/u64_stats_sync.h> 21eea8f41cSTejun Heo #include <linux/seq_file.h> 22eea8f41cSTejun Heo #include <linux/radix-tree.h> 23eea8f41cSTejun Heo #include <linux/blkdev.h> 24eea8f41cSTejun Heo #include <linux/atomic.h> 25902ec5b6SShaohua Li #include <linux/kthread.h> 265cdf2e3fSDennis Zhou #include <linux/fs.h> 27eea8f41cSTejun Heo 28d2bcbeabSMuneendra Kumar #define FC_APPID_LEN 129 29d2bcbeabSMuneendra Kumar 30eea8f41cSTejun Heo #ifdef CONFIG_BLK_CGROUP 31496d5e75STejun Heo extern struct cgroup_subsys_state * const blkcg_root_css; 32eea8f41cSTejun Heo 33672fdcf0SMing Lei void blkcg_schedule_throttle(struct request_queue *q, bool use_memdelay); 34672fdcf0SMing Lei void blkcg_maybe_throttle_current(void); 35216889aaSChristoph Hellwig bool blk_cgroup_congested(void); 36397c9f46SChristoph Hellwig void blkcg_pin_online(struct cgroup_subsys_state *blkcg_css); 37397c9f46SChristoph Hellwig void blkcg_unpin_online(struct cgroup_subsys_state *blkcg_css); 38dec223c9SChristoph Hellwig struct list_head *blkcg_get_cgwb_list(struct cgroup_subsys_state *css); 39*bbb1ebe7SChristoph Hellwig struct cgroup_subsys_state *bio_blkcg_css(struct bio *bio); 4059b57717SDennis Zhou (Facebook) 41eea8f41cSTejun Heo #else /* CONFIG_BLK_CGROUP */ 42eea8f41cSTejun Heo 43496d5e75STejun Heo #define blkcg_root_css ((struct cgroup_subsys_state *)ERR_PTR(-EINVAL)) 44496d5e75STejun Heo 45d09d8df3SJosef Bacik static inline void blkcg_maybe_throttle_current(void) { } 46d09d8df3SJosef Bacik static inline bool blk_cgroup_congested(void) { return false; } 47d09d8df3SJosef Bacik 48efa7d1c7STejun Heo #ifdef CONFIG_BLOCK 49d09d8df3SJosef Bacik static inline void blkcg_schedule_throttle(struct request_queue *q, bool use_memdelay) { } 50*bbb1ebe7SChristoph Hellwig static inline struct cgroup_subsys_state *bio_blkcg_css(struct bio *bio) 51*bbb1ebe7SChristoph Hellwig { 52*bbb1ebe7SChristoph Hellwig return NULL; 53*bbb1ebe7SChristoph Hellwig } 54efa7d1c7STejun Heo #endif /* CONFIG_BLOCK */ 55672fdcf0SMing Lei 56eea8f41cSTejun Heo #endif /* CONFIG_BLK_CGROUP */ 57d2bcbeabSMuneendra Kumar 58db056284SChristoph Hellwig int blkcg_set_fc_appid(char *app_id, u64 cgrp_id, size_t app_id_len); 59db056284SChristoph Hellwig char *blkcg_get_fc_appid(struct bio *bio); 60d2bcbeabSMuneendra Kumar 61eea8f41cSTejun Heo #endif /* _BLK_CGROUP_H */ 62