mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
blk-wbt: allow reset of default latency through sysfs
Allow a write of '-1' to reset the default latency target for a given device. This removes knowledge of the different default settings for rotational vs non-rotational from user space. Signed-off-by: Jens Axboe <[email protected]>
This commit is contained in:
parent
feffa5cc7b
commit
80e091d10e
4 changed files with 37 additions and 12 deletions
|
|
@ -42,12 +42,12 @@ queue_var_store(unsigned long *var, const char *page, size_t count)
|
|||
return count;
|
||||
}
|
||||
|
||||
static ssize_t queue_var_store64(u64 *var, const char *page)
|
||||
static ssize_t queue_var_store64(s64 *var, const char *page)
|
||||
{
|
||||
int err;
|
||||
u64 v;
|
||||
s64 v;
|
||||
|
||||
err = kstrtou64(page, 10, &v);
|
||||
err = kstrtos64(page, 10, &v);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
|
@ -421,18 +421,26 @@ static ssize_t queue_wb_lat_show(struct request_queue *q, char *page)
|
|||
static ssize_t queue_wb_lat_store(struct request_queue *q, const char *page,
|
||||
size_t count)
|
||||
{
|
||||
struct rq_wb *rwb;
|
||||
ssize_t ret;
|
||||
u64 val;
|
||||
s64 val;
|
||||
|
||||
if (!q->rq_wb)
|
||||
rwb = q->rq_wb;
|
||||
if (!rwb)
|
||||
return -EINVAL;
|
||||
|
||||
ret = queue_var_store64(&val, page);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
q->rq_wb->min_lat_nsec = val * 1000ULL;
|
||||
wbt_update_limits(q->rq_wb);
|
||||
if (val == -1)
|
||||
rwb->min_lat_nsec = wbt_default_latency_nsec(q);
|
||||
else if (val >= 0)
|
||||
rwb->min_lat_nsec = val * 1000ULL;
|
||||
else
|
||||
return -EINVAL;
|
||||
|
||||
wbt_update_limits(rwb);
|
||||
return count;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue