diff options
author | Tejun Heo <tj@kernel.org> | 2012-03-08 10:53:59 -0800 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2012-03-20 12:45:37 +0100 |
commit | c4c76a05382c7d05e0b911daa58a827399e9ba1a (patch) | |
tree | e89f1edb9890a4b857f75dbdb4a0fb77d9aafa59 /block/blk-cgroup.h | |
parent | 997a026c80c3cc05f82e589aced1f0011c17d376 (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.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h index 1fa3c5e8d87..8bdcf504f94 100644 --- a/block/blk-cgroup.h +++ b/block/blk-cgroup.h @@ -39,6 +39,7 @@ enum stat_type { BLKIO_STAT_WAIT_TIME, /* Number of IOs queued up */ BLKIO_STAT_QUEUED, + /* All the single valued stats go below this */ BLKIO_STAT_TIME, #ifdef CONFIG_DEBUG_BLK_CGROUP @@ -52,6 +53,9 @@ enum stat_type { #endif }; +/* Types lower than this live in stat_arr and have subtypes */ +#define BLKIO_STAT_ARR_NR (BLKIO_STAT_QUEUED + 1) + /* Per cpu stats */ enum stat_type_cpu { BLKIO_STAT_CPU_SECTORS, @@ -117,7 +121,7 @@ struct blkio_cgroup { struct blkio_group_stats { /* total disk time and nr sectors dispatched by this group */ uint64_t time; - uint64_t stat_arr[BLKIO_STAT_QUEUED + 1][BLKIO_STAT_TOTAL]; + uint64_t stat_arr[BLKIO_STAT_ARR_NR][BLKIO_STAT_TOTAL]; #ifdef CONFIG_DEBUG_BLK_CGROUP /* Time not charged to this cgroup */ uint64_t unaccounted_time; |