diff options
Diffstat (limited to 'block')
| -rw-r--r-- | block/bfq-cgroup.c | 15 | ||||
| -rw-r--r-- | block/blk-cgroup.c | 31 |
2 files changed, 25 insertions, 21 deletions
diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c index b3796a40a61a..66abc82179f3 100644 --- a/block/bfq-cgroup.c +++ b/block/bfq-cgroup.c | |||
| @@ -935,9 +935,9 @@ static u64 bfqg_prfill_stat_recursive(struct seq_file *sf, | |||
| 935 | static u64 bfqg_prfill_rwstat_recursive(struct seq_file *sf, | 935 | static u64 bfqg_prfill_rwstat_recursive(struct seq_file *sf, |
| 936 | struct blkg_policy_data *pd, int off) | 936 | struct blkg_policy_data *pd, int off) |
| 937 | { | 937 | { |
| 938 | struct blkg_rwstat sum = blkg_rwstat_recursive_sum(pd_to_blkg(pd), | 938 | struct blkg_rwstat sum; |
| 939 | &blkcg_policy_bfq, | 939 | |
| 940 | off); | 940 | blkg_rwstat_recursive_sum(pd_to_blkg(pd), &blkcg_policy_bfq, off, &sum); |
| 941 | return __blkg_prfill_rwstat(sf, pd, &sum); | 941 | return __blkg_prfill_rwstat(sf, pd, &sum); |
| 942 | } | 942 | } |
| 943 | 943 | ||
| @@ -975,9 +975,12 @@ static int bfqg_print_stat_sectors(struct seq_file *sf, void *v) | |||
| 975 | static u64 bfqg_prfill_sectors_recursive(struct seq_file *sf, | 975 | static u64 bfqg_prfill_sectors_recursive(struct seq_file *sf, |
| 976 | struct blkg_policy_data *pd, int off) | 976 | struct blkg_policy_data *pd, int off) |
| 977 | { | 977 | { |
| 978 | struct blkg_rwstat tmp = blkg_rwstat_recursive_sum(pd->blkg, NULL, | 978 | struct blkg_rwstat tmp; |
| 979 | offsetof(struct blkcg_gq, stat_bytes)); | 979 | u64 sum; |
| 980 | u64 sum = atomic64_read(&tmp.aux_cnt[BLKG_RWSTAT_READ]) + | 980 | |
| 981 | blkg_rwstat_recursive_sum(pd->blkg, NULL, | ||
| 982 | offsetof(struct blkcg_gq, stat_bytes), &tmp); | ||
| 983 | sum = atomic64_read(&tmp.aux_cnt[BLKG_RWSTAT_READ]) + | ||
| 981 | atomic64_read(&tmp.aux_cnt[BLKG_RWSTAT_WRITE]); | 984 | atomic64_read(&tmp.aux_cnt[BLKG_RWSTAT_WRITE]); |
| 982 | 985 | ||
| 983 | return __blkg_prfill_u64(sf, pd, sum >> 9); | 986 | return __blkg_prfill_u64(sf, pd, sum >> 9); |
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 0778e52b1db2..db039a869d95 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c | |||
| @@ -597,8 +597,9 @@ EXPORT_SYMBOL_GPL(blkg_prfill_stat); | |||
| 597 | u64 blkg_prfill_rwstat(struct seq_file *sf, struct blkg_policy_data *pd, | 597 | u64 blkg_prfill_rwstat(struct seq_file *sf, struct blkg_policy_data *pd, |
| 598 | int off) | 598 | int off) |
| 599 | { | 599 | { |
| 600 | struct blkg_rwstat rwstat = blkg_rwstat_read((void *)pd + off); | 600 | struct blkg_rwstat rwstat = { }; |
| 601 | 601 | ||
| 602 | blkg_rwstat_read((void *)pd + off, &rwstat); | ||
| 602 | return __blkg_prfill_rwstat(sf, pd, &rwstat); | 603 | return __blkg_prfill_rwstat(sf, pd, &rwstat); |
| 603 | } | 604 | } |
| 604 | EXPORT_SYMBOL_GPL(blkg_prfill_rwstat); | 605 | EXPORT_SYMBOL_GPL(blkg_prfill_rwstat); |
| @@ -606,8 +607,9 @@ EXPORT_SYMBOL_GPL(blkg_prfill_rwstat); | |||
| 606 | static u64 blkg_prfill_rwstat_field(struct seq_file *sf, | 607 | static u64 blkg_prfill_rwstat_field(struct seq_file *sf, |
| 607 | struct blkg_policy_data *pd, int off) | 608 | struct blkg_policy_data *pd, int off) |
| 608 | { | 609 | { |
| 609 | struct blkg_rwstat rwstat = blkg_rwstat_read((void *)pd->blkg + off); | 610 | struct blkg_rwstat rwstat = { }; |
| 610 | 611 | ||
| 612 | blkg_rwstat_read((void *)pd->blkg + off, &rwstat); | ||
| 611 | return __blkg_prfill_rwstat(sf, pd, &rwstat); | 613 | return __blkg_prfill_rwstat(sf, pd, &rwstat); |
| 612 | } | 614 | } |
| 613 | 615 | ||
| @@ -649,8 +651,9 @@ static u64 blkg_prfill_rwstat_field_recursive(struct seq_file *sf, | |||
| 649 | struct blkg_policy_data *pd, | 651 | struct blkg_policy_data *pd, |
| 650 | int off) | 652 | int off) |
| 651 | { | 653 | { |
| 652 | struct blkg_rwstat rwstat = blkg_rwstat_recursive_sum(pd->blkg, | 654 | struct blkg_rwstat rwstat; |
| 653 | NULL, off); | 655 | |
| 656 | blkg_rwstat_recursive_sum(pd->blkg, NULL, off, &rwstat); | ||
| 654 | return __blkg_prfill_rwstat(sf, pd, &rwstat); | 657 | return __blkg_prfill_rwstat(sf, pd, &rwstat); |
| 655 | } | 658 | } |
| 656 | 659 | ||
| @@ -731,6 +734,7 @@ EXPORT_SYMBOL_GPL(blkg_stat_recursive_sum); | |||
| 731 | * @blkg: blkg of interest | 734 | * @blkg: blkg of interest |
| 732 | * @pol: blkcg_policy which contains the blkg_rwstat | 735 | * @pol: blkcg_policy which contains the blkg_rwstat |
| 733 | * @off: offset to the blkg_rwstat in blkg_policy_data or @blkg | 736 | * @off: offset to the blkg_rwstat in blkg_policy_data or @blkg |
| 737 | * @sum: blkg_rwstat structure containing the results | ||
| 734 | * | 738 | * |
| 735 | * Collect the blkg_rwstat specified by @blkg, @pol and @off and all its | 739 | * Collect the blkg_rwstat specified by @blkg, @pol and @off and all its |
| 736 | * online descendants and their aux counts. The caller must be holding the | 740 | * online descendants and their aux counts. The caller must be holding the |
| @@ -739,12 +743,11 @@ EXPORT_SYMBOL_GPL(blkg_stat_recursive_sum); | |||
| 739 | * If @pol is NULL, blkg_rwstat is at @off bytes into @blkg; otherwise, it | 743 | * If @pol is NULL, blkg_rwstat is at @off bytes into @blkg; otherwise, it |
| 740 | * is at @off bytes into @blkg's blkg_policy_data of the policy. | 744 | * is at @off bytes into @blkg's blkg_policy_data of the policy. |
| 741 | */ | 745 | */ |
| 742 | struct blkg_rwstat blkg_rwstat_recursive_sum(struct blkcg_gq *blkg, | 746 | void blkg_rwstat_recursive_sum(struct blkcg_gq *blkg, struct blkcg_policy *pol, |
| 743 | struct blkcg_policy *pol, int off) | 747 | int off, struct blkg_rwstat *sum) |
| 744 | { | 748 | { |
| 745 | struct blkcg_gq *pos_blkg; | 749 | struct blkcg_gq *pos_blkg; |
| 746 | struct cgroup_subsys_state *pos_css; | 750 | struct cgroup_subsys_state *pos_css; |
| 747 | struct blkg_rwstat sum = { }; | ||
| 748 | unsigned int i; | 751 | unsigned int i; |
| 749 | 752 | ||
| 750 | lockdep_assert_held(&blkg->q->queue_lock); | 753 | lockdep_assert_held(&blkg->q->queue_lock); |
| @@ -762,12 +765,10 @@ struct blkg_rwstat blkg_rwstat_recursive_sum(struct blkcg_gq *blkg, | |||
| 762 | rwstat = (void *)pos_blkg + off; | 765 | rwstat = (void *)pos_blkg + off; |
| 763 | 766 | ||
| 764 | for (i = 0; i < BLKG_RWSTAT_NR; i++) | 767 | for (i = 0; i < BLKG_RWSTAT_NR; i++) |
| 765 | atomic64_add(blkg_rwstat_read_counter(rwstat, i), | 768 | atomic64_set(&sum->aux_cnt[i], |
| 766 | &sum.aux_cnt[i]); | 769 | blkg_rwstat_read_counter(rwstat, i)); |
| 767 | } | 770 | } |
| 768 | rcu_read_unlock(); | 771 | rcu_read_unlock(); |
| 769 | |||
| 770 | return sum; | ||
| 771 | } | 772 | } |
| 772 | EXPORT_SYMBOL_GPL(blkg_rwstat_recursive_sum); | 773 | EXPORT_SYMBOL_GPL(blkg_rwstat_recursive_sum); |
| 773 | 774 | ||
| @@ -953,14 +954,14 @@ static int blkcg_print_stat(struct seq_file *sf, void *v) | |||
| 953 | 954 | ||
| 954 | spin_lock_irq(&blkg->q->queue_lock); | 955 | spin_lock_irq(&blkg->q->queue_lock); |
| 955 | 956 | ||
| 956 | rwstat = blkg_rwstat_recursive_sum(blkg, NULL, | 957 | blkg_rwstat_recursive_sum(blkg, NULL, |
| 957 | offsetof(struct blkcg_gq, stat_bytes)); | 958 | offsetof(struct blkcg_gq, stat_bytes), &rwstat); |
| 958 | rbytes = atomic64_read(&rwstat.aux_cnt[BLKG_RWSTAT_READ]); | 959 | rbytes = atomic64_read(&rwstat.aux_cnt[BLKG_RWSTAT_READ]); |
| 959 | wbytes = atomic64_read(&rwstat.aux_cnt[BLKG_RWSTAT_WRITE]); | 960 | wbytes = atomic64_read(&rwstat.aux_cnt[BLKG_RWSTAT_WRITE]); |
| 960 | dbytes = atomic64_read(&rwstat.aux_cnt[BLKG_RWSTAT_DISCARD]); | 961 | dbytes = atomic64_read(&rwstat.aux_cnt[BLKG_RWSTAT_DISCARD]); |
| 961 | 962 | ||
| 962 | rwstat = blkg_rwstat_recursive_sum(blkg, NULL, | 963 | blkg_rwstat_recursive_sum(blkg, NULL, |
| 963 | offsetof(struct blkcg_gq, stat_ios)); | 964 | offsetof(struct blkcg_gq, stat_ios), &rwstat); |
| 964 | rios = atomic64_read(&rwstat.aux_cnt[BLKG_RWSTAT_READ]); | 965 | rios = atomic64_read(&rwstat.aux_cnt[BLKG_RWSTAT_READ]); |
| 965 | wios = atomic64_read(&rwstat.aux_cnt[BLKG_RWSTAT_WRITE]); | 966 | wios = atomic64_read(&rwstat.aux_cnt[BLKG_RWSTAT_WRITE]); |
| 966 | dios = atomic64_read(&rwstat.aux_cnt[BLKG_RWSTAT_DISCARD]); | 967 | dios = atomic64_read(&rwstat.aux_cnt[BLKG_RWSTAT_DISCARD]); |
