Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _BLK_CGROUP_H
0003 #define _BLK_CGROUP_H
0004 /*
0005  * Common Block IO controller cgroup interface
0006  *
0007  * Based on ideas and code from CFQ, CFS and BFQ:
0008  * Copyright (C) 2003 Jens Axboe <axboe@kernel.dk>
0009  *
0010  * Copyright (C) 2008 Fabio Checconi <fabio@gandalf.sssup.it>
0011  *            Paolo Valente <paolo.valente@unimore.it>
0012  *
0013  * Copyright (C) 2009 Vivek Goyal <vgoyal@redhat.com>
0014  *                Nauman Rafique <nauman@google.com>
0015  */
0016 
0017 #include <linux/types.h>
0018 
0019 struct bio;
0020 struct cgroup_subsys_state;
0021 struct request_queue;
0022 
0023 #define FC_APPID_LEN              129
0024 
0025 #ifdef CONFIG_BLK_CGROUP
0026 extern struct cgroup_subsys_state * const blkcg_root_css;
0027 
0028 void blkcg_schedule_throttle(struct request_queue *q, bool use_memdelay);
0029 void blkcg_maybe_throttle_current(void);
0030 bool blk_cgroup_congested(void);
0031 void blkcg_pin_online(struct cgroup_subsys_state *blkcg_css);
0032 void blkcg_unpin_online(struct cgroup_subsys_state *blkcg_css);
0033 struct list_head *blkcg_get_cgwb_list(struct cgroup_subsys_state *css);
0034 struct cgroup_subsys_state *bio_blkcg_css(struct bio *bio);
0035 
0036 #else   /* CONFIG_BLK_CGROUP */
0037 
0038 #define blkcg_root_css  ((struct cgroup_subsys_state *)ERR_PTR(-EINVAL))
0039 
0040 static inline void blkcg_maybe_throttle_current(void) { }
0041 static inline bool blk_cgroup_congested(void) { return false; }
0042 static inline void blkcg_schedule_throttle(struct request_queue *q, bool use_memdelay) { }
0043 static inline struct cgroup_subsys_state *bio_blkcg_css(struct bio *bio)
0044 {
0045     return NULL;
0046 }
0047 #endif  /* CONFIG_BLK_CGROUP */
0048 
0049 int blkcg_set_fc_appid(char *app_id, u64 cgrp_id, size_t app_id_len);
0050 char *blkcg_get_fc_appid(struct bio *bio);
0051 
0052 #endif  /* _BLK_CGROUP_H */