Linux block layer
 help / color / mirror / Atom feed
From: Tang Yizhou <tangyeechou@gmail.com>
To: Tao Cui <cui.tao@linux.dev>, axboe@kernel.dk
Cc: tj@kernel.org, josef@toxicpanda.com, cgroups@vger.kernel.org,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	Tao Cui <cuitao@kylinos.cn>
Subject: Re: [PATCH] blk-cgroup: show io.stat numbers for discard-only cgroups
Date: Thu, 16 Jul 2026 20:19:43 +0800	[thread overview]
Message-ID: <676f4205-edef-4d2d-a7b1-8878d466bb7e@gmail.com> (raw)
In-Reply-To: <20260714063302.1153238-1-cui.tao@linux.dev>


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


      reply	other threads:[~2026-07-16 12:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=676f4205-edef-4d2d-a7b1-8878d466bb7e@gmail.com \
    --to=tangyeechou@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=cgroups@vger.kernel.org \
    --cc=cui.tao@linux.dev \
    --cc=cuitao@kylinos.cn \
    --cc=josef@toxicpanda.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox