aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTejun Heo2012-04-01 16:38:43 -0500
committerTejun Heo2012-04-01 16:38:43 -0500
commit627f29f48158c3088cc55a25d8650cae455ff63b (patch)
treec8b2eb5250fbf15e5f932d15714b37f2ff6227a7 /block/blk-cgroup.c
parentd3d32e69fa368e131b25ee68806aa3fd3916cec1 (diff)
downloadkernel-common-627f29f48158c3088cc55a25d8650cae455ff63b.tar.gz
kernel-common-627f29f48158c3088cc55a25d8650cae455ff63b.tar.xz
kernel-common-627f29f48158c3088cc55a25d8650cae455ff63b.zip
blkcg: drop blkiocg_file_write_u64()
blkiocg_file_write_u64() has single switch case. Drop blkiocg_file_write_u64(), rename blkio_weight_write() to blkcg_set_weight() and use it directly for .write_u64 callback. Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'block/blk-cgroup.c')
-rw-r--r--block/blk-cgroup.c35
1 files changed, 7 insertions, 28 deletions
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 951e7f3a8c8..13cae77e8bf 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -1207,8 +1207,9 @@ static int blkiocg_file_read(struct cgroup *cgrp, struct cftype *cft,
1207 return 0; 1207 return 0;
1208} 1208}
1209 1209
1210static int blkio_weight_write(struct blkio_cgroup *blkcg, int plid, u64 val) 1210static int blkcg_set_weight(struct cgroup *cgrp, struct cftype *cft, u64 val)
1211{ 1211{
1212 struct blkio_cgroup *blkcg = cgroup_to_blkio_cgroup(cgrp);
1212 struct blkio_group *blkg; 1213 struct blkio_group *blkg;
1213 struct hlist_node *n; 1214 struct hlist_node *n;
1214 1215
@@ -1220,10 +1221,11 @@ static int blkio_weight_write(struct blkio_cgroup *blkcg, int plid, u64 val)
1220 blkcg->weight = (unsigned int)val; 1221 blkcg->weight = (unsigned int)val;
1221 1222
1222 hlist_for_each_entry(blkg, n, &blkcg->blkg_list, blkcg_node) { 1223 hlist_for_each_entry(blkg, n, &blkcg->blkg_list, blkcg_node) {
1223 struct blkg_policy_data *pd = blkg->pd[plid]; 1224 struct blkg_policy_data *pd = blkg->pd[BLKIO_POLICY_PROP];
1224 1225
1225 if (!pd->conf.weight) 1226 if (pd && !pd->conf.weight)
1226 blkio_update_group_weight(blkg, plid, blkcg->weight); 1227 blkio_update_group_weight(blkg, BLKIO_POLICY_PROP,
1228 blkcg->weight);
1227 } 1229 }
1228 1230
1229 spin_unlock_irq(&blkcg->lock); 1231 spin_unlock_irq(&blkcg->lock);
@@ -1251,29 +1253,6 @@ static u64 blkiocg_file_read_u64 (struct cgroup *cgrp, struct cftype *cft) {
1251 return 0; 1253 return 0;
1252} 1254}
1253 1255
1254static int
1255blkiocg_file_write_u64(struct cgroup *cgrp, struct cftype *cft, u64 val)
1256{
1257 struct blkio_cgroup *blkcg;
1258 enum blkio_policy_id plid = BLKIOFILE_POLICY(cft->private);
1259 int name = BLKIOFILE_ATTR(cft->private);
1260
1261 blkcg = cgroup_to_blkio_cgroup(cgrp);
1262
1263 switch(plid) {
1264 case BLKIO_POLICY_PROP:
1265 switch(name) {
1266 case BLKIO_PROP_weight:
1267 return blkio_weight_write(blkcg, plid, val);
1268 }
1269 break;
1270 default:
1271 BUG();
1272 }
1273
1274 return 0;
1275}
1276
1277struct cftype blkio_files[] = { 1256struct cftype blkio_files[] = {
1278 { 1257 {
1279 .name = "weight_device", 1258 .name = "weight_device",
@@ -1288,7 +1267,7 @@ struct cftype blkio_files[] = {
1288 .private = BLKIOFILE_PRIVATE(BLKIO_POLICY_PROP, 1267 .private = BLKIOFILE_PRIVATE(BLKIO_POLICY_PROP,
1289 BLKIO_PROP_weight), 1268 BLKIO_PROP_weight),
1290 .read_u64 = blkiocg_file_read_u64, 1269 .read_u64 = blkiocg_file_read_u64,
1291 .write_u64 = blkiocg_file_write_u64, 1270 .write_u64 = blkcg_set_weight,
1292 }, 1271 },
1293 { 1272 {
1294 .name = "time", 1273 .name = "time",