summaryrefslogtreecommitdiff
path: root/include/linux/blk-cgroup.h
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2019-06-06 12:26:20 +0200
committerJens Axboe <axboe@kernel.dk>2019-06-20 10:32:34 -0600
commit5d0b6e48cbef3219c0ed75e0e746c4ed259303c2 (patch)
tree44575646c0c302eb4ce682d3b554a558fe6d5679 /include/linux/blk-cgroup.h
parent239eeb085753d4356f731a773f363eb5bed4fe81 (diff)
blk-cgroup: pass blkg_rwstat structures by reference
Returning a structure generates rather bad code, so switch to passing by reference. Also don't require the structure to be zeroed and add to the 0-initialized counters, but actually set the counters to the calculated value. 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 'include/linux/blk-cgroup.h')
-rw-r--r--include/linux/blk-cgroup.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/include/linux/blk-cgroup.h b/include/linux/blk-cgroup.h
index 06236f56a840..3ee858111274 100644
--- a/include/linux/blk-cgroup.h
+++ b/include/linux/blk-cgroup.h
@@ -224,8 +224,8 @@ int blkg_print_stat_ios_recursive(struct seq_file *sf, void *v);
u64 blkg_stat_recursive_sum(struct blkcg_gq *blkg,
struct blkcg_policy *pol, int off);
-struct blkg_rwstat blkg_rwstat_recursive_sum(struct blkcg_gq *blkg,
- struct blkcg_policy *pol, int off);
+void blkg_rwstat_recursive_sum(struct blkcg_gq *blkg, struct blkcg_policy *pol,
+ int off, struct blkg_rwstat *sum);
struct blkg_conf_ctx {
struct gendisk *disk;
@@ -700,15 +700,14 @@ static inline void blkg_rwstat_add(struct blkg_rwstat *rwstat,
*
* Read the current snapshot of @rwstat and return it in the aux counts.
*/
-static inline struct blkg_rwstat blkg_rwstat_read(struct blkg_rwstat *rwstat)
+static inline void blkg_rwstat_read(struct blkg_rwstat *rwstat,
+ struct blkg_rwstat *result)
{
- struct blkg_rwstat result;
int i;
for (i = 0; i < BLKG_RWSTAT_NR; i++)
- atomic64_set(&result.aux_cnt[i],
+ atomic64_set(&result->aux_cnt[i],
percpu_counter_sum_positive(&rwstat->cpu_cnt[i]));
- return result;
}
/**
@@ -721,8 +720,9 @@ static inline struct blkg_rwstat blkg_rwstat_read(struct blkg_rwstat *rwstat)
*/
static inline uint64_t blkg_rwstat_total(struct blkg_rwstat *rwstat)
{
- struct blkg_rwstat tmp = blkg_rwstat_read(rwstat);
+ struct blkg_rwstat tmp = { };
+ blkg_rwstat_read(rwstat, &tmp);
return atomic64_read(&tmp.aux_cnt[BLKG_RWSTAT_READ]) +
atomic64_read(&tmp.aux_cnt[BLKG_RWSTAT_WRITE]);
}