summaryrefslogtreecommitdiffstats
path: root/block/blk-wbt.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2016-11-28 11:22:47 -0500
committerJens Axboe <axboe@fb.com>2016-11-28 12:27:03 -0500
commit80e091d10e8bf7b801d634ea8870b9e907314424 (patch)
tree05d99a001b158de7e3f6f9eb119f28bb226b8bc2 /block/blk-wbt.c
parentfeffa5cc7b47f38210d4997ceb3fe30881d6c337 (diff)
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 9f97594e68ce..92df2f7c5af1 100644
--- a/block/blk-wbt.c
+++ b/block/blk-wbt.c
@@ -675,6 +675,18 @@ void wbt_disable(struct rq_wb *rwb)
675} 675}
676EXPORT_SYMBOL_GPL(wbt_disable); 676EXPORT_SYMBOL_GPL(wbt_disable);
677 677
678u64 wbt_default_latency_nsec(struct request_queue *q)
679{
680 /*
681 * We default to 2msec for non-rotational storage, and 75msec
682 * for rotational storage.
683 */
684 if (blk_queue_nonrot(q))
685 return 2000000ULL;
686 else
687 return 75000000ULL;
688}
689
678int wbt_init(struct request_queue *q) 690int wbt_init(struct request_queue *q)
679{ 691{
680 struct rq_wb *rwb; 692 struct rq_wb *rwb;
@@ -711,10 +723,7 @@ int wbt_init(struct request_queue *q)
711 q->rq_wb = rwb; 723 q->rq_wb = rwb;
712 blk_stat_enable(q); 724 blk_stat_enable(q);
713 725
714 if (blk_queue_nonrot(q)) 726 rwb->min_lat_nsec = wbt_default_latency_nsec(q);
715 rwb->min_lat_nsec = 2000000ULL;
716 else
717 rwb->min_lat_nsec = 75000000ULL;
718 727
719 wbt_set_queue_depth(rwb, blk_queue_depth(q)); 728 wbt_set_queue_depth(rwb, blk_queue_depth(q));
720 wbt_set_write_cache(rwb, test_bit(QUEUE_FLAG_WC, &q->queue_flags)); 729 wbt_set_write_cache(rwb, test_bit(QUEUE_FLAG_WC, &q->queue_flags));