diff options
author | Christoph Hellwig <hch@lst.de> | 2019-06-06 06:26:19 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2019-06-20 12:32:34 -0400 |
commit | 239eeb085753d4356f731a773f363eb5bed4fe81 (patch) | |
tree | bba7ae13bbc54a1ac631d2d7eb9c3fb67dd6ca3c /block | |
parent | 1aa0a133fbabeca9e8785fb11de471841009d6d9 (diff) |
blk-cgroup: factor out a helper to read rwstat counter
Trying to break up the crazy statements to something readable.
Also switch to an unsigned counter as it can't ever turn negative.
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
-rw-r--r-- | block/blk-cgroup.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 440797293235..0778e52b1db2 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c | |||
@@ -745,7 +745,7 @@ struct blkg_rwstat blkg_rwstat_recursive_sum(struct blkcg_gq *blkg, | |||
745 | struct blkcg_gq *pos_blkg; | 745 | struct blkcg_gq *pos_blkg; |
746 | struct cgroup_subsys_state *pos_css; | 746 | struct cgroup_subsys_state *pos_css; |
747 | struct blkg_rwstat sum = { }; | 747 | struct blkg_rwstat sum = { }; |
748 | int i; | 748 | unsigned int i; |
749 | 749 | ||
750 | lockdep_assert_held(&blkg->q->queue_lock); | 750 | lockdep_assert_held(&blkg->q->queue_lock); |
751 | 751 | ||
@@ -762,8 +762,7 @@ struct blkg_rwstat blkg_rwstat_recursive_sum(struct blkcg_gq *blkg, | |||
762 | rwstat = (void *)pos_blkg + off; | 762 | rwstat = (void *)pos_blkg + off; |
763 | 763 | ||
764 | for (i = 0; i < BLKG_RWSTAT_NR; i++) | 764 | for (i = 0; i < BLKG_RWSTAT_NR; i++) |
765 | atomic64_add(atomic64_read(&rwstat->aux_cnt[i]) + | 765 | atomic64_add(blkg_rwstat_read_counter(rwstat, i), |
766 | percpu_counter_sum_positive(&rwstat->cpu_cnt[i]), | ||
767 | &sum.aux_cnt[i]); | 766 | &sum.aux_cnt[i]); |
768 | } | 767 | } |
769 | rcu_read_unlock(); | 768 | rcu_read_unlock(); |