diff options
Diffstat (limited to 'block/blk-cgroup.h')
-rw-r--r-- | block/blk-cgroup.h | 64 |
1 files changed, 39 insertions, 25 deletions
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h index 80010ef64ab0..b22e55390a4f 100644 --- a/block/blk-cgroup.h +++ b/block/blk-cgroup.h | |||
@@ -23,12 +23,31 @@ extern struct cgroup_subsys blkio_subsys; | |||
23 | #define blkio_subsys_id blkio_subsys.subsys_id | 23 | #define blkio_subsys_id blkio_subsys.subsys_id |
24 | #endif | 24 | #endif |
25 | 25 | ||
26 | enum io_type { | 26 | enum stat_type { |
27 | IO_READ = 0, | 27 | /* Total time spent (in ns) between request dispatch to the driver and |
28 | IO_WRITE, | 28 | * request completion for IOs doen by this cgroup. This may not be |
29 | IO_SYNC, | 29 | * accurate when NCQ is turned on. */ |
30 | IO_ASYNC, | 30 | BLKIO_STAT_SERVICE_TIME = 0, |
31 | IO_TYPE_MAX | 31 | /* Total bytes transferred */ |
32 | BLKIO_STAT_SERVICE_BYTES, | ||
33 | /* Total IOs serviced, post merge */ | ||
34 | BLKIO_STAT_SERVICED, | ||
35 | /* Total time spent waiting in scheduler queue in ns */ | ||
36 | BLKIO_STAT_WAIT_TIME, | ||
37 | /* All the single valued stats go below this */ | ||
38 | BLKIO_STAT_TIME, | ||
39 | BLKIO_STAT_SECTORS, | ||
40 | #ifdef CONFIG_DEBUG_BLK_CGROUP | ||
41 | BLKIO_STAT_DEQUEUE | ||
42 | #endif | ||
43 | }; | ||
44 | |||
45 | enum stat_sub_type { | ||
46 | BLKIO_STAT_READ = 0, | ||
47 | BLKIO_STAT_WRITE, | ||
48 | BLKIO_STAT_SYNC, | ||
49 | BLKIO_STAT_ASYNC, | ||
50 | BLKIO_STAT_TOTAL | ||
32 | }; | 51 | }; |
33 | 52 | ||
34 | struct blkio_cgroup { | 53 | struct blkio_cgroup { |
@@ -42,13 +61,7 @@ struct blkio_group_stats { | |||
42 | /* total disk time and nr sectors dispatched by this group */ | 61 | /* total disk time and nr sectors dispatched by this group */ |
43 | uint64_t time; | 62 | uint64_t time; |
44 | uint64_t sectors; | 63 | uint64_t sectors; |
45 | /* Total disk time used by IOs in ns */ | 64 | uint64_t stat_arr[BLKIO_STAT_WAIT_TIME + 1][BLKIO_STAT_TOTAL]; |
46 | uint64_t io_service_time[IO_TYPE_MAX]; | ||
47 | uint64_t io_service_bytes[IO_TYPE_MAX]; /* Total bytes transferred */ | ||
48 | /* Total IOs serviced, post merge */ | ||
49 | uint64_t io_serviced[IO_TYPE_MAX]; | ||
50 | /* Total time spent waiting in scheduler queue in ns */ | ||
51 | uint64_t io_wait_time[IO_TYPE_MAX]; | ||
52 | #ifdef CONFIG_DEBUG_BLK_CGROUP | 65 | #ifdef CONFIG_DEBUG_BLK_CGROUP |
53 | /* How many times this group has been removed from service tree */ | 66 | /* How many times this group has been removed from service tree */ |
54 | unsigned long dequeue; | 67 | unsigned long dequeue; |
@@ -65,7 +78,7 @@ struct blkio_group { | |||
65 | char path[128]; | 78 | char path[128]; |
66 | #endif | 79 | #endif |
67 | /* The device MKDEV(major, minor), this group has been created for */ | 80 | /* The device MKDEV(major, minor), this group has been created for */ |
68 | dev_t dev; | 81 | dev_t dev; |
69 | 82 | ||
70 | /* Need to serialize the stats in the case of reset/update */ | 83 | /* Need to serialize the stats in the case of reset/update */ |
71 | spinlock_t stats_lock; | 84 | spinlock_t stats_lock; |
@@ -128,21 +141,21 @@ extern void blkiocg_add_blkio_group(struct blkio_cgroup *blkcg, | |||
128 | extern int blkiocg_del_blkio_group(struct blkio_group *blkg); | 141 | extern int blkiocg_del_blkio_group(struct blkio_group *blkg); |
129 | extern struct blkio_group *blkiocg_lookup_group(struct blkio_cgroup *blkcg, | 142 | extern struct blkio_group *blkiocg_lookup_group(struct blkio_cgroup *blkcg, |
130 | void *key); | 143 | void *key); |
144 | void blkio_group_init(struct blkio_group *blkg); | ||
131 | void blkiocg_update_timeslice_used(struct blkio_group *blkg, | 145 | void blkiocg_update_timeslice_used(struct blkio_group *blkg, |
132 | unsigned long time); | 146 | unsigned long time); |
133 | void blkiocg_update_request_dispatch_stats(struct blkio_group *blkg, | 147 | void blkiocg_update_dispatch_stats(struct blkio_group *blkg, uint64_t bytes, |
134 | struct request *rq); | 148 | bool direction, bool sync); |
135 | void blkiocg_update_request_completion_stats(struct blkio_group *blkg, | 149 | void blkiocg_update_completion_stats(struct blkio_group *blkg, |
136 | struct request *rq); | 150 | uint64_t start_time, uint64_t io_start_time, bool direction, bool sync); |
137 | #else | 151 | #else |
138 | struct cgroup; | 152 | struct cgroup; |
139 | static inline struct blkio_cgroup * | 153 | static inline struct blkio_cgroup * |
140 | cgroup_to_blkio_cgroup(struct cgroup *cgroup) { return NULL; } | 154 | cgroup_to_blkio_cgroup(struct cgroup *cgroup) { return NULL; } |
141 | 155 | ||
156 | static inline void blkio_group_init(struct blkio_group *blkg) {} | ||
142 | static inline void blkiocg_add_blkio_group(struct blkio_cgroup *blkcg, | 157 | static inline void blkiocg_add_blkio_group(struct blkio_cgroup *blkcg, |
143 | struct blkio_group *blkg, void *key, dev_t dev) | 158 | struct blkio_group *blkg, void *key, dev_t dev) {} |
144 | { | ||
145 | } | ||
146 | 159 | ||
147 | static inline int | 160 | static inline int |
148 | blkiocg_del_blkio_group(struct blkio_group *blkg) { return 0; } | 161 | blkiocg_del_blkio_group(struct blkio_group *blkg) { return 0; } |
@@ -151,9 +164,10 @@ static inline struct blkio_group * | |||
151 | blkiocg_lookup_group(struct blkio_cgroup *blkcg, void *key) { return NULL; } | 164 | blkiocg_lookup_group(struct blkio_cgroup *blkcg, void *key) { return NULL; } |
152 | static inline void blkiocg_update_timeslice_used(struct blkio_group *blkg, | 165 | static inline void blkiocg_update_timeslice_used(struct blkio_group *blkg, |
153 | unsigned long time) {} | 166 | unsigned long time) {} |
154 | static inline void blkiocg_update_request_dispatch_stats( | 167 | static inline void blkiocg_update_dispatch_stats(struct blkio_group *blkg, |
155 | struct blkio_group *blkg, struct request *rq) {} | 168 | uint64_t bytes, bool direction, bool sync) {} |
156 | static inline void blkiocg_update_request_completion_stats( | 169 | static inline void blkiocg_update_completion_stats(struct blkio_group *blkg, |
157 | struct blkio_group *blkg, struct request *rq) {} | 170 | uint64_t start_time, uint64_t io_start_time, bool direction, |
171 | bool sync) {} | ||
158 | #endif | 172 | #endif |
159 | #endif /* _BLK_CGROUP_H */ | 173 | #endif /* _BLK_CGROUP_H */ |