xref: /linux/block/blk-cgroup.h (revision 575969a0dd3fe65c6556bcb8f87c42303326ea55)
131e4c28dSVivek Goyal #ifndef _BLK_CGROUP_H
231e4c28dSVivek Goyal #define _BLK_CGROUP_H
331e4c28dSVivek Goyal /*
431e4c28dSVivek Goyal  * Common Block IO controller cgroup interface
531e4c28dSVivek Goyal  *
631e4c28dSVivek Goyal  * Based on ideas and code from CFQ, CFS and BFQ:
731e4c28dSVivek Goyal  * Copyright (C) 2003 Jens Axboe <axboe@kernel.dk>
831e4c28dSVivek Goyal  *
931e4c28dSVivek Goyal  * Copyright (C) 2008 Fabio Checconi <fabio@gandalf.sssup.it>
1031e4c28dSVivek Goyal  *		      Paolo Valente <paolo.valente@unimore.it>
1131e4c28dSVivek Goyal  *
1231e4c28dSVivek Goyal  * Copyright (C) 2009 Vivek Goyal <vgoyal@redhat.com>
1331e4c28dSVivek Goyal  * 	              Nauman Rafique <nauman@google.com>
1431e4c28dSVivek Goyal  */
1531e4c28dSVivek Goyal 
1631e4c28dSVivek Goyal #include <linux/cgroup.h>
17*575969a0SVivek Goyal #include <linux/u64_stats_sync.h>
1831e4c28dSVivek Goyal 
19062a644dSVivek Goyal enum blkio_policy_id {
20062a644dSVivek Goyal 	BLKIO_POLICY_PROP = 0,		/* Proportional Bandwidth division */
214c9eefa1SVivek Goyal 	BLKIO_POLICY_THROTL,		/* Throttling */
22062a644dSVivek Goyal };
23062a644dSVivek Goyal 
249355aedeSVivek Goyal /* Max limits for throttle policy */
259355aedeSVivek Goyal #define THROTL_IOPS_MAX		UINT_MAX
269355aedeSVivek Goyal 
2767523c48SBen Blum #if defined(CONFIG_BLK_CGROUP) || defined(CONFIG_BLK_CGROUP_MODULE)
2867523c48SBen Blum 
2967523c48SBen Blum #ifndef CONFIG_BLK_CGROUP
3067523c48SBen Blum /* When blk-cgroup is a module, its subsys_id isn't a compile-time constant */
3167523c48SBen Blum extern struct cgroup_subsys blkio_subsys;
3267523c48SBen Blum #define blkio_subsys_id blkio_subsys.subsys_id
3367523c48SBen Blum #endif
342f5ea477SJens Axboe 
3584c124daSDivyesh Shah enum stat_type {
3684c124daSDivyesh Shah 	/* Total time spent (in ns) between request dispatch to the driver and
3784c124daSDivyesh Shah 	 * request completion for IOs doen by this cgroup. This may not be
3884c124daSDivyesh Shah 	 * accurate when NCQ is turned on. */
3984c124daSDivyesh Shah 	BLKIO_STAT_SERVICE_TIME = 0,
4084c124daSDivyesh Shah 	/* Total time spent waiting in scheduler queue in ns */
4184c124daSDivyesh Shah 	BLKIO_STAT_WAIT_TIME,
42812d4026SDivyesh Shah 	/* Number of IOs merged */
43812d4026SDivyesh Shah 	BLKIO_STAT_MERGED,
44cdc1184cSDivyesh Shah 	/* Number of IOs queued up */
45cdc1184cSDivyesh Shah 	BLKIO_STAT_QUEUED,
4684c124daSDivyesh Shah 	/* All the single valued stats go below this */
4784c124daSDivyesh Shah 	BLKIO_STAT_TIME,
48a23e6869SVivek Goyal #ifdef CONFIG_DEBUG_BLK_CGROUP
49167400d3SJustin TerAvest 	/* Time not charged to this cgroup */
50167400d3SJustin TerAvest 	BLKIO_STAT_UNACCOUNTED_TIME,
51cdc1184cSDivyesh Shah 	BLKIO_STAT_AVG_QUEUE_SIZE,
52812df48dSDivyesh Shah 	BLKIO_STAT_IDLE_TIME,
53812df48dSDivyesh Shah 	BLKIO_STAT_EMPTY_TIME,
54812df48dSDivyesh Shah 	BLKIO_STAT_GROUP_WAIT_TIME,
5584c124daSDivyesh Shah 	BLKIO_STAT_DEQUEUE
5684c124daSDivyesh Shah #endif
5784c124daSDivyesh Shah };
5884c124daSDivyesh Shah 
595624a4e4SVivek Goyal /* Per cpu stats */
605624a4e4SVivek Goyal enum stat_type_cpu {
615624a4e4SVivek Goyal 	BLKIO_STAT_CPU_SECTORS,
625624a4e4SVivek Goyal 	/* Total bytes transferred */
635624a4e4SVivek Goyal 	BLKIO_STAT_CPU_SERVICE_BYTES,
645624a4e4SVivek Goyal 	/* Total IOs serviced, post merge */
655624a4e4SVivek Goyal 	BLKIO_STAT_CPU_SERVICED,
665624a4e4SVivek Goyal 	BLKIO_STAT_CPU_NR
675624a4e4SVivek Goyal };
685624a4e4SVivek Goyal 
6984c124daSDivyesh Shah enum stat_sub_type {
7084c124daSDivyesh Shah 	BLKIO_STAT_READ = 0,
7184c124daSDivyesh Shah 	BLKIO_STAT_WRITE,
7284c124daSDivyesh Shah 	BLKIO_STAT_SYNC,
7384c124daSDivyesh Shah 	BLKIO_STAT_ASYNC,
7484c124daSDivyesh Shah 	BLKIO_STAT_TOTAL
75303a3acbSDivyesh Shah };
76303a3acbSDivyesh Shah 
77812df48dSDivyesh Shah /* blkg state flags */
78812df48dSDivyesh Shah enum blkg_state_flags {
79812df48dSDivyesh Shah 	BLKG_waiting = 0,
80812df48dSDivyesh Shah 	BLKG_idling,
81812df48dSDivyesh Shah 	BLKG_empty,
82812df48dSDivyesh Shah };
83812df48dSDivyesh Shah 
84062a644dSVivek Goyal /* cgroup files owned by proportional weight policy */
85062a644dSVivek Goyal enum blkcg_file_name_prop {
86062a644dSVivek Goyal 	BLKIO_PROP_weight = 1,
87062a644dSVivek Goyal 	BLKIO_PROP_weight_device,
88062a644dSVivek Goyal 	BLKIO_PROP_io_service_bytes,
89062a644dSVivek Goyal 	BLKIO_PROP_io_serviced,
90062a644dSVivek Goyal 	BLKIO_PROP_time,
91062a644dSVivek Goyal 	BLKIO_PROP_sectors,
92167400d3SJustin TerAvest 	BLKIO_PROP_unaccounted_time,
93062a644dSVivek Goyal 	BLKIO_PROP_io_service_time,
94062a644dSVivek Goyal 	BLKIO_PROP_io_wait_time,
95062a644dSVivek Goyal 	BLKIO_PROP_io_merged,
96062a644dSVivek Goyal 	BLKIO_PROP_io_queued,
97062a644dSVivek Goyal 	BLKIO_PROP_avg_queue_size,
98062a644dSVivek Goyal 	BLKIO_PROP_group_wait_time,
99062a644dSVivek Goyal 	BLKIO_PROP_idle_time,
100062a644dSVivek Goyal 	BLKIO_PROP_empty_time,
101062a644dSVivek Goyal 	BLKIO_PROP_dequeue,
102062a644dSVivek Goyal };
103062a644dSVivek Goyal 
1044c9eefa1SVivek Goyal /* cgroup files owned by throttle policy */
1054c9eefa1SVivek Goyal enum blkcg_file_name_throtl {
1064c9eefa1SVivek Goyal 	BLKIO_THROTL_read_bps_device,
1074c9eefa1SVivek Goyal 	BLKIO_THROTL_write_bps_device,
1087702e8f4SVivek Goyal 	BLKIO_THROTL_read_iops_device,
1097702e8f4SVivek Goyal 	BLKIO_THROTL_write_iops_device,
1104c9eefa1SVivek Goyal 	BLKIO_THROTL_io_service_bytes,
1114c9eefa1SVivek Goyal 	BLKIO_THROTL_io_serviced,
1124c9eefa1SVivek Goyal };
1134c9eefa1SVivek Goyal 
11431e4c28dSVivek Goyal struct blkio_cgroup {
11531e4c28dSVivek Goyal 	struct cgroup_subsys_state css;
11631e4c28dSVivek Goyal 	unsigned int weight;
11731e4c28dSVivek Goyal 	spinlock_t lock;
11831e4c28dSVivek Goyal 	struct hlist_head blkg_list;
11934d0f179SGui Jianfeng 	struct list_head policy_list; /* list of blkio_policy_node */
12031e4c28dSVivek Goyal };
12131e4c28dSVivek Goyal 
122303a3acbSDivyesh Shah struct blkio_group_stats {
123303a3acbSDivyesh Shah 	/* total disk time and nr sectors dispatched by this group */
124303a3acbSDivyesh Shah 	uint64_t time;
125cdc1184cSDivyesh Shah 	uint64_t stat_arr[BLKIO_STAT_QUEUED + 1][BLKIO_STAT_TOTAL];
126303a3acbSDivyesh Shah #ifdef CONFIG_DEBUG_BLK_CGROUP
127a23e6869SVivek Goyal 	/* Time not charged to this cgroup */
128a23e6869SVivek Goyal 	uint64_t unaccounted_time;
129a23e6869SVivek Goyal 
130cdc1184cSDivyesh Shah 	/* Sum of number of IOs queued across all samples */
131cdc1184cSDivyesh Shah 	uint64_t avg_queue_size_sum;
132cdc1184cSDivyesh Shah 	/* Count of samples taken for average */
133cdc1184cSDivyesh Shah 	uint64_t avg_queue_size_samples;
134303a3acbSDivyesh Shah 	/* How many times this group has been removed from service tree */
135303a3acbSDivyesh Shah 	unsigned long dequeue;
136812df48dSDivyesh Shah 
137812df48dSDivyesh Shah 	/* Total time spent waiting for it to be assigned a timeslice. */
138812df48dSDivyesh Shah 	uint64_t group_wait_time;
139812df48dSDivyesh Shah 	uint64_t start_group_wait_time;
140812df48dSDivyesh Shah 
141812df48dSDivyesh Shah 	/* Time spent idling for this blkio_group */
142812df48dSDivyesh Shah 	uint64_t idle_time;
143812df48dSDivyesh Shah 	uint64_t start_idle_time;
144812df48dSDivyesh Shah 	/*
145812df48dSDivyesh Shah 	 * Total time when we have requests queued and do not contain the
146812df48dSDivyesh Shah 	 * current active queue.
147812df48dSDivyesh Shah 	 */
148812df48dSDivyesh Shah 	uint64_t empty_time;
149812df48dSDivyesh Shah 	uint64_t start_empty_time;
150812df48dSDivyesh Shah 	uint16_t flags;
151303a3acbSDivyesh Shah #endif
152303a3acbSDivyesh Shah };
153303a3acbSDivyesh Shah 
1545624a4e4SVivek Goyal /* Per cpu blkio group stats */
1555624a4e4SVivek Goyal struct blkio_group_stats_cpu {
1565624a4e4SVivek Goyal 	uint64_t sectors;
1575624a4e4SVivek Goyal 	uint64_t stat_arr_cpu[BLKIO_STAT_CPU_NR][BLKIO_STAT_TOTAL];
158*575969a0SVivek Goyal 	struct u64_stats_sync syncp;
1595624a4e4SVivek Goyal };
1605624a4e4SVivek Goyal 
16131e4c28dSVivek Goyal struct blkio_group {
16231e4c28dSVivek Goyal 	/* An rcu protected unique identifier for the group */
16331e4c28dSVivek Goyal 	void *key;
16431e4c28dSVivek Goyal 	struct hlist_node blkcg_node;
165b1c35769SVivek Goyal 	unsigned short blkcg_id;
1662868ef7bSVivek Goyal 	/* Store cgroup path */
1672868ef7bSVivek Goyal 	char path[128];
16822084190SVivek Goyal 	/* The device MKDEV(major, minor), this group has been created for */
16922084190SVivek Goyal 	dev_t dev;
170062a644dSVivek Goyal 	/* policy which owns this blk group */
171062a644dSVivek Goyal 	enum blkio_policy_id plid;
17222084190SVivek Goyal 
173303a3acbSDivyesh Shah 	/* Need to serialize the stats in the case of reset/update */
174303a3acbSDivyesh Shah 	spinlock_t stats_lock;
175303a3acbSDivyesh Shah 	struct blkio_group_stats stats;
1765624a4e4SVivek Goyal 	/* Per cpu stats pointer */
1775624a4e4SVivek Goyal 	struct blkio_group_stats_cpu __percpu *stats_cpu;
17831e4c28dSVivek Goyal };
17931e4c28dSVivek Goyal 
18034d0f179SGui Jianfeng struct blkio_policy_node {
18134d0f179SGui Jianfeng 	struct list_head node;
18234d0f179SGui Jianfeng 	dev_t dev;
183062a644dSVivek Goyal 	/* This node belongs to max bw policy or porportional weight policy */
184062a644dSVivek Goyal 	enum blkio_policy_id plid;
185062a644dSVivek Goyal 	/* cgroup file to which this rule belongs to */
186062a644dSVivek Goyal 	int fileid;
1874c9eefa1SVivek Goyal 
1884c9eefa1SVivek Goyal 	union {
1894c9eefa1SVivek Goyal 		unsigned int weight;
1904c9eefa1SVivek Goyal 		/*
1914c9eefa1SVivek Goyal 		 * Rate read/write in terms of byptes per second
1924c9eefa1SVivek Goyal 		 * Whether this rate represents read or write is determined
1934c9eefa1SVivek Goyal 		 * by file type "fileid".
1944c9eefa1SVivek Goyal 		 */
1954c9eefa1SVivek Goyal 		u64 bps;
1967702e8f4SVivek Goyal 		unsigned int iops;
1974c9eefa1SVivek Goyal 	} val;
19834d0f179SGui Jianfeng };
19934d0f179SGui Jianfeng 
20034d0f179SGui Jianfeng extern unsigned int blkcg_get_weight(struct blkio_cgroup *blkcg,
20134d0f179SGui Jianfeng 				     dev_t dev);
2024c9eefa1SVivek Goyal extern uint64_t blkcg_get_read_bps(struct blkio_cgroup *blkcg,
2034c9eefa1SVivek Goyal 				     dev_t dev);
2044c9eefa1SVivek Goyal extern uint64_t blkcg_get_write_bps(struct blkio_cgroup *blkcg,
2054c9eefa1SVivek Goyal 				     dev_t dev);
2067702e8f4SVivek Goyal extern unsigned int blkcg_get_read_iops(struct blkio_cgroup *blkcg,
2077702e8f4SVivek Goyal 				     dev_t dev);
2087702e8f4SVivek Goyal extern unsigned int blkcg_get_write_iops(struct blkio_cgroup *blkcg,
2097702e8f4SVivek Goyal 				     dev_t dev);
21034d0f179SGui Jianfeng 
2113e252066SVivek Goyal typedef void (blkio_unlink_group_fn) (void *key, struct blkio_group *blkg);
212fe071437SVivek Goyal 
213fe071437SVivek Goyal typedef void (blkio_update_group_weight_fn) (void *key,
214fe071437SVivek Goyal 			struct blkio_group *blkg, unsigned int weight);
215fe071437SVivek Goyal typedef void (blkio_update_group_read_bps_fn) (void * key,
216fe071437SVivek Goyal 			struct blkio_group *blkg, u64 read_bps);
217fe071437SVivek Goyal typedef void (blkio_update_group_write_bps_fn) (void *key,
218fe071437SVivek Goyal 			struct blkio_group *blkg, u64 write_bps);
219fe071437SVivek Goyal typedef void (blkio_update_group_read_iops_fn) (void *key,
220fe071437SVivek Goyal 			struct blkio_group *blkg, unsigned int read_iops);
221fe071437SVivek Goyal typedef void (blkio_update_group_write_iops_fn) (void *key,
222fe071437SVivek Goyal 			struct blkio_group *blkg, unsigned int write_iops);
2233e252066SVivek Goyal 
2243e252066SVivek Goyal struct blkio_policy_ops {
2253e252066SVivek Goyal 	blkio_unlink_group_fn *blkio_unlink_group_fn;
2263e252066SVivek Goyal 	blkio_update_group_weight_fn *blkio_update_group_weight_fn;
2274c9eefa1SVivek Goyal 	blkio_update_group_read_bps_fn *blkio_update_group_read_bps_fn;
2284c9eefa1SVivek Goyal 	blkio_update_group_write_bps_fn *blkio_update_group_write_bps_fn;
2297702e8f4SVivek Goyal 	blkio_update_group_read_iops_fn *blkio_update_group_read_iops_fn;
2307702e8f4SVivek Goyal 	blkio_update_group_write_iops_fn *blkio_update_group_write_iops_fn;
2313e252066SVivek Goyal };
2323e252066SVivek Goyal 
2333e252066SVivek Goyal struct blkio_policy_type {
2343e252066SVivek Goyal 	struct list_head list;
2353e252066SVivek Goyal 	struct blkio_policy_ops ops;
236062a644dSVivek Goyal 	enum blkio_policy_id plid;
2373e252066SVivek Goyal };
2383e252066SVivek Goyal 
2393e252066SVivek Goyal /* Blkio controller policy registration */
2403e252066SVivek Goyal extern void blkio_policy_register(struct blkio_policy_type *);
2413e252066SVivek Goyal extern void blkio_policy_unregister(struct blkio_policy_type *);
2423e252066SVivek Goyal 
243afc24d49SVivek Goyal static inline char *blkg_path(struct blkio_group *blkg)
244afc24d49SVivek Goyal {
245afc24d49SVivek Goyal 	return blkg->path;
246afc24d49SVivek Goyal }
247afc24d49SVivek Goyal 
2482f5ea477SJens Axboe #else
2492f5ea477SJens Axboe 
2502f5ea477SJens Axboe struct blkio_group {
2512f5ea477SJens Axboe };
2522f5ea477SJens Axboe 
2533e252066SVivek Goyal struct blkio_policy_type {
2543e252066SVivek Goyal };
2553e252066SVivek Goyal 
2563e252066SVivek Goyal static inline void blkio_policy_register(struct blkio_policy_type *blkiop) { }
2573e252066SVivek Goyal static inline void blkio_policy_unregister(struct blkio_policy_type *blkiop) { }
2583e252066SVivek Goyal 
259afc24d49SVivek Goyal static inline char *blkg_path(struct blkio_group *blkg) { return NULL; }
260afc24d49SVivek Goyal 
2612f5ea477SJens Axboe #endif
2622f5ea477SJens Axboe 
263df457f84SJustin TerAvest #define BLKIO_WEIGHT_MIN	10
26431e4c28dSVivek Goyal #define BLKIO_WEIGHT_MAX	1000
26531e4c28dSVivek Goyal #define BLKIO_WEIGHT_DEFAULT	500
26631e4c28dSVivek Goyal 
2672868ef7bSVivek Goyal #ifdef CONFIG_DEBUG_BLK_CGROUP
268a11cdaa7SDivyesh Shah void blkiocg_update_avg_queue_size_stats(struct blkio_group *blkg);
2699195291eSDivyesh Shah void blkiocg_update_dequeue_stats(struct blkio_group *blkg,
27022084190SVivek Goyal 				unsigned long dequeue);
271812df48dSDivyesh Shah void blkiocg_update_set_idle_time_stats(struct blkio_group *blkg);
272812df48dSDivyesh Shah void blkiocg_update_idle_time_stats(struct blkio_group *blkg);
273e5ff082eSVivek Goyal void blkiocg_set_start_empty_time(struct blkio_group *blkg);
274812df48dSDivyesh Shah 
275812df48dSDivyesh Shah #define BLKG_FLAG_FNS(name)						\
276812df48dSDivyesh Shah static inline void blkio_mark_blkg_##name(				\
277812df48dSDivyesh Shah 		struct blkio_group_stats *stats)			\
278812df48dSDivyesh Shah {									\
279812df48dSDivyesh Shah 	stats->flags |= (1 << BLKG_##name);				\
280812df48dSDivyesh Shah }									\
281812df48dSDivyesh Shah static inline void blkio_clear_blkg_##name(				\
282812df48dSDivyesh Shah 		struct blkio_group_stats *stats)			\
283812df48dSDivyesh Shah {									\
284812df48dSDivyesh Shah 	stats->flags &= ~(1 << BLKG_##name);				\
285812df48dSDivyesh Shah }									\
286812df48dSDivyesh Shah static inline int blkio_blkg_##name(struct blkio_group_stats *stats)	\
287812df48dSDivyesh Shah {									\
288812df48dSDivyesh Shah 	return (stats->flags & (1 << BLKG_##name)) != 0;		\
289812df48dSDivyesh Shah }									\
290812df48dSDivyesh Shah 
291812df48dSDivyesh Shah BLKG_FLAG_FNS(waiting)
292812df48dSDivyesh Shah BLKG_FLAG_FNS(idling)
293812df48dSDivyesh Shah BLKG_FLAG_FNS(empty)
294812df48dSDivyesh Shah #undef BLKG_FLAG_FNS
2952868ef7bSVivek Goyal #else
296a11cdaa7SDivyesh Shah static inline void blkiocg_update_avg_queue_size_stats(
297cdc1184cSDivyesh Shah 						struct blkio_group *blkg) {}
2989195291eSDivyesh Shah static inline void blkiocg_update_dequeue_stats(struct blkio_group *blkg,
2999195291eSDivyesh Shah 						unsigned long dequeue) {}
300812df48dSDivyesh Shah static inline void blkiocg_update_set_idle_time_stats(struct blkio_group *blkg)
301812df48dSDivyesh Shah {}
302812df48dSDivyesh Shah static inline void blkiocg_update_idle_time_stats(struct blkio_group *blkg) {}
303e5ff082eSVivek Goyal static inline void blkiocg_set_start_empty_time(struct blkio_group *blkg) {}
3042868ef7bSVivek Goyal #endif
3052868ef7bSVivek Goyal 
30667523c48SBen Blum #if defined(CONFIG_BLK_CGROUP) || defined(CONFIG_BLK_CGROUP_MODULE)
30731e4c28dSVivek Goyal extern struct blkio_cgroup blkio_root_cgroup;
30831e4c28dSVivek Goyal extern struct blkio_cgroup *cgroup_to_blkio_cgroup(struct cgroup *cgroup);
30970087dc3SVivek Goyal extern struct blkio_cgroup *task_blkio_cgroup(struct task_struct *tsk);
31031e4c28dSVivek Goyal extern void blkiocg_add_blkio_group(struct blkio_cgroup *blkcg,
311062a644dSVivek Goyal 	struct blkio_group *blkg, void *key, dev_t dev,
312062a644dSVivek Goyal 	enum blkio_policy_id plid);
3135624a4e4SVivek Goyal extern int blkio_alloc_blkg_stats(struct blkio_group *blkg);
31431e4c28dSVivek Goyal extern int blkiocg_del_blkio_group(struct blkio_group *blkg);
31531e4c28dSVivek Goyal extern struct blkio_group *blkiocg_lookup_group(struct blkio_cgroup *blkcg,
31631e4c28dSVivek Goyal 						void *key);
317303a3acbSDivyesh Shah void blkiocg_update_timeslice_used(struct blkio_group *blkg,
318167400d3SJustin TerAvest 					unsigned long time,
319167400d3SJustin TerAvest 					unsigned long unaccounted_time);
32084c124daSDivyesh Shah void blkiocg_update_dispatch_stats(struct blkio_group *blkg, uint64_t bytes,
32184c124daSDivyesh Shah 						bool direction, bool sync);
32284c124daSDivyesh Shah void blkiocg_update_completion_stats(struct blkio_group *blkg,
32384c124daSDivyesh Shah 	uint64_t start_time, uint64_t io_start_time, bool direction, bool sync);
324812d4026SDivyesh Shah void blkiocg_update_io_merged_stats(struct blkio_group *blkg, bool direction,
325812d4026SDivyesh Shah 					bool sync);
326a11cdaa7SDivyesh Shah void blkiocg_update_io_add_stats(struct blkio_group *blkg,
327cdc1184cSDivyesh Shah 		struct blkio_group *curr_blkg, bool direction, bool sync);
328a11cdaa7SDivyesh Shah void blkiocg_update_io_remove_stats(struct blkio_group *blkg,
329cdc1184cSDivyesh Shah 					bool direction, bool sync);
33031e4c28dSVivek Goyal #else
3312f5ea477SJens Axboe struct cgroup;
33231e4c28dSVivek Goyal static inline struct blkio_cgroup *
33331e4c28dSVivek Goyal cgroup_to_blkio_cgroup(struct cgroup *cgroup) { return NULL; }
33470087dc3SVivek Goyal static inline struct blkio_cgroup *
33570087dc3SVivek Goyal task_blkio_cgroup(struct task_struct *tsk) { return NULL; }
33631e4c28dSVivek Goyal 
33731e4c28dSVivek Goyal static inline void blkiocg_add_blkio_group(struct blkio_cgroup *blkcg,
338062a644dSVivek Goyal 		struct blkio_group *blkg, void *key, dev_t dev,
339062a644dSVivek Goyal 		enum blkio_policy_id plid) {}
34031e4c28dSVivek Goyal 
3415624a4e4SVivek Goyal static inline int blkio_alloc_blkg_stats(struct blkio_group *blkg) { return 0; }
3425624a4e4SVivek Goyal 
34331e4c28dSVivek Goyal static inline int
34431e4c28dSVivek Goyal blkiocg_del_blkio_group(struct blkio_group *blkg) { return 0; }
34531e4c28dSVivek Goyal 
34631e4c28dSVivek Goyal static inline struct blkio_group *
34731e4c28dSVivek Goyal blkiocg_lookup_group(struct blkio_cgroup *blkcg, void *key) { return NULL; }
348303a3acbSDivyesh Shah static inline void blkiocg_update_timeslice_used(struct blkio_group *blkg,
349167400d3SJustin TerAvest 						unsigned long time,
350167400d3SJustin TerAvest 						unsigned long unaccounted_time)
351167400d3SJustin TerAvest {}
35284c124daSDivyesh Shah static inline void blkiocg_update_dispatch_stats(struct blkio_group *blkg,
35384c124daSDivyesh Shah 				uint64_t bytes, bool direction, bool sync) {}
35484c124daSDivyesh Shah static inline void blkiocg_update_completion_stats(struct blkio_group *blkg,
35584c124daSDivyesh Shah 		uint64_t start_time, uint64_t io_start_time, bool direction,
35684c124daSDivyesh Shah 		bool sync) {}
357812d4026SDivyesh Shah static inline void blkiocg_update_io_merged_stats(struct blkio_group *blkg,
358812d4026SDivyesh Shah 						bool direction, bool sync) {}
359a11cdaa7SDivyesh Shah static inline void blkiocg_update_io_add_stats(struct blkio_group *blkg,
360cdc1184cSDivyesh Shah 		struct blkio_group *curr_blkg, bool direction, bool sync) {}
361a11cdaa7SDivyesh Shah static inline void blkiocg_update_io_remove_stats(struct blkio_group *blkg,
362cdc1184cSDivyesh Shah 						bool direction, bool sync) {}
36331e4c28dSVivek Goyal #endif
36431e4c28dSVivek Goyal #endif /* _BLK_CGROUP_H */
365