aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk-cgroup.h
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2012-04-01 17:38:42 -0400
committerTejun Heo <tj@kernel.org>2012-04-01 17:38:42 -0400
commitd3d32e69fa368e131b25ee68806aa3fd3916cec1 (patch)
treef6413e70f38cffb3b363fa831b5f868d90bb6c80 /block/blk-cgroup.h
parentedcb0722c654947908388df660791abd41e6617c (diff)
blkcg: restructure statistics printing
blkcg stats handling is a mess. None of the stats has much to do with blkcg core but they are all implemented in blkcg core. Code sharing is achieved by mixing common code with hard-coded cases for each stat counter. This patch restructures statistics printing such that * Common logic exists as helper functions and specific print functions use the helpers to implement specific cases. * Printing functions serving multiple counters don't require hardcoded switching on specific counters. * Printing uses read_seq_string callback (other methods will be phased out). This change enables further cleanups and relocating stats code to the policy implementation it belongs to. Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'block/blk-cgroup.h')
-rw-r--r--block/blk-cgroup.h60
1 files changed, 4 insertions, 56 deletions
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h
index 7578df3938b4..7331d7965a5e 100644
--- a/block/blk-cgroup.h
+++ b/block/blk-cgroup.h
@@ -28,46 +28,10 @@ enum blkio_policy_id {
28 28
29#ifdef CONFIG_BLK_CGROUP 29#ifdef CONFIG_BLK_CGROUP
30 30
31enum stat_type { 31/* cft->private [un]packing for stat printing */
32 /* Number of IOs merged */ 32#define BLKCG_STAT_PRIV(pol, off) (((unsigned)(pol) << 16) | (off))
33 BLKIO_STAT_MERGED, 33#define BLKCG_STAT_POL(prv) ((unsigned)(prv) >> 16)
34 /* Total time spent (in ns) between request dispatch to the driver and 34#define BLKCG_STAT_OFF(prv) ((unsigned)(prv) & 0xffff)
35 * request completion for IOs doen by this cgroup. This may not be
36 * accurate when NCQ is turned on. */
37 BLKIO_STAT_SERVICE_TIME,
38 /* Total time spent waiting in scheduler queue in ns */
39 BLKIO_STAT_WAIT_TIME,
40 /* Number of IOs queued up */
41 BLKIO_STAT_QUEUED,
42
43 /* All the single valued stats go below this */
44 BLKIO_STAT_TIME,
45#ifdef CONFIG_DEBUG_BLK_CGROUP
46 /* Time not charged to this cgroup */
47 BLKIO_STAT_UNACCOUNTED_TIME,
48 BLKIO_STAT_AVG_QUEUE_SIZE,
49 BLKIO_STAT_IDLE_TIME,
50 BLKIO_STAT_EMPTY_TIME,
51 BLKIO_STAT_GROUP_WAIT_TIME,
52 BLKIO_STAT_DEQUEUE
53#endif
54};
55
56/* Types lower than this live in stat_arr and have subtypes */
57#define BLKIO_STAT_ARR_NR (BLKIO_STAT_QUEUED + 1)
58
59/* Per cpu stats */
60enum stat_type_cpu {
61 /* Total bytes transferred */
62 BLKIO_STAT_CPU_SERVICE_BYTES,
63 /* Total IOs serviced, post merge */
64 BLKIO_STAT_CPU_SERVICED,
65
66 /* All the single valued stats go below this */
67 BLKIO_STAT_CPU_SECTORS,
68};
69
70#define BLKIO_STAT_CPU_ARR_NR (BLKIO_STAT_CPU_SERVICED + 1)
71 35
72enum blkg_rwstat_type { 36enum blkg_rwstat_type {
73 BLKG_RWSTAT_READ, 37 BLKG_RWSTAT_READ,
@@ -90,20 +54,6 @@ enum blkg_state_flags {
90enum blkcg_file_name_prop { 54enum blkcg_file_name_prop {
91 BLKIO_PROP_weight = 1, 55 BLKIO_PROP_weight = 1,
92 BLKIO_PROP_weight_device, 56 BLKIO_PROP_weight_device,
93 BLKIO_PROP_io_service_bytes,
94 BLKIO_PROP_io_serviced,
95 BLKIO_PROP_time,
96 BLKIO_PROP_sectors,
97 BLKIO_PROP_unaccounted_time,
98 BLKIO_PROP_io_service_time,
99 BLKIO_PROP_io_wait_time,
100 BLKIO_PROP_io_merged,
101 BLKIO_PROP_io_queued,
102 BLKIO_PROP_avg_queue_size,
103 BLKIO_PROP_group_wait_time,
104 BLKIO_PROP_idle_time,
105 BLKIO_PROP_empty_time,
106 BLKIO_PROP_dequeue,
107}; 57};
108 58
109/* cgroup files owned by throttle policy */ 59/* cgroup files owned by throttle policy */
@@ -112,8 +62,6 @@ enum blkcg_file_name_throtl {
112 BLKIO_THROTL_write_bps_device, 62 BLKIO_THROTL_write_bps_device,
113 BLKIO_THROTL_read_iops_device, 63 BLKIO_THROTL_read_iops_device,
114 BLKIO_THROTL_write_iops_device, 64 BLKIO_THROTL_write_iops_device,
115 BLKIO_THROTL_io_service_bytes,
116 BLKIO_THROTL_io_serviced,
117}; 65};
118 66
119struct blkio_cgroup { 67struct blkio_cgroup {