Skip to contentSkip to conversation

blk-cgroup: show io.stat numbers for discard-only cgroups

PATCH Superseded Tao Cui 2 participants 2 messages Jul 14 – Jul 16

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Tao Cui

author
#0 lore raw

PATCH 1/1 blk-cgroup: show io.stat numbers for discard-only cgroups

From: Tao Cui <[email protected]>

blkcg_print_one_stat() gates the rbytes/wbytes/rios/wios/dbytes/dios output on

    if (rbytes || wbytes || rios || wios)

which omits the discard counters. A cgroup that has issued only discards (zero read and write counters) therefore prints an empty stat line and its dbytes/dios are never surfaced, even though they are accounted correctly.

The guard predates the addition of discard stats and was never updated; include dbytes/dios so discard-only cgroups are reported.

Fixes 636620b66d5d ("blkcg: Track DISCARD statistics and output them in cgroup io.stat")
---
 block/blk-cgroup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/blk-cgroup.c +1 -1
index a778aa9d2bb9..b324701cb05d 100644
@@ -1154,7 +1154,7 @@ static void blkcg_print_one_stat(struct blkcg_gq *blkg, struct seq_file *s)
 		dios = bis->cur.ios[BLKG_IOSTAT_DISCARD];
 	} while (u64_stats_fetch_retry(&bis->sync, seq));
 
-	if (rbytes || wbytes || rios || wios) {
+	if (rbytes || wbytes || rios || wios || dbytes || dios) {
 		seq_printf(s, "rbytes=%llu wbytes=%llu rios=%llu wios=%llu dbytes=%llu dios=%llu",
 			rbytes, wbytes, rios, wios,
 			dbytes, dios);
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 25 lines · Tao Cui

From: Tao Cui <[email protected]>

blkcg_print_one_stat() gates the rbytes/wbytes/rios/wios/dbytes/dios output on

    if (rbytes || wbytes || rios || wios)

which omits the discard counters. A cgroup that has issued only discards (zero read and write counters) therefore prints an empty stat line and its dbytes/dios are never surfaced, even though they are accounted correctly.

The guard predates the addition of discard stats and was never updated; include dbytes/dios so discard-only cgroups are reported.

Fixes 636620b66d5d ("blkcg: Track DISCARD statistics and output them in cgroup io.stat")
---
 block/blk-cgroup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/blk-cgroup.c +0 -0
index a778aa9d2bb9..b324701cb05d 100644

block/blk-cgroup.c static void blkcg_print_one_stat(struct blkcg_gq *blkg, struct seq_file *s) · line 1160

Quoted 8 lines
block/blk-cgroup.c +1 -1
@@ -1154,7 +1154,7 @@ static void blkcg_print_one_stat(struct blkcg_gq *blkg, struct seq_file *s)
 		dios = bis->cur.ios[BLKG_IOSTAT_DISCARD];
 	} while (u64_stats_fetch_retry(&bis->sync, seq));
 
-	if (rbytes || wbytes || rios || wios) {
+	if (rbytes || wbytes || rios || wios || dbytes || dios) {
 		seq_printf(s, "rbytes=%llu wbytes=%llu rios=%llu wios=%llu dbytes=%llu dios=%llu",
 			rbytes, wbytes, rios, wios,
 			dbytes, dios);
Signature · 2 lines
Best Regards,
Yi