diff mbox series

[-next,3/6] blk-wbt: don't enable wbt for bio based device

Message ID 20230511014509.679482-4-yukuai1@huaweicloud.com (mailing list archive)
State New, archived
Headers show
Series blk-wbt: minor fix and cleanup | expand

Commit Message

Yu Kuai May 11, 2023, 1:45 a.m. UTC
From: Yu Kuai <yukuai3@huawei.com>

Because rq_qos only make sense for rq based device. Instead of fail
from sysfs configuration, make wbt sysfs dentry invisible directly.

Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
 block/blk-sysfs.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Christoph Hellwig May 11, 2023, 3:21 p.m. UTC | #1
On Thu, May 11, 2023 at 09:45:06AM +0800, Yu Kuai wrote:
> From: Yu Kuai <yukuai3@huawei.com>
> 
> Because rq_qos only make sense for rq based device. Instead of fail
> from sysfs configuration, make wbt sysfs dentry invisible directly.

This looks ok, bt I would be better to just have a separate attr
group just for blk-mq based devices?
Yu Kuai May 12, 2023, 7:06 a.m. UTC | #2
Hi,

在 2023/05/11 23:21, Christoph Hellwig 写道:
> On Thu, May 11, 2023 at 09:45:06AM +0800, Yu Kuai wrote:
>> From: Yu Kuai <yukuai3@huawei.com>
>>
>> Because rq_qos only make sense for rq based device. Instead of fail
>> from sysfs configuration, make wbt sysfs dentry invisible directly.
> 
> This looks ok, bt I would be better to just have a separate attr
> group just for blk-mq based devices?
> 

Sounds good, I'll add a new attr_group that is only visible for rq based
device, I think following attr can be moved to this new group:

nr_requests,
rq_affinity,
scheduler,
wbt_lat_usec

Thanks,
Kuai
diff mbox series

Patch

diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index 6c1c4ba66bc0..c8e1f1462422 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -686,6 +686,10 @@  static umode_t queue_attr_visible(struct kobject *kobj, struct attribute *attr,
 	    !blk_queue_is_zoned(q))
 		return 0;
 
+#ifdef CONFIG_BLK_WBT
+	if (attr == &queue_wb_lat_entry.attr && !queue_is_mq(q))
+		return 0;
+#endif
 	return attr->mode;
 }