aboutsummaryrefslogtreecommitdiffstats
path: root/block/cfq-iosched.c
diff options
context:
space:
mode:
authorDivyesh Shah <dpshah@google.com>2010-04-09 00:14:23 -0400
committerJens Axboe <jens.axboe@oracle.com>2010-04-09 02:36:07 -0400
commit812d402648f4fc1ab1091b2172a46fc1b367c724 (patch)
tree9dc52d5bfdbc170559169a0157ed3295d551e9cf /block/cfq-iosched.c
parent84c124da9ff50bd71fab9c939ee5b7cd8bef2bd9 (diff)
blkio: Add io_merged stat
This includes both the number of bios merged into requests belonging to this cgroup as well as the number of requests merged together. In the past, we've observed different merging behavior across upstream kernels, some by design some actual bugs. This stat helps a lot in debugging such problems when applications report decreased throughput with a new kernel version. This needed adding an extra elevator function to capture bios being merged as I did not want to pollute elevator code with blkiocg knowledge and hence needed the accounting invocation to come from CFQ. Signed-off-by: Divyesh Shah<dpshah@google.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'block/cfq-iosched.c')
-rw-r--r--block/cfq-iosched.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 5617ae030b15..4eb1906cf6c6 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -1467,6 +1467,14 @@ static void cfq_merged_request(struct request_queue *q, struct request *req,
1467 } 1467 }
1468} 1468}
1469 1469
1470static void cfq_bio_merged(struct request_queue *q, struct request *req,
1471 struct bio *bio)
1472{
1473 struct cfq_queue *cfqq = RQ_CFQQ(req);
1474 blkiocg_update_io_merged_stats(&cfqq->cfqg->blkg, bio_data_dir(bio),
1475 cfq_bio_sync(bio));
1476}
1477
1470static void 1478static void
1471cfq_merged_requests(struct request_queue *q, struct request *rq, 1479cfq_merged_requests(struct request_queue *q, struct request *rq,
1472 struct request *next) 1480 struct request *next)
@@ -1484,6 +1492,8 @@ cfq_merged_requests(struct request_queue *q, struct request *rq,
1484 if (cfqq->next_rq == next) 1492 if (cfqq->next_rq == next)
1485 cfqq->next_rq = rq; 1493 cfqq->next_rq = rq;
1486 cfq_remove_request(next); 1494 cfq_remove_request(next);
1495 blkiocg_update_io_merged_stats(&cfqq->cfqg->blkg, rq_data_dir(next),
1496 rq_is_sync(next));
1487} 1497}
1488 1498
1489static int cfq_allow_merge(struct request_queue *q, struct request *rq, 1499static int cfq_allow_merge(struct request_queue *q, struct request *rq,
@@ -3861,6 +3871,7 @@ static struct elevator_type iosched_cfq = {
3861 .elevator_merged_fn = cfq_merged_request, 3871 .elevator_merged_fn = cfq_merged_request,
3862 .elevator_merge_req_fn = cfq_merged_requests, 3872 .elevator_merge_req_fn = cfq_merged_requests,
3863 .elevator_allow_merge_fn = cfq_allow_merge, 3873 .elevator_allow_merge_fn = cfq_allow_merge,
3874 .elevator_bio_merged_fn = cfq_bio_merged,
3864 .elevator_dispatch_fn = cfq_dispatch_requests, 3875 .elevator_dispatch_fn = cfq_dispatch_requests,
3865 .elevator_add_req_fn = cfq_insert_request, 3876 .elevator_add_req_fn = cfq_insert_request,
3866 .elevator_activate_req_fn = cfq_activate_request, 3877 .elevator_activate_req_fn = cfq_activate_request,