aboutsummaryrefslogtreecommitdiffstats
path: root/block/cfq-iosched.c
diff options
context:
space:
mode:
authorVivek Goyal <vgoyal@redhat.com>2009-12-03 12:59:49 -0500
committerJens Axboe <jens.axboe@oracle.com>2009-12-03 13:28:52 -0500
commit220841906fccafaf4094e87bdb6d252e20cf8c7c (patch)
treef25b1f057887cf2a05bb8309e0b757149e052797 /block/cfq-iosched.c
parent2868ef7b39490e6b41c2c61cd9a5cd891e778b54 (diff)
blkio: Export disk time and sectors used by a group to user space
o Export disk time and sector used by a group to user space through cgroup interface. o Also export a "dequeue" interface to cgroup which keeps track of how many a times a group was deleted from service tree. Helps in debugging. Signed-off-by: Vivek Goyal <vgoyal@redhat.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'block/cfq-iosched.c')
-rw-r--r--block/cfq-iosched.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 662d4e55b3c2..7d345e772d88 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -143,6 +143,8 @@ struct cfq_queue {
143 struct cfq_rb_root *service_tree; 143 struct cfq_rb_root *service_tree;
144 struct cfq_queue *new_cfqq; 144 struct cfq_queue *new_cfqq;
145 struct cfq_group *cfqg; 145 struct cfq_group *cfqg;
146 /* Sectors dispatched in current dispatch round */
147 unsigned long nr_sectors;
146}; 148};
147 149
148/* 150/*
@@ -852,6 +854,7 @@ cfq_group_service_tree_del(struct cfq_data *cfqd, struct cfq_group *cfqg)
852 if (!RB_EMPTY_NODE(&cfqg->rb_node)) 854 if (!RB_EMPTY_NODE(&cfqg->rb_node))
853 cfq_rb_erase(&cfqg->rb_node, st); 855 cfq_rb_erase(&cfqg->rb_node, st);
854 cfqg->saved_workload_slice = 0; 856 cfqg->saved_workload_slice = 0;
857 blkiocg_update_blkio_group_dequeue_stats(&cfqg->blkg, 1);
855} 858}
856 859
857static inline unsigned int cfq_cfqq_slice_usage(struct cfq_queue *cfqq) 860static inline unsigned int cfq_cfqq_slice_usage(struct cfq_queue *cfqq)
@@ -878,7 +881,8 @@ static inline unsigned int cfq_cfqq_slice_usage(struct cfq_queue *cfqq)
878 slice_used = allocated_slice; 881 slice_used = allocated_slice;
879 } 882 }
880 883
881 cfq_log_cfqq(cfqq->cfqd, cfqq, "sl_used=%u", slice_used); 884 cfq_log_cfqq(cfqq->cfqd, cfqq, "sl_used=%u sect=%lu", slice_used,
885 cfqq->nr_sectors);
882 return slice_used; 886 return slice_used;
883} 887}
884 888
@@ -906,6 +910,8 @@ static void cfq_group_served(struct cfq_data *cfqd, struct cfq_group *cfqg,
906 910
907 cfq_log_cfqg(cfqd, cfqg, "served: vt=%llu min_vt=%llu", cfqg->vdisktime, 911 cfq_log_cfqg(cfqd, cfqg, "served: vt=%llu min_vt=%llu", cfqg->vdisktime,
908 st->min_vdisktime); 912 st->min_vdisktime);
913 blkiocg_update_blkio_group_stats(&cfqg->blkg, used_sl,
914 cfqq->nr_sectors);
909} 915}
910 916
911#ifdef CONFIG_CFQ_GROUP_IOSCHED 917#ifdef CONFIG_CFQ_GROUP_IOSCHED
@@ -924,6 +930,8 @@ cfq_find_alloc_cfqg(struct cfq_data *cfqd, struct cgroup *cgroup, int create)
924 void *key = cfqd; 930 void *key = cfqd;
925 int i, j; 931 int i, j;
926 struct cfq_rb_root *st; 932 struct cfq_rb_root *st;
933 struct backing_dev_info *bdi = &cfqd->queue->backing_dev_info;
934 unsigned int major, minor;
927 935
928 /* Do we need to take this reference */ 936 /* Do we need to take this reference */
929 if (!css_tryget(&blkcg->css)) 937 if (!css_tryget(&blkcg->css))
@@ -951,7 +959,9 @@ cfq_find_alloc_cfqg(struct cfq_data *cfqd, struct cgroup *cgroup, int create)
951 atomic_set(&cfqg->ref, 1); 959 atomic_set(&cfqg->ref, 1);
952 960
953 /* Add group onto cgroup list */ 961 /* Add group onto cgroup list */
954 blkiocg_add_blkio_group(blkcg, &cfqg->blkg, (void *)cfqd); 962 sscanf(dev_name(bdi->dev), "%u:%u", &major, &minor);
963 blkiocg_add_blkio_group(blkcg, &cfqg->blkg, (void *)cfqd,
964 MKDEV(major, minor));
955 965
956 /* Add group on cfqd list */ 966 /* Add group on cfqd list */
957 hlist_add_head(&cfqg->cfqd_node, &cfqd->cfqg_list); 967 hlist_add_head(&cfqg->cfqd_node, &cfqd->cfqg_list);
@@ -1478,6 +1488,7 @@ static void __cfq_set_active_queue(struct cfq_data *cfqd,
1478 cfqq->dispatch_start = jiffies; 1488 cfqq->dispatch_start = jiffies;
1479 cfqq->slice_end = 0; 1489 cfqq->slice_end = 0;
1480 cfqq->slice_dispatch = 0; 1490 cfqq->slice_dispatch = 0;
1491 cfqq->nr_sectors = 0;
1481 1492
1482 cfq_clear_cfqq_wait_request(cfqq); 1493 cfq_clear_cfqq_wait_request(cfqq);
1483 cfq_clear_cfqq_must_dispatch(cfqq); 1494 cfq_clear_cfqq_must_dispatch(cfqq);
@@ -1801,6 +1812,7 @@ static void cfq_dispatch_insert(struct request_queue *q, struct request *rq)
1801 1812
1802 if (cfq_cfqq_sync(cfqq)) 1813 if (cfq_cfqq_sync(cfqq))
1803 cfqd->sync_flight++; 1814 cfqd->sync_flight++;
1815 cfqq->nr_sectors += blk_rq_sectors(rq);
1804} 1816}
1805 1817
1806/* 1818/*
@@ -3513,7 +3525,8 @@ static void *cfq_init_queue(struct request_queue *q)
3513 * to make sure that cfq_put_cfqg() does not try to kfree root group 3525 * to make sure that cfq_put_cfqg() does not try to kfree root group
3514 */ 3526 */
3515 atomic_set(&cfqg->ref, 1); 3527 atomic_set(&cfqg->ref, 1);
3516 blkiocg_add_blkio_group(&blkio_root_cgroup, &cfqg->blkg, (void *)cfqd); 3528 blkiocg_add_blkio_group(&blkio_root_cgroup, &cfqg->blkg, (void *)cfqd,
3529 0);
3517#endif 3530#endif
3518 /* 3531 /*
3519 * Not strictly needed (since RB_ROOT just clears the node and we 3532 * Not strictly needed (since RB_ROOT just clears the node and we