Re: [PATCH] blk-wbt: Always change enable_state to MANUAL when setting latency

Tang Yizhou <[email protected]> Sat, 1 Aug 2026 02:02:10 +0800
Newsgroups org.kernel.vger.linux-block,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On 24/7/26 2:51 pm, yu kuai wrote:
> 在 2026/7/17 20:50, Tang Yizhou 写道:
> 
>> From: Tang Yizhou<[email protected]>
>>
>> Commit 1e56f30a73f3 ("block: Make WBT latency writes honor enable
>> state") compares only the boolean enabled state in the no-op check.
>> Writing the current latency value while WBT is in WBT_STATE_ON_DEFAULT
>> is therefore still skipped, and enable_state is not changed to
>> WBT_STATE_ON_MANUAL. A subsequent elevator switch to BFQ then disables
>> WBT through wbt_disable_default(), silently discarding the explicit
>> sysfs setting:
>>
>>    # enable_state = WBT_STATE_ON_DEFAULT, min_lat_nsec = 2000000
>>    echo 2000 > /sys/block/nullb0/queue/wbt_lat_usec  # skipped as a no-op
>>    echo bfq > /sys/block/nullb0/queue/scheduler
>>    cat /sys/block/nullb0/queue/wbt_lat_usec          # 0, WBT disabled
>>
>> Skip the update only if the stored latency matches and enable_state
>> already equals the exact target state: WBT_STATE_ON_MANUAL for a
>> non-zero value, WBT_STATE_OFF_MANUAL for zero.
>>
>> A write that passes the check then reaches wbt_set_min_lat(), which
>> performs the actual transition to the MANUAL state.
>>
>> Rename the helper to wbt_lat_changed() to improve readability.
>>
>> Fixes: 1e56f30a73f3 ("block: Make WBT latency writes honor enable state")
>> Signed-off-by: Tang Yizhou<[email protected]>
>> ---
>>   block/blk-wbt.c | 14 +++++++++++---
>>   1 file changed, 11 insertions(+), 3 deletions(-)
> Reviewed-by: Yu Kuai <[email protected]>
> 

Hi Jens, if there are no further objections, could this patch be merged?

-- 
Best Regards,
Yi