Merge tag 'for-5.12-rc3-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave...
[linux-2.6-microblaze.git] / block / blk-cgroup-rwstat.c
index 85d5790..3304e84 100644 (file)
@@ -109,6 +109,7 @@ void blkg_rwstat_recursive_sum(struct blkcg_gq *blkg, struct blkcg_policy *pol,
 
        lockdep_assert_held(&blkg->q->queue_lock);
 
+       memset(sum, 0, sizeof(*sum));
        rcu_read_lock();
        blkg_for_each_descendant_pre(pos_blkg, pos_css, blkg) {
                struct blkg_rwstat *rwstat;
@@ -122,7 +123,7 @@ void blkg_rwstat_recursive_sum(struct blkcg_gq *blkg, struct blkcg_policy *pol,
                        rwstat = (void *)pos_blkg + off;
 
                for (i = 0; i < BLKG_RWSTAT_NR; i++)
-                       sum->cnt[i] = blkg_rwstat_read_counter(rwstat, i);
+                       sum->cnt[i] += blkg_rwstat_read_counter(rwstat, i);
        }
        rcu_read_unlock();
 }