aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--block/blk-cgroup.c28
-rw-r--r--block/blk-cgroup.h12
-rw-r--r--block/cfq-iosched.c20
3 files changed, 28 insertions, 32 deletions
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 649b05d7f291..25cc7514d817 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -202,7 +202,7 @@ void blkiocg_update_idle_time_stats(struct blkio_group *blkg)
202} 202}
203EXPORT_SYMBOL_GPL(blkiocg_update_idle_time_stats); 203EXPORT_SYMBOL_GPL(blkiocg_update_idle_time_stats);
204 204
205void blkiocg_update_set_active_queue_stats(struct blkio_group *blkg) 205void blkiocg_update_avg_queue_size_stats(struct blkio_group *blkg)
206{ 206{
207 unsigned long flags; 207 unsigned long flags;
208 struct blkio_group_stats *stats; 208 struct blkio_group_stats *stats;
@@ -216,14 +216,21 @@ void blkiocg_update_set_active_queue_stats(struct blkio_group *blkg)
216 blkio_update_group_wait_time(stats); 216 blkio_update_group_wait_time(stats);
217 spin_unlock_irqrestore(&blkg->stats_lock, flags); 217 spin_unlock_irqrestore(&blkg->stats_lock, flags);
218} 218}
219EXPORT_SYMBOL_GPL(blkiocg_update_set_active_queue_stats); 219EXPORT_SYMBOL_GPL(blkiocg_update_avg_queue_size_stats);
220
221void blkiocg_update_dequeue_stats(struct blkio_group *blkg,
222 unsigned long dequeue)
223{
224 blkg->stats.dequeue += dequeue;
225}
226EXPORT_SYMBOL_GPL(blkiocg_update_dequeue_stats);
220#else 227#else
221static inline void blkio_set_start_group_wait_time(struct blkio_group *blkg, 228static inline void blkio_set_start_group_wait_time(struct blkio_group *blkg,
222 struct blkio_group *curr_blkg) {} 229 struct blkio_group *curr_blkg) {}
223static inline void blkio_end_empty_time(struct blkio_group_stats *stats) {} 230static inline void blkio_end_empty_time(struct blkio_group_stats *stats) {}
224#endif 231#endif
225 232
226void blkiocg_update_request_add_stats(struct blkio_group *blkg, 233void blkiocg_update_io_add_stats(struct blkio_group *blkg,
227 struct blkio_group *curr_blkg, bool direction, 234 struct blkio_group *curr_blkg, bool direction,
228 bool sync) 235 bool sync)
229{ 236{
@@ -236,9 +243,9 @@ void blkiocg_update_request_add_stats(struct blkio_group *blkg,
236 blkio_set_start_group_wait_time(blkg, curr_blkg); 243 blkio_set_start_group_wait_time(blkg, curr_blkg);
237 spin_unlock_irqrestore(&blkg->stats_lock, flags); 244 spin_unlock_irqrestore(&blkg->stats_lock, flags);
238} 245}
239EXPORT_SYMBOL_GPL(blkiocg_update_request_add_stats); 246EXPORT_SYMBOL_GPL(blkiocg_update_io_add_stats);
240 247
241void blkiocg_update_request_remove_stats(struct blkio_group *blkg, 248void blkiocg_update_io_remove_stats(struct blkio_group *blkg,
242 bool direction, bool sync) 249 bool direction, bool sync)
243{ 250{
244 unsigned long flags; 251 unsigned long flags;
@@ -248,7 +255,7 @@ void blkiocg_update_request_remove_stats(struct blkio_group *blkg,
248 direction, sync); 255 direction, sync);
249 spin_unlock_irqrestore(&blkg->stats_lock, flags); 256 spin_unlock_irqrestore(&blkg->stats_lock, flags);
250} 257}
251EXPORT_SYMBOL_GPL(blkiocg_update_request_remove_stats); 258EXPORT_SYMBOL_GPL(blkiocg_update_io_remove_stats);
252 259
253void blkiocg_update_timeslice_used(struct blkio_group *blkg, unsigned long time) 260void blkiocg_update_timeslice_used(struct blkio_group *blkg, unsigned long time)
254{ 261{
@@ -636,15 +643,6 @@ SHOW_FUNCTION_PER_GROUP(empty_time, BLKIO_STAT_EMPTY_TIME, 0);
636#endif 643#endif
637#undef SHOW_FUNCTION_PER_GROUP 644#undef SHOW_FUNCTION_PER_GROUP
638 645
639#ifdef CONFIG_DEBUG_BLK_CGROUP
640void blkiocg_update_dequeue_stats(struct blkio_group *blkg,
641 unsigned long dequeue)
642{
643 blkg->stats.dequeue += dequeue;
644}
645EXPORT_SYMBOL_GPL(blkiocg_update_dequeue_stats);
646#endif
647
648static int blkio_check_dev_num(dev_t dev) 646static int blkio_check_dev_num(dev_t dev)
649{ 647{
650 int part = 0; 648 int part = 0;
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h
index 3c27bdfc97b9..1d409ad9c6e8 100644
--- a/block/blk-cgroup.h
+++ b/block/blk-cgroup.h
@@ -169,7 +169,7 @@ static inline char *blkg_path(struct blkio_group *blkg)
169{ 169{
170 return blkg->path; 170 return blkg->path;
171} 171}
172void blkiocg_update_set_active_queue_stats(struct blkio_group *blkg); 172void blkiocg_update_avg_queue_size_stats(struct blkio_group *blkg);
173void blkiocg_update_dequeue_stats(struct blkio_group *blkg, 173void blkiocg_update_dequeue_stats(struct blkio_group *blkg,
174 unsigned long dequeue); 174 unsigned long dequeue);
175void blkiocg_update_set_idle_time_stats(struct blkio_group *blkg); 175void blkiocg_update_set_idle_time_stats(struct blkio_group *blkg);
@@ -198,7 +198,7 @@ BLKG_FLAG_FNS(empty)
198#undef BLKG_FLAG_FNS 198#undef BLKG_FLAG_FNS
199#else 199#else
200static inline char *blkg_path(struct blkio_group *blkg) { return NULL; } 200static inline char *blkg_path(struct blkio_group *blkg) { return NULL; }
201static inline void blkiocg_update_set_active_queue_stats( 201static inline void blkiocg_update_avg_queue_size_stats(
202 struct blkio_group *blkg) {} 202 struct blkio_group *blkg) {}
203static inline void blkiocg_update_dequeue_stats(struct blkio_group *blkg, 203static inline void blkiocg_update_dequeue_stats(struct blkio_group *blkg,
204 unsigned long dequeue) {} 204 unsigned long dequeue) {}
@@ -226,9 +226,9 @@ void blkiocg_update_completion_stats(struct blkio_group *blkg,
226 uint64_t start_time, uint64_t io_start_time, bool direction, bool sync); 226 uint64_t start_time, uint64_t io_start_time, bool direction, bool sync);
227void blkiocg_update_io_merged_stats(struct blkio_group *blkg, bool direction, 227void blkiocg_update_io_merged_stats(struct blkio_group *blkg, bool direction,
228 bool sync); 228 bool sync);
229void blkiocg_update_request_add_stats(struct blkio_group *blkg, 229void blkiocg_update_io_add_stats(struct blkio_group *blkg,
230 struct blkio_group *curr_blkg, bool direction, bool sync); 230 struct blkio_group *curr_blkg, bool direction, bool sync);
231void blkiocg_update_request_remove_stats(struct blkio_group *blkg, 231void blkiocg_update_io_remove_stats(struct blkio_group *blkg,
232 bool direction, bool sync); 232 bool direction, bool sync);
233#else 233#else
234struct cgroup; 234struct cgroup;
@@ -253,9 +253,9 @@ static inline void blkiocg_update_completion_stats(struct blkio_group *blkg,
253 bool sync) {} 253 bool sync) {}
254static inline void blkiocg_update_io_merged_stats(struct blkio_group *blkg, 254static inline void blkiocg_update_io_merged_stats(struct blkio_group *blkg,
255 bool direction, bool sync) {} 255 bool direction, bool sync) {}
256static inline void blkiocg_update_request_add_stats(struct blkio_group *blkg, 256static inline void blkiocg_update_io_add_stats(struct blkio_group *blkg,
257 struct blkio_group *curr_blkg, bool direction, bool sync) {} 257 struct blkio_group *curr_blkg, bool direction, bool sync) {}
258static inline void blkiocg_update_request_remove_stats(struct blkio_group *blkg, 258static inline void blkiocg_update_io_remove_stats(struct blkio_group *blkg,
259 bool direction, bool sync) {} 259 bool direction, bool sync) {}
260#endif 260#endif
261#endif /* _BLK_CGROUP_H */ 261#endif /* _BLK_CGROUP_H */
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 91af2f2e59ce..42be3b68d356 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -1381,10 +1381,10 @@ static void cfq_reposition_rq_rb(struct cfq_queue *cfqq, struct request *rq)
1381{ 1381{
1382 elv_rb_del(&cfqq->sort_list, rq); 1382 elv_rb_del(&cfqq->sort_list, rq);
1383 cfqq->queued[rq_is_sync(rq)]--; 1383 cfqq->queued[rq_is_sync(rq)]--;
1384 blkiocg_update_request_remove_stats(&cfqq->cfqg->blkg, rq_data_dir(rq), 1384 blkiocg_update_io_remove_stats(&cfqq->cfqg->blkg, rq_data_dir(rq),
1385 rq_is_sync(rq)); 1385 rq_is_sync(rq));
1386 cfq_add_rq_rb(rq); 1386 cfq_add_rq_rb(rq);
1387 blkiocg_update_request_add_stats( 1387 blkiocg_update_io_add_stats(
1388 &cfqq->cfqg->blkg, &cfqq->cfqd->serving_group->blkg, 1388 &cfqq->cfqg->blkg, &cfqq->cfqd->serving_group->blkg,
1389 rq_data_dir(rq), rq_is_sync(rq)); 1389 rq_data_dir(rq), rq_is_sync(rq));
1390} 1390}
@@ -1442,7 +1442,7 @@ static void cfq_remove_request(struct request *rq)
1442 cfq_del_rq_rb(rq); 1442 cfq_del_rq_rb(rq);
1443 1443
1444 cfqq->cfqd->rq_queued--; 1444 cfqq->cfqd->rq_queued--;
1445 blkiocg_update_request_remove_stats(&cfqq->cfqg->blkg, rq_data_dir(rq), 1445 blkiocg_update_io_remove_stats(&cfqq->cfqg->blkg, rq_data_dir(rq),
1446 rq_is_sync(rq)); 1446 rq_is_sync(rq));
1447 if (rq_is_meta(rq)) { 1447 if (rq_is_meta(rq)) {
1448 WARN_ON(!cfqq->meta_pending); 1448 WARN_ON(!cfqq->meta_pending);
@@ -1541,7 +1541,7 @@ static void __cfq_set_active_queue(struct cfq_data *cfqd,
1541 if (cfqq) { 1541 if (cfqq) {
1542 cfq_log_cfqq(cfqd, cfqq, "set_active wl_prio:%d wl_type:%d", 1542 cfq_log_cfqq(cfqd, cfqq, "set_active wl_prio:%d wl_type:%d",
1543 cfqd->serving_prio, cfqd->serving_type); 1543 cfqd->serving_prio, cfqd->serving_type);
1544 blkiocg_update_set_active_queue_stats(&cfqq->cfqg->blkg); 1544 blkiocg_update_avg_queue_size_stats(&cfqq->cfqg->blkg);
1545 cfqq->slice_start = 0; 1545 cfqq->slice_start = 0;
1546 cfqq->dispatch_start = jiffies; 1546 cfqq->dispatch_start = jiffies;
1547 cfqq->allocated_slice = 0; 1547 cfqq->allocated_slice = 0;
@@ -2395,11 +2395,6 @@ static int cfq_dispatch_requests(struct request_queue *q, int force)
2395 } 2395 }
2396 2396
2397 cfq_log_cfqq(cfqd, cfqq, "dispatched a request"); 2397 cfq_log_cfqq(cfqd, cfqq, "dispatched a request");
2398 /*
2399 * This is needed since we don't exactly match the mod_timer() and
2400 * del_timer() calls in CFQ.
2401 */
2402 blkiocg_update_idle_time_stats(&cfqq->cfqg->blkg);
2403 return 1; 2398 return 1;
2404} 2399}
2405 2400
@@ -3208,8 +3203,11 @@ cfq_rq_enqueued(struct cfq_data *cfqd, struct cfq_queue *cfqq,
3208 cfq_del_timer(cfqd, cfqq); 3203 cfq_del_timer(cfqd, cfqq);
3209 cfq_clear_cfqq_wait_request(cfqq); 3204 cfq_clear_cfqq_wait_request(cfqq);
3210 __blk_run_queue(cfqd->queue); 3205 __blk_run_queue(cfqd->queue);
3211 } else 3206 } else {
3207 blkiocg_update_idle_time_stats(
3208 &cfqq->cfqg->blkg);
3212 cfq_mark_cfqq_must_dispatch(cfqq); 3209 cfq_mark_cfqq_must_dispatch(cfqq);
3210 }
3213 } 3211 }
3214 } else if (cfq_should_preempt(cfqd, cfqq, rq)) { 3212 } else if (cfq_should_preempt(cfqd, cfqq, rq)) {
3215 /* 3213 /*
@@ -3235,7 +3233,7 @@ static void cfq_insert_request(struct request_queue *q, struct request *rq)
3235 list_add_tail(&rq->queuelist, &cfqq->fifo); 3233 list_add_tail(&rq->queuelist, &cfqq->fifo);
3236 cfq_add_rq_rb(rq); 3234 cfq_add_rq_rb(rq);
3237 3235
3238 blkiocg_update_request_add_stats(&cfqq->cfqg->blkg, 3236 blkiocg_update_io_add_stats(&cfqq->cfqg->blkg,
3239 &cfqd->serving_group->blkg, rq_data_dir(rq), 3237 &cfqd->serving_group->blkg, rq_data_dir(rq),
3240 rq_is_sync(rq)); 3238 rq_is_sync(rq));
3241 cfq_rq_enqueued(cfqd, cfqq, rq); 3239 cfq_rq_enqueued(cfqd, cfqq, rq);