Skip to contentSkip to conversation

blkcg: fix incorrect read/write sync/async stat accounting

PATCH In review Tejun Heo 2 participants 2 messages Oct 22, 2015

Subsystems (2)
lore
Share & tools
lore

Tejun Heo

author maintainer
#0 lore raw

PATCH 1/1 blkcg: fix incorrect read/write sync/async stat accounting

While unifying how blkcg stats are collected, 77ea733884eb ("blkcg:
move io_service_bytes and io_serviced stats into blkcg_gq") incorrectly used bio->flags instead of bio->rw to tell the IO type. This made IOs to be accounted as the wrong type. Fix it.

Fixes 77ea733884eb ("blkcg: move io_service_bytes and io_serviced stats into blkcg_gq")
---
 include/linux/blk-cgroup.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/blk-cgroup.h +2 -2
@@ -713,9 +713,9 @@ static inline bool blkcg_bio_issue_check
 
 	if (!throtl) {
 		blkg = blkg ?: q->root_blkg;
-		blkg_rwstat_add(&blkg->stat_bytes, bio->bi_flags,
+		blkg_rwstat_add(&blkg->stat_bytes, bio->bi_rw,
 				bio->bi_iter.bi_size);
-		blkg_rwstat_add(&blkg->stat_ios, bio->bi_flags, 1);
+		blkg_rwstat_add(&blkg->stat_ios, bio->bi_rw, 1);
 	}
 
 	rcu_read_unlock();
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Tejun Heo

While unifying how blkcg stats are collected, 77ea733884eb ("blkcg:
move io_service_bytes and io_serviced stats into blkcg_gq") incorrectly used bio->flags instead of bio->rw to tell the IO type. This made IOs to be accounted as the wrong type. Fix it.

Fixes 77ea733884eb ("blkcg: move io_service_bytes and io_serviced stats into blkcg_gq")
Quoted 23 lines
---
 include/linux/blk-cgroup.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/blk-cgroup.h +2 -3
@@ -713,9 +713,9 @@ static inline bool blkcg_bio_issue_check
 
 	if (!throtl) {
 		blkg = blkg ?: q->root_blkg;
-		blkg_rwstat_add(&blkg->stat_bytes, bio->bi_flags,
+		blkg_rwstat_add(&blkg->stat_bytes, bio->bi_rw,
 				bio->bi_iter.bi_size);
-		blkg_rwstat_add(&blkg->stat_ios, bio->bi_flags, 1);
+		blkg_rwstat_add(&blkg->stat_ios, bio->bi_rw, 1);
 	}
 
 	rcu_read_unlock();
--

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/