summaryrefslogtreecommitdiffstats
path: root/block/blk-wbt.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2016-11-10 23:52:53 -0500
committerJens Axboe <axboe@fb.com>2016-11-11 18:18:18 -0500
commitd8a0cbfd73cb7281120d1b49f90afeef26ad48a2 (patch)
treed856e1099a712e7333cbcf3585d6881cd23bf3aa /block/blk-wbt.c
parentbbd7bb7017d5c2b1e75f3818b4ce88fa58bb0eab (diff)
blk-wbt: store queue instead of bdi
The bdi was a leftover from when the code was block layer agnostic. Now that we just support a block layer user, store the queue directly. Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block/blk-wbt.c')
-rw-r--r--block/blk-wbt.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/block/blk-wbt.c b/block/blk-wbt.c
index 889c17ff8503..4ab9cebc8003 100644
--- a/block/blk-wbt.c
+++ b/block/blk-wbt.c
@@ -96,7 +96,7 @@ static void wb_timestamp(struct rq_wb *rwb, unsigned long *var)
96 */ 96 */
97static bool wb_recent_wait(struct rq_wb *rwb) 97static bool wb_recent_wait(struct rq_wb *rwb)
98{ 98{
99 struct bdi_writeback *wb = &rwb->bdi->wb; 99 struct bdi_writeback *wb = &rwb->queue->backing_dev_info.wb;
100 100
101 return time_before(jiffies, wb->dirty_sleep + HZ); 101 return time_before(jiffies, wb->dirty_sleep + HZ);
102} 102}
@@ -279,6 +279,7 @@ enum {
279 279
280static int __latency_exceeded(struct rq_wb *rwb, struct blk_rq_stat *stat) 280static int __latency_exceeded(struct rq_wb *rwb, struct blk_rq_stat *stat)
281{ 281{
282 struct backing_dev_info *bdi = &rwb->queue->backing_dev_info;
282 u64 thislat; 283 u64 thislat;
283 284
284 /* 285 /*
@@ -293,7 +294,7 @@ static int __latency_exceeded(struct rq_wb *rwb, struct blk_rq_stat *stat)
293 thislat = rwb_sync_issue_lat(rwb); 294 thislat = rwb_sync_issue_lat(rwb);
294 if (thislat > rwb->cur_win_nsec || 295 if (thislat > rwb->cur_win_nsec ||
295 (thislat > rwb->min_lat_nsec && !stat[0].nr_samples)) { 296 (thislat > rwb->min_lat_nsec && !stat[0].nr_samples)) {
296 trace_wbt_lat(rwb->bdi, thislat); 297 trace_wbt_lat(bdi, thislat);
297 return LAT_EXCEEDED; 298 return LAT_EXCEEDED;
298 } 299 }
299 300
@@ -317,13 +318,13 @@ static int __latency_exceeded(struct rq_wb *rwb, struct blk_rq_stat *stat)
317 * If the 'min' latency exceeds our target, step down. 318 * If the 'min' latency exceeds our target, step down.
318 */ 319 */
319 if (stat[0].min > rwb->min_lat_nsec) { 320 if (stat[0].min > rwb->min_lat_nsec) {
320 trace_wbt_lat(rwb->bdi, stat[0].min); 321 trace_wbt_lat(bdi, stat[0].min);
321 trace_wbt_stat(rwb->bdi, stat); 322 trace_wbt_stat(bdi, stat);
322 return LAT_EXCEEDED; 323 return LAT_EXCEEDED;
323 } 324 }
324 325
325 if (rwb->scale_step) 326 if (rwb->scale_step)
326 trace_wbt_stat(rwb->bdi, stat); 327 trace_wbt_stat(bdi, stat);
327 328
328 return LAT_OK; 329 return LAT_OK;
329} 330}
@@ -338,7 +339,9 @@ static int latency_exceeded(struct rq_wb *rwb)
338 339
339static void rwb_trace_step(struct rq_wb *rwb, const char *msg) 340static void rwb_trace_step(struct rq_wb *rwb, const char *msg)
340{ 341{
341 trace_wbt_step(rwb->bdi, msg, rwb->scale_step, rwb->cur_win_nsec, 342 struct backing_dev_info *bdi = &rwb->queue->backing_dev_info;
343
344 trace_wbt_step(bdi, msg, rwb->scale_step, rwb->cur_win_nsec,
342 rwb->wb_background, rwb->wb_normal, rwb->wb_max); 345 rwb->wb_background, rwb->wb_normal, rwb->wb_max);
343} 346}
344 347
@@ -420,7 +423,8 @@ static void wb_timer_fn(unsigned long data)
420 423
421 status = latency_exceeded(rwb); 424 status = latency_exceeded(rwb);
422 425
423 trace_wbt_timer(rwb->bdi, status, rwb->scale_step, inflight); 426 trace_wbt_timer(&rwb->queue->backing_dev_info, status, rwb->scale_step,
427 inflight);
424 428
425 /* 429 /*
426 * If we exceeded the latency target, step down. If we did not, 430 * If we exceeded the latency target, step down. If we did not,
@@ -700,7 +704,7 @@ int wbt_init(struct request_queue *q, struct wb_stat_ops *ops)
700 rwb->wc = 1; 704 rwb->wc = 1;
701 rwb->queue_depth = RWB_DEF_DEPTH; 705 rwb->queue_depth = RWB_DEF_DEPTH;
702 rwb->last_comp = rwb->last_issue = jiffies; 706 rwb->last_comp = rwb->last_issue = jiffies;
703 rwb->bdi = &q->backing_dev_info; 707 rwb->queue = q;
704 rwb->win_nsec = RWB_WINDOW_NSEC; 708 rwb->win_nsec = RWB_WINDOW_NSEC;
705 rwb->stat_ops = ops; 709 rwb->stat_ops = ops;
706 rwb->ops_data = q; 710 rwb->ops_data = q;