blk-wbt: don't show valid wbt_lat_usec in sysfs while wbt is disabled
authorYu Kuai <yukuai3@huawei.com>
Wed, 19 Oct 2022 12:15:16 +0000 (20:15 +0800)
committerJens Axboe <axboe@kernel.dk>
Mon, 24 Oct 2022 00:59:17 +0000 (18:59 -0600)
commit3642ef4d95699193c4a461862382e643ae3720f0
treee0a696d7266ff27dadb46349b6bde22da71ea6e1
parenta9a236d238a5e8ab2e74ca62c2c7ba5dd435af77
blk-wbt: don't show valid wbt_lat_usec in sysfs while wbt is disabled

Currently, if wbt is initialized and then disabled by
wbt_disable_default(), sysfs will still show valid wbt_lat_usec, which
will confuse users that wbt is still enabled.

This patch shows wbt_lat_usec as zero if it's disabled.

Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Reported-and-tested-by: Holger Hoffstätte <holger@applied-asynchrony.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20221019121518.3865235-5-yukuai1@huaweicloud.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-sysfs.c
block/blk-wbt.c
block/blk-wbt.h