xref: /openbmc/linux/block/blk-wbt.h (revision 55b37d9c)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef WB_THROTTLE_H
3 #define WB_THROTTLE_H
4 
5 #ifdef CONFIG_BLK_WBT
6 
7 int wbt_init(struct gendisk *disk);
8 void wbt_disable_default(struct gendisk *disk);
9 void wbt_enable_default(struct gendisk *disk);
10 
11 u64 wbt_get_min_lat(struct request_queue *q);
12 void wbt_set_min_lat(struct request_queue *q, u64 val);
13 bool wbt_disabled(struct request_queue *);
14 
15 void wbt_set_write_cache(struct request_queue *, bool);
16 
17 u64 wbt_default_latency_nsec(struct request_queue *);
18 
19 #else
20 
21 static inline int wbt_init(struct gendisk *disk)
22 {
23 	return -EINVAL;
24 }
25 static inline void wbt_disable_default(struct gendisk *disk)
26 {
27 }
28 static inline void wbt_enable_default(struct gendisk *disk)
29 {
30 }
31 static inline void wbt_set_write_cache(struct request_queue *q, bool wc)
32 {
33 }
34 static inline u64 wbt_get_min_lat(struct request_queue *q)
35 {
36 	return 0;
37 }
38 static inline void wbt_set_min_lat(struct request_queue *q, u64 val)
39 {
40 }
41 static inline u64 wbt_default_latency_nsec(struct request_queue *q)
42 {
43 	return 0;
44 }
45 static inline bool wbt_disabled(struct request_queue *q)
46 {
47 	return true;
48 }
49 
50 #endif /* CONFIG_BLK_WBT */
51 
52 #endif
53