Linux block layer
 help / color / mirror / Atom feed
From: guzebing <guzebing1612@gmail.com>
To: Tang Yizhou <yizhou.tang@shopee.com>
Cc: yukuai@fygo.io, linux-block@vger.kernel.org,
	linux-kernel@vger.kernel.org, axboe@kernel.dk
Subject: Re: [PATCH] blk-wbt: Always change enable_state to MANUAL when setting latency
Date: Fri, 24 Jul 2026 17:50:14 +0800	[thread overview]
Message-ID: <ef221ce6-89c2-49c1-8029-fa129cb1b851@gmail.com> (raw)
In-Reply-To: <20260717125021.88825-1-yizhou.tang@shopee.com>



On 7/17/26 8:50 PM, Tang Yizhou wrote:
> From: Tang Yizhou <yizhou.tang@shopee.com>
> 
> 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 <yizhou.tang@shopee.com>
> ---
>  block/blk-wbt.c | 14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)

Indeed, this edge case was missed. Thanks for catching it. The patch
looks good to me.

Reviewed-by: Guzebing <guzebing1612@gmail.com>

      parent reply	other threads:[~2026-07-24  9:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-17 12:50 [PATCH] blk-wbt: Always change enable_state to MANUAL when setting latency Tang Yizhou
2026-07-24  6:51 ` yu kuai
2026-07-24  9:50 ` guzebing [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ef221ce6-89c2-49c1-8029-fa129cb1b851@gmail.com \
    --to=guzebing1612@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yizhou.tang@shopee.com \
    --cc=yukuai@fygo.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox