diff options
author | Tejun Heo <tj@kernel.org> | 2012-03-05 16:15:09 -0500 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2012-03-06 15:27:22 -0500 |
commit | 7a4dd281ec66224f802093962d1d903d86b09560 (patch) | |
tree | c38c5c40464d4d7eb429cc14348a435176832ef2 /block/cfq-iosched.c | |
parent | 4bfd482e73b30284cb21e10834ce729fa81aa256 (diff) |
blkcg: kill the mind-bending blkg->dev
blkg->dev is dev_t recording the device number of the block device for
the associated request_queue. It is used to identify the associated
block device when printing out configuration or stats.
This is redundant to begin with. A blkg is an association between a
cgroup and a request_queue and it of course is possible to reach
request_queue from blkg and synchronization conventions are in place
for safe q dereferencing, so this shouldn't be necessary from the
beginning. Furthermore, it's initialized by sscanf()ing the device
name of backing_dev_info. The mind boggles.
Anyways, if blkg is visible under rcu lock, we *know* that the
associated request_queue hasn't gone away yet and its bdi is
registered and alive - blkg can't be created for request_queue which
hasn't been fully initialized and it can't go away before blkg is
removed.
Let stat and conf read functions get device name from
blkg->q->backing_dev_info.dev and pass it down to printing functions
and remove blkg->dev.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/cfq-iosched.c')
-rw-r--r-- | block/cfq-iosched.c | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index 08d4fdd188fa..f67d109eb974 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
@@ -1052,20 +1052,7 @@ static void cfq_link_blkio_group(struct request_queue *q, | |||
1052 | struct blkio_group *blkg) | 1052 | struct blkio_group *blkg) |
1053 | { | 1053 | { |
1054 | struct cfq_data *cfqd = q->elevator->elevator_data; | 1054 | struct cfq_data *cfqd = q->elevator->elevator_data; |
1055 | struct backing_dev_info *bdi = &q->backing_dev_info; | ||
1056 | struct cfq_group *cfqg = cfqg_of_blkg(blkg); | 1055 | struct cfq_group *cfqg = cfqg_of_blkg(blkg); |
1057 | unsigned int major, minor; | ||
1058 | |||
1059 | /* | ||
1060 | * Add group onto cgroup list. It might happen that bdi->dev is | ||
1061 | * not initialized yet. Initialize this new group without major | ||
1062 | * and minor info and this info will be filled in once a new thread | ||
1063 | * comes for IO. | ||
1064 | */ | ||
1065 | if (bdi->dev) { | ||
1066 | sscanf(dev_name(bdi->dev), "%u:%u", &major, &minor); | ||
1067 | blkg->dev = MKDEV(major, minor); | ||
1068 | } | ||
1069 | 1056 | ||
1070 | cfqd->nr_blkcg_linked_grps++; | 1057 | cfqd->nr_blkcg_linked_grps++; |
1071 | 1058 | ||
@@ -1104,7 +1091,6 @@ static struct cfq_group *cfq_lookup_create_cfqg(struct cfq_data *cfqd, | |||
1104 | struct blkio_cgroup *blkcg) | 1091 | struct blkio_cgroup *blkcg) |
1105 | { | 1092 | { |
1106 | struct request_queue *q = cfqd->queue; | 1093 | struct request_queue *q = cfqd->queue; |
1107 | struct backing_dev_info *bdi = &q->backing_dev_info; | ||
1108 | struct cfq_group *cfqg = NULL; | 1094 | struct cfq_group *cfqg = NULL; |
1109 | 1095 | ||
1110 | /* avoid lookup for the common case where there's no blkio cgroup */ | 1096 | /* avoid lookup for the common case where there's no blkio cgroup */ |
@@ -1118,13 +1104,6 @@ static struct cfq_group *cfq_lookup_create_cfqg(struct cfq_data *cfqd, | |||
1118 | cfqg = cfqg_of_blkg(blkg); | 1104 | cfqg = cfqg_of_blkg(blkg); |
1119 | } | 1105 | } |
1120 | 1106 | ||
1121 | if (cfqg && !cfqg->blkg.dev && bdi->dev && dev_name(bdi->dev)) { | ||
1122 | unsigned int major, minor; | ||
1123 | |||
1124 | sscanf(dev_name(bdi->dev), "%u:%u", &major, &minor); | ||
1125 | cfqg->blkg.dev = MKDEV(major, minor); | ||
1126 | } | ||
1127 | |||
1128 | return cfqg; | 1107 | return cfqg; |
1129 | } | 1108 | } |
1130 | 1109 | ||