aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk-throttle.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2013-12-05 12:28:04 -0500
committerTejun Heo <tj@kernel.org>2013-12-05 12:28:04 -0500
commit2da8ca822d49c8b8781800ad155aaa00e7bb5f1a (patch)
tree9ec6b0a7a009d76d0c607640eae64d3e9ed666a9 /block/blk-throttle.c
parent7da112792753d71aed44b918395892a1fc53048a (diff)
cgroup: replace cftype->read_seq_string() with cftype->seq_show()
In preparation of conversion to kernfs, cgroup file handling is updated so that it can be easily mapped to kernfs. This patch replaces cftype->read_seq_string() with cftype->seq_show() which is not limited to single_open() operation and will map directcly to kernfs seq_file interface. The conversions are mechanical. As ->seq_show() doesn't have @css and @cft, the functions which make use of them are converted to use seq_css() and seq_cft() respectively. In several occassions, e.f. if it has seq_string in its name, the function name is updated to fit the new method better. This patch does not introduce any behavior changes. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Aristeu Rozanski <arozansk@redhat.com> Acked-by: Vivek Goyal <vgoyal@redhat.com> Acked-by: Michal Hocko <mhocko@suse.cz> Acked-by: Daniel Wagner <daniel.wagner@bmw-carit.de> Acked-by: Li Zefan <lizefan@huawei.com> Cc: Jens Axboe <axboe@kernel.dk> Cc: Ingo Molnar <mingo@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Balbir Singh <bsingharora@gmail.com> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: Neil Horman <nhorman@tuxdriver.com>
Diffstat (limited to 'block/blk-throttle.c')
-rw-r--r--block/blk-throttle.c35
1 files changed, 15 insertions, 20 deletions
diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index 06534049afba..a760857e6b62 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -1303,13 +1303,10 @@ static u64 tg_prfill_cpu_rwstat(struct seq_file *sf,
1303 return __blkg_prfill_rwstat(sf, pd, &rwstat); 1303 return __blkg_prfill_rwstat(sf, pd, &rwstat);
1304} 1304}
1305 1305
1306static int tg_print_cpu_rwstat(struct cgroup_subsys_state *css, 1306static int tg_print_cpu_rwstat(struct seq_file *sf, void *v)
1307 struct cftype *cft, struct seq_file *sf)
1308{ 1307{
1309 struct blkcg *blkcg = css_to_blkcg(css); 1308 blkcg_print_blkgs(sf, css_to_blkcg(seq_css(sf)), tg_prfill_cpu_rwstat,
1310 1309 &blkcg_policy_throtl, seq_cft(sf)->private, true);
1311 blkcg_print_blkgs(sf, blkcg, tg_prfill_cpu_rwstat, &blkcg_policy_throtl,
1312 cft->private, true);
1313 return 0; 1310 return 0;
1314} 1311}
1315 1312
@@ -1335,19 +1332,17 @@ static u64 tg_prfill_conf_uint(struct seq_file *sf, struct blkg_policy_data *pd,
1335 return __blkg_prfill_u64(sf, pd, v); 1332 return __blkg_prfill_u64(sf, pd, v);
1336} 1333}
1337 1334
1338static int tg_print_conf_u64(struct cgroup_subsys_state *css, 1335static int tg_print_conf_u64(struct seq_file *sf, void *v)
1339 struct cftype *cft, struct seq_file *sf)
1340{ 1336{
1341 blkcg_print_blkgs(sf, css_to_blkcg(css), tg_prfill_conf_u64, 1337 blkcg_print_blkgs(sf, css_to_blkcg(seq_css(sf)), tg_prfill_conf_u64,
1342 &blkcg_policy_throtl, cft->private, false); 1338 &blkcg_policy_throtl, seq_cft(sf)->private, false);
1343 return 0; 1339 return 0;
1344} 1340}
1345 1341
1346static int tg_print_conf_uint(struct cgroup_subsys_state *css, 1342static int tg_print_conf_uint(struct seq_file *sf, void *v)
1347 struct cftype *cft, struct seq_file *sf)
1348{ 1343{
1349 blkcg_print_blkgs(sf, css_to_blkcg(css), tg_prfill_conf_uint, 1344 blkcg_print_blkgs(sf, css_to_blkcg(seq_css(sf)), tg_prfill_conf_uint,
1350 &blkcg_policy_throtl, cft->private, false); 1345 &blkcg_policy_throtl, seq_cft(sf)->private, false);
1351 return 0; 1346 return 0;
1352} 1347}
1353 1348
@@ -1428,40 +1423,40 @@ static struct cftype throtl_files[] = {
1428 { 1423 {
1429 .name = "throttle.read_bps_device", 1424 .name = "throttle.read_bps_device",
1430 .private = offsetof(struct throtl_grp, bps[READ]), 1425 .private = offsetof(struct throtl_grp, bps[READ]),
1431 .read_seq_string = tg_print_conf_u64, 1426 .seq_show = tg_print_conf_u64,
1432 .write_string = tg_set_conf_u64, 1427 .write_string = tg_set_conf_u64,
1433 .max_write_len = 256, 1428 .max_write_len = 256,
1434 }, 1429 },
1435 { 1430 {
1436 .name = "throttle.write_bps_device", 1431 .name = "throttle.write_bps_device",
1437 .private = offsetof(struct throtl_grp, bps[WRITE]), 1432 .private = offsetof(struct throtl_grp, bps[WRITE]),
1438 .read_seq_string = tg_print_conf_u64, 1433 .seq_show = tg_print_conf_u64,
1439 .write_string = tg_set_conf_u64, 1434 .write_string = tg_set_conf_u64,
1440 .max_write_len = 256, 1435 .max_write_len = 256,
1441 }, 1436 },
1442 { 1437 {
1443 .name = "throttle.read_iops_device", 1438 .name = "throttle.read_iops_device",
1444 .private = offsetof(struct throtl_grp, iops[READ]), 1439 .private = offsetof(struct throtl_grp, iops[READ]),
1445 .read_seq_string = tg_print_conf_uint, 1440 .seq_show = tg_print_conf_uint,
1446 .write_string = tg_set_conf_uint, 1441 .write_string = tg_set_conf_uint,
1447 .max_write_len = 256, 1442 .max_write_len = 256,
1448 }, 1443 },
1449 { 1444 {
1450 .name = "throttle.write_iops_device", 1445 .name = "throttle.write_iops_device",
1451 .private = offsetof(struct throtl_grp, iops[WRITE]), 1446 .private = offsetof(struct throtl_grp, iops[WRITE]),
1452 .read_seq_string = tg_print_conf_uint, 1447 .seq_show = tg_print_conf_uint,
1453 .write_string = tg_set_conf_uint, 1448 .write_string = tg_set_conf_uint,
1454 .max_write_len = 256, 1449 .max_write_len = 256,
1455 }, 1450 },
1456 { 1451 {
1457 .name = "throttle.io_service_bytes", 1452 .name = "throttle.io_service_bytes",
1458 .private = offsetof(struct tg_stats_cpu, service_bytes), 1453 .private = offsetof(struct tg_stats_cpu, service_bytes),
1459 .read_seq_string = tg_print_cpu_rwstat, 1454 .seq_show = tg_print_cpu_rwstat,
1460 }, 1455 },
1461 { 1456 {
1462 .name = "throttle.io_serviced", 1457 .name = "throttle.io_serviced",
1463 .private = offsetof(struct tg_stats_cpu, serviced), 1458 .private = offsetof(struct tg_stats_cpu, serviced),
1464 .read_seq_string = tg_print_cpu_rwstat, 1459 .seq_show = tg_print_cpu_rwstat,
1465 }, 1460 },
1466 { } /* terminate */ 1461 { } /* terminate */
1467}; 1462};