aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk-cgroup.h
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2012-03-08 13:53:59 -0500
committerJens Axboe <axboe@kernel.dk>2012-03-20 07:45:37 -0400
commitc4c76a05382c7d05e0b911daa58a827399e9ba1a (patch)
treee89f1edb9890a4b857f75dbdb4a0fb77d9aafa59 /block/blk-cgroup.h
parent997a026c80c3cc05f82e589aced1f0011c17d376 (diff)
blkcg: restructure blkio_get_stat()
Restructure blkio_get_stat() to prepare for removal of stats_lock. * Define BLKIO_STAT_ARR_NR explicitly to denote which stats have subtypes instead of using BLKIO_STAT_QUEUED. * Separate out stat acquisition and printing. After this, there are only two users of blkio_fill_stat(). Just open code it. * The code was mixing MAX_KEY_LEN and MAX_KEY_LEN - 1. There's no need to subtract one. Use MAX_KEY_LEN consistently. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Vivek Goyal <vgoyal@redhat.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-cgroup.h')
-rw-r--r--block/blk-cgroup.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h
index 1fa3c5e8d87f..8bdcf504f94b 100644
--- a/block/blk-cgroup.h
+++ b/block/blk-cgroup.h
@@ -39,6 +39,7 @@ enum stat_type {
39 BLKIO_STAT_WAIT_TIME, 39 BLKIO_STAT_WAIT_TIME,
40 /* Number of IOs queued up */ 40 /* Number of IOs queued up */
41 BLKIO_STAT_QUEUED, 41 BLKIO_STAT_QUEUED,
42
42 /* All the single valued stats go below this */ 43 /* All the single valued stats go below this */
43 BLKIO_STAT_TIME, 44 BLKIO_STAT_TIME,
44#ifdef CONFIG_DEBUG_BLK_CGROUP 45#ifdef CONFIG_DEBUG_BLK_CGROUP
@@ -52,6 +53,9 @@ enum stat_type {
52#endif 53#endif
53}; 54};
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
55/* Per cpu stats */ 59/* Per cpu stats */
56enum stat_type_cpu { 60enum stat_type_cpu {
57 BLKIO_STAT_CPU_SECTORS, 61 BLKIO_STAT_CPU_SECTORS,
@@ -117,7 +121,7 @@ struct blkio_cgroup {
117struct blkio_group_stats { 121struct blkio_group_stats {
118 /* total disk time and nr sectors dispatched by this group */ 122 /* total disk time and nr sectors dispatched by this group */
119 uint64_t time; 123 uint64_t time;
120 uint64_t stat_arr[BLKIO_STAT_QUEUED + 1][BLKIO_STAT_TOTAL]; 124 uint64_t stat_arr[BLKIO_STAT_ARR_NR][BLKIO_STAT_TOTAL];
121#ifdef CONFIG_DEBUG_BLK_CGROUP 125#ifdef CONFIG_DEBUG_BLK_CGROUP
122 /* Time not charged to this cgroup */ 126 /* Time not charged to this cgroup */
123 uint64_t unaccounted_time; 127 uint64_t unaccounted_time;