aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk-throttle.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2014-05-13 12:16:21 -0400
committerTejun Heo <tj@kernel.org>2014-05-13 12:16:21 -0400
commit451af504df0c62f695a69b83c250486e77c66378 (patch)
treef89879cf3f88e9da346d8bd3fa1ae192a280d772 /block/blk-throttle.c
parentb41686401e501430ffe93b575ef7959d2ecc6f2e (diff)
cgroup: replace cftype->write_string() with cftype->write()
Convert all cftype->write_string() users to the new cftype->write() which maps directly to kernfs write operation and has full access to kernfs and cgroup contexts. The conversions are mostly mechanical. * @css and @cft are accessed using of_css() and of_cft() accessors respectively instead of being specified as arguments. * Should return @nbytes on success instead of 0. * @buf is not trimmed automatically. Trim if necessary. Note that blkcg and netprio don't need this as the parsers already handle whitespaces. cftype->write_string() has no user left after the conversions and removed. While at it, remove unnecessary local variable @p in cgroup_subtree_control_write() and stale comment about CGROUP_LOCAL_BUFFER_SIZE in cgroup_freezer.c. This patch doesn't introduce any visible behavior changes. v2: netprio was missing from conversion. Converted. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Aristeu Rozanski <arozansk@redhat.com> Acked-by: Vivek Goyal <vgoyal@redhat.com> Acked-by: Li Zefan <lizefan@huawei.com> Cc: Jens Axboe <axboe@kernel.dk> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Michal Hocko <mhocko@suse.cz> Cc: Neil Horman <nhorman@tuxdriver.com> Cc: "David S. Miller" <davem@davemloft.net>
Diffstat (limited to 'block/blk-throttle.c')
-rw-r--r--block/blk-throttle.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index 033745cd7fba..5e8fd1bace98 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -1346,10 +1346,10 @@ static int tg_print_conf_uint(struct seq_file *sf, void *v)
1346 return 0; 1346 return 0;
1347} 1347}
1348 1348
1349static int tg_set_conf(struct cgroup_subsys_state *css, struct cftype *cft, 1349static ssize_t tg_set_conf(struct kernfs_open_file *of,
1350 const char *buf, bool is_u64) 1350 char *buf, size_t nbytes, loff_t off, bool is_u64)
1351{ 1351{
1352 struct blkcg *blkcg = css_to_blkcg(css); 1352 struct blkcg *blkcg = css_to_blkcg(of_css(of));
1353 struct blkg_conf_ctx ctx; 1353 struct blkg_conf_ctx ctx;
1354 struct throtl_grp *tg; 1354 struct throtl_grp *tg;
1355 struct throtl_service_queue *sq; 1355 struct throtl_service_queue *sq;
@@ -1368,9 +1368,9 @@ static int tg_set_conf(struct cgroup_subsys_state *css, struct cftype *cft,
1368 ctx.v = -1; 1368 ctx.v = -1;
1369 1369
1370 if (is_u64) 1370 if (is_u64)
1371 *(u64 *)((void *)tg + cft->private) = ctx.v; 1371 *(u64 *)((void *)tg + of_cft(of)->private) = ctx.v;
1372 else 1372 else
1373 *(unsigned int *)((void *)tg + cft->private) = ctx.v; 1373 *(unsigned int *)((void *)tg + of_cft(of)->private) = ctx.v;
1374 1374
1375 throtl_log(&tg->service_queue, 1375 throtl_log(&tg->service_queue,
1376 "limit change rbps=%llu wbps=%llu riops=%u wiops=%u", 1376 "limit change rbps=%llu wbps=%llu riops=%u wiops=%u",
@@ -1404,19 +1404,19 @@ static int tg_set_conf(struct cgroup_subsys_state *css, struct cftype *cft,
1404 } 1404 }
1405 1405
1406 blkg_conf_finish(&ctx); 1406 blkg_conf_finish(&ctx);
1407 return 0; 1407 return nbytes;
1408} 1408}
1409 1409
1410static int tg_set_conf_u64(struct cgroup_subsys_state *css, struct cftype *cft, 1410static ssize_t tg_set_conf_u64(struct kernfs_open_file *of,
1411 char *buf) 1411 char *buf, size_t nbytes, loff_t off)
1412{ 1412{
1413 return tg_set_conf(css, cft, buf, true); 1413 return tg_set_conf(of, buf, nbytes, off, true);
1414} 1414}
1415 1415
1416static int tg_set_conf_uint(struct cgroup_subsys_state *css, struct cftype *cft, 1416static ssize_t tg_set_conf_uint(struct kernfs_open_file *of,
1417 char *buf) 1417 char *buf, size_t nbytes, loff_t off)
1418{ 1418{
1419 return tg_set_conf(css, cft, buf, false); 1419 return tg_set_conf(of, buf, nbytes, off, false);
1420} 1420}
1421 1421
1422static struct cftype throtl_files[] = { 1422static struct cftype throtl_files[] = {
@@ -1424,25 +1424,25 @@ static struct cftype throtl_files[] = {
1424 .name = "throttle.read_bps_device", 1424 .name = "throttle.read_bps_device",
1425 .private = offsetof(struct throtl_grp, bps[READ]), 1425 .private = offsetof(struct throtl_grp, bps[READ]),
1426 .seq_show = tg_print_conf_u64, 1426 .seq_show = tg_print_conf_u64,
1427 .write_string = tg_set_conf_u64, 1427 .write = tg_set_conf_u64,
1428 }, 1428 },
1429 { 1429 {
1430 .name = "throttle.write_bps_device", 1430 .name = "throttle.write_bps_device",
1431 .private = offsetof(struct throtl_grp, bps[WRITE]), 1431 .private = offsetof(struct throtl_grp, bps[WRITE]),
1432 .seq_show = tg_print_conf_u64, 1432 .seq_show = tg_print_conf_u64,
1433 .write_string = tg_set_conf_u64, 1433 .write = tg_set_conf_u64,
1434 }, 1434 },
1435 { 1435 {
1436 .name = "throttle.read_iops_device", 1436 .name = "throttle.read_iops_device",
1437 .private = offsetof(struct throtl_grp, iops[READ]), 1437 .private = offsetof(struct throtl_grp, iops[READ]),
1438 .seq_show = tg_print_conf_uint, 1438 .seq_show = tg_print_conf_uint,
1439 .write_string = tg_set_conf_uint, 1439 .write = tg_set_conf_uint,
1440 }, 1440 },
1441 { 1441 {
1442 .name = "throttle.write_iops_device", 1442 .name = "throttle.write_iops_device",
1443 .private = offsetof(struct throtl_grp, iops[WRITE]), 1443 .private = offsetof(struct throtl_grp, iops[WRITE]),
1444 .seq_show = tg_print_conf_uint, 1444 .seq_show = tg_print_conf_uint,
1445 .write_string = tg_set_conf_uint, 1445 .write = tg_set_conf_uint,
1446 }, 1446 },
1447 { 1447 {
1448 .name = "throttle.io_service_bytes", 1448 .name = "throttle.io_service_bytes",