[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <22cd48e9-fe36-414c-942e-382b8139ab4b@acm.org>
Date: Thu, 17 Mar 2022 07:06:15 -0700
From: Bart Van Assche <bvanassche@....org>
To: Yu Kuai <yukuai3@...wei.com>, axboe@...nel.dk, mpatocka@...hat.com,
snitzer@...hat.com
Cc: linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
yi.zhang@...wei.com
Subject: Re: [PATCH 1/3] block: don't show disk stats if io accounting is
disabled
On 3/17/22 04:26, Yu Kuai wrote:
> If io accounting is disabled, there is no point to handle such device
> in diskstats_show(), and it can be confused for users because all fields
> in iostat are zero while the disk is handling io.
>
> Signed-off-by: Yu Kuai <yukuai3@...wei.com>
> ---
> block/genhd.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/block/genhd.c b/block/genhd.c
> index c3b32c665aec..e5307f512185 100644
> --- a/block/genhd.c
> +++ b/block/genhd.c
> @@ -937,6 +937,9 @@ ssize_t part_stat_show(struct device *dev,
> struct disk_stats stat;
> unsigned int inflight;
>
> + if (!blk_queue_io_stat(q))
> + return sprintf(buf, "io accounting is disabled\n");
> +
Hmm ... the above looks sub-optimal to me. Has it been considered to
return an error code instead or even better to hide the stat attribute
if I/O accounting is disabled? The latter can be achieved by modifying
disk_visible().
Thanks,
Bart.
Powered by blists - more mailing lists