summaryrefslogtreecommitdiffstats
path: root/block/blk-wbt.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2016-11-28 09:22:47 -0700
committerJens Axboe <axboe@fb.com>2016-11-28 10:27:03 -0700
commit80e091d10e8bf7b801d634ea8870b9e907314424 (patch)
tree05d99a001b158de7e3f6f9eb119f28bb226b8bc2 /block/blk-wbt.c
parentfeffa5cc7b47f38210d4997ceb3fe30881d6c337 (diff)
downloadlinux-0-day-80e091d10e8bf7b801d634ea8870b9e907314424.tar.gz
linux-0-day-80e091d10e8bf7b801d634ea8870b9e907314424.tar.xz
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 <axboe@fb.com>
Diffstat (limited to 'block/blk-wbt.c')
-rw-r--r--block/blk-wbt.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/block/blk-wbt.c b/block/blk-wbt.c
index 9f97594e68ce7..92df2f7c5af1a 100644
--- a/block/blk-wbt.c
+++ b/block/blk-wbt.c
@@ -675,6 +675,18 @@ void wbt_disable(struct rq_wb *rwb)
}
EXPORT_SYMBOL_GPL(wbt_disable);
+u64 wbt_default_latency_nsec(struct request_queue *q)
+{
+ /*
+ * We default to 2msec for non-rotational storage, and 75msec
+ * for rotational storage.
+ */
+ if (blk_queue_nonrot(q))
+ return 2000000ULL;
+ else
+ return 75000000ULL;
+}
+
int wbt_init(struct request_queue *q)
{
struct rq_wb *rwb;
@@ -711,10 +723,7 @@ int wbt_init(struct request_queue *q)
q->rq_wb = rwb;
blk_stat_enable(q);
- if (blk_queue_nonrot(q))
- rwb->min_lat_nsec = 2000000ULL;
- else
- rwb->min_lat_nsec = 75000000ULL;
+ rwb->min_lat_nsec = wbt_default_latency_nsec(q);
wbt_set_queue_depth(rwb, blk_queue_depth(q));
wbt_set_write_cache(rwb, test_bit(QUEUE_FLAG_WC, &q->queue_flags));