DORMANTno replies REVIEWED: 1 (0M)

1 review trailer.

[PATCH v2] blk-cgroup: show io.stat numbers for discard-only cgroups

From: Tao Cui <hidden>
Date: 2026-09-04 07:16:28
Also in: linux-block, lkml
Subsystem: block layer, control group - block io controller (blkio), the rest · Maintainers: Jens Axboe, Tejun Heo, Josef Bacik, Linus Torvalds

From: Tao Cui <redacted>

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")
Signed-off-by: Tao Cui <redacted>
Reviewed-by: Tang Yizhou <redacted>

---
Changes in v2:
- Rebase onto current linux-next head (no code change).
- Add the Reviewed-by tag collected on v1 (Tang Yizhou).
- Link to v1: https://lore.kernel.org/r/20260714063302.1153238-1-cui.tao@linux.dev (local)
---
 block/blk-cgroup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 471cfd2347c9..7b48cd1db13d 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -1160,7 +1160,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);
-- 
2.43.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help