Skip to contentSkip to conversation

Expose the statistics in blkio.time and blkio.sectors for the root cgroup

PATCH In review Ricky Benitez 3 participants 4 messages Mar 24, 2010 – Apr 5, 2010 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Expose the statistics in blkio.time and blkio.sectors for the root cgroup

Currently, the io statistics for the root cgroup are maintained, but they are not shown because the device information is not available at the point that the root blkio cgroup is created. This patch updates the device information when the statistics are updated so that the statistics become visible.

---
 block/cfq-iosched.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
block/cfq-iosched.c +5 -0
index dee9d93..4a3579a 100644
@@ -947,6 +947,11 @@ cfq_find_alloc_cfqg(struct cfq_data *cfqd, struct cgroup *cgroup, int create)
 	unsigned int major, minor;
 
 	cfqg = cfqg_of_blkg(blkiocg_lookup_group(blkcg, key));
+	if (cfqg && !cfqg->blkg.dev && bdi->dev && dev_name(bdi->dev)) {
+		sscanf(dev_name(bdi->dev), "%u:%u", &major, &minor);
+		cfqg->blkg.dev = MKDEV(major, minor);
+		goto done;
+	}
 	if (cfqg || !create)
 		goto done;
 
Signature · 1 line
1.7.0.1
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Ricky Benitez

Currently, the io statistics for the root cgroup are maintained, but they are not shown because the device information is not available at the point that the root blkio cgroup is created. This patch updates the device information when the statistics are updated so that the statistics become visible.

Ok, root group is created when request queue is being initialized and device information like major/minor number is not available. This is not the cleanest solution but can't think of something better right now.

Thanks
Vivek

Quoted 23 lines
---
 block/cfq-iosched.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
block/cfq-iosched.c +5 -0
index dee9d93..4a3579a 100644
@@ -947,6 +947,11 @@ cfq_find_alloc_cfqg(struct cfq_data *cfqd, struct cgroup *cgroup, int create)
 	unsigned int major, minor;
 
 	cfqg = cfqg_of_blkg(blkiocg_lookup_group(blkcg, key));
+	if (cfqg && !cfqg->blkg.dev && bdi->dev && dev_name(bdi->dev)) {
+		sscanf(dev_name(bdi->dev), "%u:%u", &major, &minor);
+		cfqg->blkg.dev = MKDEV(major, minor);
+		goto done;
+	}
 	if (cfqg || !create)
 		goto done;
 
Signature · 1 line
1.7.0.1
#2 lore raw

Jens,

Please let me know if this patch is/isn't acceptable. Not having the statistics exposed at the root is a little bit problematic for our user-level control programs.

-Ricky

Quoted 41 lines · Vivek Goyal
Quoted 6 lines · Ricky Benitez

Currently, the io statistics for the root cgroup are maintained, but they are not shown because the device information is not available at the point that the root blkio cgroup is created. This patch updates the device information when the statistics are updated so that the statistics become visible.

Ok, root group is created when request queue is being initialized and device information like major/minor number is not available. This is not the cleanest solution but can't think of something better right now.

Thanks
Vivek

Quoted 23 lines

---
 block/cfq-iosched.c |    5 +++++

 1 files changed, 5 insertions(+), 0 deletions(-)
block/cfq-iosched.c +5 -1
index dee9d93..4a3579a 100644
@@ -947,6 +947,11 @@ cfq_find_alloc_cfqg(struct cfq_data *cfqd, struct cgroup *cgroup, int create)
       unsigned int major, minor;
 
       cfqg = cfqg_of_blkg(blkiocg_lookup_group(blkcg, key));
+     if (cfqg && !cfqg->blkg.dev && bdi->dev && dev_name(bdi->dev)) {
+             sscanf(dev_name(bdi->dev), "%u:%u", &major, &minor);
+             cfqg->blkg.dev = MKDEV(major, minor);
+             goto done;
+     }
       if (cfqg || !create)
               goto done;
 
--

1.7.0.1

#3 lore raw
Quoted 5 lines · Manuel Benitez

Jens,

Please let me know if this patch is/isn't acceptable. Not having the statistics exposed at the root is a little bit problematic for our user-level control programs.

It's fine with me, I'll queue it up.

Signature · 1 line
Jens Axboe