mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-16 17:57:38 -04:00
block: Make WBT latency writes honor enable state
queue/wbt_lat_usec controls both the stored WBT latency target and the effective WBT enable state. The old no-op check skipped updates whenever the converted latency matched the stored min_lat_nsec. That check ignored whether the current WBT state already matched the state requested by the write. For a queue disabled by default, attempting to enable WBT by writing the default value through sysfs could return success while the enable state was left unchanged. Treat a write as a no-op only when both the stored latency and the effective WBT enabled state already match the converted value. Signed-off-by: Guzebing <guzebing1612@gmail.com> Link: https://patch.msgid.link/20260621014030.1625306-1-guzebing1612@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
@@ -813,6 +813,21 @@ static void wbt_queue_depth_changed(struct rq_qos *rqos)
|
||||
wbt_update_limits(RQWB(rqos));
|
||||
}
|
||||
|
||||
static bool wbt_set_lat_changed(struct request_queue *q, u64 val)
|
||||
{
|
||||
struct rq_qos *rqos = wbt_rq_qos(q);
|
||||
struct rq_wb *rwb;
|
||||
|
||||
if (!rqos)
|
||||
return true;
|
||||
|
||||
rwb = RQWB(rqos);
|
||||
if (rwb->min_lat_nsec != val)
|
||||
return true;
|
||||
|
||||
return rwb_enabled(rwb) != !!val;
|
||||
}
|
||||
|
||||
static void wbt_exit(struct rq_qos *rqos)
|
||||
{
|
||||
struct rq_wb *rwb = RQWB(rqos);
|
||||
@@ -1005,8 +1020,12 @@ int wbt_set_lat(struct gendisk *disk, s64 val)
|
||||
else if (val >= 0)
|
||||
val *= 1000ULL;
|
||||
|
||||
if (wbt_get_min_lat(q) == val)
|
||||
mutex_lock(&disk->rqos_state_mutex);
|
||||
if (!wbt_set_lat_changed(q, val)) {
|
||||
mutex_unlock(&disk->rqos_state_mutex);
|
||||
goto out;
|
||||
}
|
||||
mutex_unlock(&disk->rqos_state_mutex);
|
||||
|
||||
blk_mq_quiesce_queue(q);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user