|
28 | 28 | #define FC_APPID_LEN 129 |
29 | 29 |
|
30 | 30 | #ifdef CONFIG_BLK_CGROUP |
31 | | - |
32 | | -enum blkg_iostat_type { |
33 | | - BLKG_IOSTAT_READ, |
34 | | - BLKG_IOSTAT_WRITE, |
35 | | - BLKG_IOSTAT_DISCARD, |
36 | | - |
37 | | - BLKG_IOSTAT_NR, |
38 | | -}; |
39 | | - |
40 | | -struct blkg_iostat { |
41 | | - u64 bytes[BLKG_IOSTAT_NR]; |
42 | | - u64 ios[BLKG_IOSTAT_NR]; |
43 | | -}; |
44 | | - |
45 | | -struct blkg_iostat_set { |
46 | | - struct u64_stats_sync sync; |
47 | | - struct blkg_iostat cur; |
48 | | - struct blkg_iostat last; |
49 | | -}; |
50 | | - |
51 | | -/* association between a blk cgroup and a request queue */ |
52 | | -struct blkcg_gq { |
53 | | - /* Pointer to the associated request_queue */ |
54 | | - struct request_queue *q; |
55 | | - struct list_head q_node; |
56 | | - struct hlist_node blkcg_node; |
57 | | - struct blkcg *blkcg; |
58 | | - |
59 | | - /* all non-root blkcg_gq's are guaranteed to have access to parent */ |
60 | | - struct blkcg_gq *parent; |
61 | | - |
62 | | - /* reference count */ |
63 | | - struct percpu_ref refcnt; |
64 | | - |
65 | | - /* is this blkg online? protected by both blkcg and q locks */ |
66 | | - bool online; |
67 | | - |
68 | | - struct blkg_iostat_set __percpu *iostat_cpu; |
69 | | - struct blkg_iostat_set iostat; |
70 | | - |
71 | | - struct blkg_policy_data *pd[BLKCG_MAX_POLS]; |
72 | | - |
73 | | - spinlock_t async_bio_lock; |
74 | | - struct bio_list async_bios; |
75 | | - union { |
76 | | - struct work_struct async_bio_work; |
77 | | - struct work_struct free_work; |
78 | | - }; |
79 | | - |
80 | | - atomic_t use_delay; |
81 | | - atomic64_t delay_nsec; |
82 | | - atomic64_t delay_start; |
83 | | - u64 last_delay; |
84 | | - int last_use; |
85 | | - |
86 | | - struct rcu_head rcu_head; |
87 | | -}; |
88 | | - |
89 | 31 | extern struct cgroup_subsys_state * const blkcg_root_css; |
90 | 32 |
|
91 | 33 | void blkcg_schedule_throttle(struct request_queue *q, bool use_memdelay); |
92 | 34 | void blkcg_maybe_throttle_current(void); |
93 | | - |
94 | | -/** |
95 | | - * bio_blkcg - grab the blkcg associated with a bio |
96 | | - * @bio: target bio |
97 | | - * |
98 | | - * This returns the blkcg associated with a bio, %NULL if not associated. |
99 | | - * Callers are expected to either handle %NULL or know association has been |
100 | | - * done prior to calling this. |
101 | | - */ |
102 | | -static inline struct blkcg *bio_blkcg(struct bio *bio) |
103 | | -{ |
104 | | - if (bio && bio->bi_blkg) |
105 | | - return bio->bi_blkg->blkcg; |
106 | | - return NULL; |
107 | | -} |
108 | | - |
109 | 35 | bool blk_cgroup_congested(void); |
110 | 36 | void blkcg_pin_online(struct cgroup_subsys_state *blkcg_css); |
111 | 37 | void blkcg_unpin_online(struct cgroup_subsys_state *blkcg_css); |
112 | 38 | struct list_head *blkcg_get_cgwb_list(struct cgroup_subsys_state *css); |
| 39 | +struct cgroup_subsys_state *bio_blkcg_css(struct bio *bio); |
113 | 40 |
|
114 | 41 | #else /* CONFIG_BLK_CGROUP */ |
115 | 42 |
|
116 | | -struct blkcg_gq { |
117 | | -}; |
118 | | - |
119 | 43 | #define blkcg_root_css ((struct cgroup_subsys_state *)ERR_PTR(-EINVAL)) |
120 | 44 |
|
121 | 45 | static inline void blkcg_maybe_throttle_current(void) { } |
122 | 46 | static inline bool blk_cgroup_congested(void) { return false; } |
123 | 47 |
|
124 | 48 | #ifdef CONFIG_BLOCK |
125 | 49 | static inline void blkcg_schedule_throttle(struct request_queue *q, bool use_memdelay) { } |
126 | | -static inline struct blkcg *bio_blkcg(struct bio *bio) { return NULL; } |
| 50 | +static inline struct cgroup_subsys_state *bio_blkcg_css(struct bio *bio) |
| 51 | +{ |
| 52 | + return NULL; |
| 53 | +} |
127 | 54 | #endif /* CONFIG_BLOCK */ |
128 | 55 |
|
129 | 56 | #endif /* CONFIG_BLK_CGROUP */ |
|
0 commit comments