* [PATCH] blk-cgroup: show io.stat numbers for discard-only cgroups
@ 2026-07-14 6:33 Tao Cui
2026-07-16 12:19 ` Tang Yizhou
0 siblings, 1 reply; 2+ messages in thread
From: Tao Cui @ 2026-07-14 6:33 UTC (permalink / raw)
To: axboe; +Cc: tj, josef, cgroups, linux-block, linux-kernel, Tao Cui
From: Tao Cui <cuitao@kylinos.cn>
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 <cuitao@kylinos.cn>
---
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 a778aa9d2bb9..b324701cb05d 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -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);
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] blk-cgroup: show io.stat numbers for discard-only cgroups
2026-07-14 6:33 [PATCH] blk-cgroup: show io.stat numbers for discard-only cgroups Tao Cui
@ 2026-07-16 12:19 ` Tang Yizhou
0 siblings, 0 replies; 2+ messages in thread
From: Tang Yizhou @ 2026-07-16 12:19 UTC (permalink / raw)
To: Tao Cui, axboe; +Cc: tj, josef, cgroups, linux-block, linux-kernel, Tao Cui
On 14/7/26 2:33 pm, Tao Cui wrote:
> From: Tao Cui <cuitao@kylinos.cn>
>
> 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 <cuitao@kylinos.cn>
> ---
> 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 a778aa9d2bb9..b324701cb05d 100644
> --- a/block/blk-cgroup.c
> +++ b/block/blk-cgroup.c
> @@ -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);
Reviewed-by: Tang Yizhou <yizhou.tang@shopee.com>
--
Best Regards,
Yi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-16 12:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-14 6:33 [PATCH] blk-cgroup: show io.stat numbers for discard-only cgroups Tao Cui
2026-07-16 12:19 ` Tang Yizhou
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox