diff options
Diffstat (limited to 'block/blk-sysfs.c')
-rw-r--r-- | block/blk-sysfs.c | 151 |
1 files changed, 0 insertions, 151 deletions
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index 85c3dc223..f87a7e747 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c @@ -10,7 +10,6 @@ #include <linux/blktrace_api.h> #include <linux/blk-mq.h> #include <linux/blk-cgroup.h> -#include <linux/wbt.h> #include "blk.h" #include "blk-mq.h" @@ -42,19 +41,6 @@ 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) -{ - int err; - u64 v; - - err = kstrtou64(page, 10, &v); - if (err < 0) - return err; - - *var = v; - return 0; -} - static ssize_t queue_requests_show(struct request_queue *q, char *page) { return queue_var_show(q->nr_requests, (page)); @@ -361,58 +347,6 @@ static ssize_t queue_poll_store(struct request_queue *q, const char *page, return ret; } -static ssize_t queue_wb_win_show(struct request_queue *q, char *page) -{ - if (!q->rq_wb) - return -EINVAL; - - return sprintf(page, "%llu\n", div_u64(q->rq_wb->win_nsec, 1000)); -} - -static ssize_t queue_wb_win_store(struct request_queue *q, const char *page, - size_t count) -{ - ssize_t ret; - u64 val; - - if (!q->rq_wb) - return -EINVAL; - - ret = queue_var_store64(&val, page); - if (ret < 0) - return ret; - - q->rq_wb->win_nsec = val * 1000ULL; - wbt_update_limits(q->rq_wb); - return count; -} - -static ssize_t queue_wb_lat_show(struct request_queue *q, char *page) -{ - if (!q->rq_wb) - return -EINVAL; - - return sprintf(page, "%llu\n", div_u64(q->rq_wb->min_lat_nsec, 1000)); -} - -static ssize_t queue_wb_lat_store(struct request_queue *q, const char *page, - size_t count) -{ - ssize_t ret; - u64 val; - - if (!q->rq_wb) - 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); - return count; -} - static ssize_t queue_wc_show(struct request_queue *q, char *page) { if (test_bit(QUEUE_FLAG_WC, &q->queue_flags)) @@ -450,26 +384,6 @@ static ssize_t queue_dax_show(struct request_queue *q, char *page) return queue_var_show(blk_queue_dax(q), page); } -static ssize_t print_stat(char *page, struct blk_rq_stat *stat, const char *pre) -{ - return sprintf(page, "%s samples=%llu, mean=%lld, min=%lld, max=%lld\n", - pre, (long long) stat->nr_samples, - (long long) stat->mean, (long long) stat->min, - (long long) stat->max); -} - -static ssize_t queue_stats_show(struct request_queue *q, char *page) -{ - struct blk_rq_stat stat[2]; - ssize_t ret; - - blk_queue_stat_get(q, stat); - - ret = print_stat(page, &stat[0], "read :"); - ret += print_stat(page + ret, &stat[1], "write:"); - return ret; -} - static struct queue_sysfs_entry queue_requests_entry = { .attr = {.name = "nr_requests", .mode = S_IRUGO | S_IWUSR }, .show = queue_requests_show, @@ -612,23 +526,6 @@ static struct queue_sysfs_entry queue_dax_entry = { .show = queue_dax_show, }; -static struct queue_sysfs_entry queue_stats_entry = { - .attr = {.name = "stats", .mode = S_IRUGO }, - .show = queue_stats_show, -}; - -static struct queue_sysfs_entry queue_wb_lat_entry = { - .attr = {.name = "wbt_lat_usec", .mode = S_IRUGO | S_IWUSR }, - .show = queue_wb_lat_show, - .store = queue_wb_lat_store, -}; - -static struct queue_sysfs_entry queue_wb_win_entry = { - .attr = {.name = "wbt_window_usec", .mode = S_IRUGO | S_IWUSR }, - .show = queue_wb_win_show, - .store = queue_wb_win_store, -}; - static struct attribute *default_attrs[] = { &queue_requests_entry.attr, &queue_ra_entry.attr, @@ -656,9 +553,6 @@ static struct attribute *default_attrs[] = { &queue_poll_entry.attr, &queue_wc_entry.attr, &queue_dax_entry.attr, - &queue_stats_entry.attr, - &queue_wb_lat_entry.attr, - &queue_wb_win_entry.attr, NULL, }; @@ -773,49 +667,6 @@ struct kobj_type blk_queue_ktype = { .release = blk_release_queue, }; -static void blk_wb_stat_get(void *data, struct blk_rq_stat *stat) -{ - blk_queue_stat_get(data, stat); -} - -static void blk_wb_stat_clear(void *data) -{ - blk_stat_clear(data); -} - -static bool blk_wb_stat_is_current(struct blk_rq_stat *stat) -{ - return blk_stat_is_current(stat); -} - -static struct wb_stat_ops wb_stat_ops = { - .get = blk_wb_stat_get, - .is_current = blk_wb_stat_is_current, - .clear = blk_wb_stat_clear, -}; - -static void blk_wb_init(struct request_queue *q) -{ - struct rq_wb *rwb; - - rwb = wbt_init(&q->backing_dev_info, &wb_stat_ops, q); - - /* - * If this fails, we don't get throttling - */ - if (IS_ERR(rwb)) - return; - - if (blk_queue_nonrot(q)) - rwb->min_lat_nsec = 2000000ULL; - else - rwb->min_lat_nsec = 75000000ULL; - - wbt_set_queue_depth(rwb, blk_queue_depth(q)); - wbt_set_write_cache(rwb, test_bit(QUEUE_FLAG_WC, &q->queue_flags)); - q->rq_wb = rwb; -} - int blk_register_queue(struct gendisk *disk) { int ret; @@ -855,8 +706,6 @@ int blk_register_queue(struct gendisk *disk) if (q->mq_ops) blk_mq_register_disk(disk); - blk_wb_init(q); - if (!q->request_fn) return 0; |