Skip to content

Commit 8f5845e

Browse files
jc2870axboe
authored andcommitted
block: restore default wbt enablement
The commit 245618f ("block: protect wbt_lat_usec using q->elevator_lock") protected wbt_enable_default() with q->elevator_lock; however, it also placed wbt_enable_default() before blk_queue_flag_set(QUEUE_FLAG_REGISTERED, q);, resulting in wbt failing to be enabled. Moreover, the protection of wbt_enable_default() by q->elevator_lock was removed in commit 78c2713 ("block: move wbt_enable_default() out of queue freezing from sched ->exit()"), so we can directly fix this issue by placing wbt_enable_default() after blk_queue_flag_set(QUEUE_FLAG_REGISTERED, q);. Additionally, this issue also causes the inability to read the wbt_lat_usec file, and the scenario is as follows: root@q:/sys/block/sda/queue# cat wbt_lat_usec cat: wbt_lat_usec: Invalid argument root@q:/data00/sjc/linux# ls /sys/kernel/debug/block/sda/rqos cannot access '/sys/kernel/debug/block/sda/rqos': No such file or directory root@q:/data00/sjc/linux# find /sys -name wbt /sys/kernel/debug/tracing/events/wbt After testing with this patch, wbt can be enabled normally. Signed-off-by: Julian Sun <[email protected]> Cc: [email protected] Fixes: 245618f ("block: protect wbt_lat_usec using q->elevator_lock") Reviewed-by: Nilay Shroff <[email protected]> Reviewed-by: Yu Kuai <[email protected]> Reviewed-by: Ming Lei <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent f7a2e1c commit 8f5845e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

block/blk-sysfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -902,9 +902,9 @@ int blk_register_queue(struct gendisk *disk)
902902

903903
if (queue_is_mq(q))
904904
elevator_set_default(q);
905-
wbt_enable_default(disk);
906905

907906
blk_queue_flag_set(QUEUE_FLAG_REGISTERED, q);
907+
wbt_enable_default(disk);
908908

909909
/* Now everything is ready and send out KOBJ_ADD uevent */
910910
kobject_uevent(&disk->queue_kobj, KOBJ_ADD);

0 commit comments

Comments
 (0)