diff options
author | Jens Axboe <axboe@kernel.dk> | 2019-06-10 05:35:41 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2019-06-10 05:35:41 -0400 |
commit | cf8929885de318c0bf73438c9e5dde59d6536f7c (patch) | |
tree | 70e8a22308b033b9b2200d263cda09fddab6d394 | |
parent | d1fdb6d8f6a4109a4263176c84b899076a5f8008 (diff) |
cgroup/bfq: revert bfq.weight symlink change
There's some discussion on how to do this the best, and Tejun prefers
that BFQ just create the file itself instead of having cgroups support
a symlink feature.
Hence revert commit 54b7b868e826 and 19e9da9e86c4 for 5.2, and this
can be done properly for 5.3.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r-- | block/bfq-cgroup.c | 6 | ||||
-rw-r--r-- | include/linux/cgroup-defs.h | 3 | ||||
-rw-r--r-- | kernel/cgroup/cgroup.c | 33 |
3 files changed, 6 insertions, 36 deletions
diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c index 59f46904cb11..b3796a40a61a 100644 --- a/block/bfq-cgroup.c +++ b/block/bfq-cgroup.c | |||
@@ -1046,8 +1046,7 @@ struct blkcg_policy blkcg_policy_bfq = { | |||
1046 | struct cftype bfq_blkcg_legacy_files[] = { | 1046 | struct cftype bfq_blkcg_legacy_files[] = { |
1047 | { | 1047 | { |
1048 | .name = "bfq.weight", | 1048 | .name = "bfq.weight", |
1049 | .link_name = "weight", | 1049 | .flags = CFTYPE_NOT_ON_ROOT, |
1050 | .flags = CFTYPE_NOT_ON_ROOT | CFTYPE_SYMLINKED, | ||
1051 | .seq_show = bfq_io_show_weight, | 1050 | .seq_show = bfq_io_show_weight, |
1052 | .write_u64 = bfq_io_set_weight_legacy, | 1051 | .write_u64 = bfq_io_set_weight_legacy, |
1053 | }, | 1052 | }, |
@@ -1167,8 +1166,7 @@ struct cftype bfq_blkcg_legacy_files[] = { | |||
1167 | struct cftype bfq_blkg_files[] = { | 1166 | struct cftype bfq_blkg_files[] = { |
1168 | { | 1167 | { |
1169 | .name = "bfq.weight", | 1168 | .name = "bfq.weight", |
1170 | .link_name = "weight", | 1169 | .flags = CFTYPE_NOT_ON_ROOT, |
1171 | .flags = CFTYPE_NOT_ON_ROOT | CFTYPE_SYMLINKED, | ||
1172 | .seq_show = bfq_io_show_weight, | 1170 | .seq_show = bfq_io_show_weight, |
1173 | .write = bfq_io_set_weight, | 1171 | .write = bfq_io_set_weight, |
1174 | }, | 1172 | }, |
diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h index d71b079bb021..11e215d7937e 100644 --- a/include/linux/cgroup-defs.h +++ b/include/linux/cgroup-defs.h | |||
@@ -106,8 +106,6 @@ enum { | |||
106 | CFTYPE_WORLD_WRITABLE = (1 << 4), /* (DON'T USE FOR NEW FILES) S_IWUGO */ | 106 | CFTYPE_WORLD_WRITABLE = (1 << 4), /* (DON'T USE FOR NEW FILES) S_IWUGO */ |
107 | CFTYPE_DEBUG = (1 << 5), /* create when cgroup_debug */ | 107 | CFTYPE_DEBUG = (1 << 5), /* create when cgroup_debug */ |
108 | 108 | ||
109 | CFTYPE_SYMLINKED = (1 << 6), /* pointed to by symlink too */ | ||
110 | |||
111 | /* internal flags, do not use outside cgroup core proper */ | 109 | /* internal flags, do not use outside cgroup core proper */ |
112 | __CFTYPE_ONLY_ON_DFL = (1 << 16), /* only on default hierarchy */ | 110 | __CFTYPE_ONLY_ON_DFL = (1 << 16), /* only on default hierarchy */ |
113 | __CFTYPE_NOT_ON_DFL = (1 << 17), /* not on default hierarchy */ | 111 | __CFTYPE_NOT_ON_DFL = (1 << 17), /* not on default hierarchy */ |
@@ -545,7 +543,6 @@ struct cftype { | |||
545 | * end of cftype array. | 543 | * end of cftype array. |
546 | */ | 544 | */ |
547 | char name[MAX_CFTYPE_NAME]; | 545 | char name[MAX_CFTYPE_NAME]; |
548 | char link_name[MAX_CFTYPE_NAME]; | ||
549 | unsigned long private; | 546 | unsigned long private; |
550 | 547 | ||
551 | /* | 548 | /* |
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index 155048b0eca2..426a0026225c 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c | |||
@@ -1460,8 +1460,8 @@ struct cgroup *task_cgroup_from_root(struct task_struct *task, | |||
1460 | 1460 | ||
1461 | static struct kernfs_syscall_ops cgroup_kf_syscall_ops; | 1461 | static struct kernfs_syscall_ops cgroup_kf_syscall_ops; |
1462 | 1462 | ||
1463 | static char *cgroup_fill_name(struct cgroup *cgrp, const struct cftype *cft, | 1463 | static char *cgroup_file_name(struct cgroup *cgrp, const struct cftype *cft, |
1464 | char *buf, bool write_link_name) | 1464 | char *buf) |
1465 | { | 1465 | { |
1466 | struct cgroup_subsys *ss = cft->ss; | 1466 | struct cgroup_subsys *ss = cft->ss; |
1467 | 1467 | ||
@@ -1471,26 +1471,13 @@ static char *cgroup_fill_name(struct cgroup *cgrp, const struct cftype *cft, | |||
1471 | 1471 | ||
1472 | snprintf(buf, CGROUP_FILE_NAME_MAX, "%s%s.%s", | 1472 | snprintf(buf, CGROUP_FILE_NAME_MAX, "%s%s.%s", |
1473 | dbg, cgroup_on_dfl(cgrp) ? ss->name : ss->legacy_name, | 1473 | dbg, cgroup_on_dfl(cgrp) ? ss->name : ss->legacy_name, |
1474 | write_link_name ? cft->link_name : cft->name); | 1474 | cft->name); |
1475 | } else { | 1475 | } else { |
1476 | strscpy(buf, write_link_name ? cft->link_name : cft->name, | 1476 | strscpy(buf, cft->name, CGROUP_FILE_NAME_MAX); |
1477 | CGROUP_FILE_NAME_MAX); | ||
1478 | } | 1477 | } |
1479 | return buf; | 1478 | return buf; |
1480 | } | 1479 | } |
1481 | 1480 | ||
1482 | static char *cgroup_file_name(struct cgroup *cgrp, const struct cftype *cft, | ||
1483 | char *buf) | ||
1484 | { | ||
1485 | return cgroup_fill_name(cgrp, cft, buf, false); | ||
1486 | } | ||
1487 | |||
1488 | static char *cgroup_link_name(struct cgroup *cgrp, const struct cftype *cft, | ||
1489 | char *buf) | ||
1490 | { | ||
1491 | return cgroup_fill_name(cgrp, cft, buf, true); | ||
1492 | } | ||
1493 | |||
1494 | /** | 1481 | /** |
1495 | * cgroup_file_mode - deduce file mode of a control file | 1482 | * cgroup_file_mode - deduce file mode of a control file |
1496 | * @cft: the control file in question | 1483 | * @cft: the control file in question |
@@ -1649,9 +1636,6 @@ static void cgroup_rm_file(struct cgroup *cgrp, const struct cftype *cft) | |||
1649 | } | 1636 | } |
1650 | 1637 | ||
1651 | kernfs_remove_by_name(cgrp->kn, cgroup_file_name(cgrp, cft, name)); | 1638 | kernfs_remove_by_name(cgrp->kn, cgroup_file_name(cgrp, cft, name)); |
1652 | if (cft->flags & CFTYPE_SYMLINKED) | ||
1653 | kernfs_remove_by_name(cgrp->kn, | ||
1654 | cgroup_link_name(cgrp, cft, name)); | ||
1655 | } | 1639 | } |
1656 | 1640 | ||
1657 | /** | 1641 | /** |
@@ -3837,7 +3821,6 @@ static int cgroup_add_file(struct cgroup_subsys_state *css, struct cgroup *cgrp, | |||
3837 | { | 3821 | { |
3838 | char name[CGROUP_FILE_NAME_MAX]; | 3822 | char name[CGROUP_FILE_NAME_MAX]; |
3839 | struct kernfs_node *kn; | 3823 | struct kernfs_node *kn; |
3840 | struct kernfs_node *kn_link; | ||
3841 | struct lock_class_key *key = NULL; | 3824 | struct lock_class_key *key = NULL; |
3842 | int ret; | 3825 | int ret; |
3843 | 3826 | ||
@@ -3868,14 +3851,6 @@ static int cgroup_add_file(struct cgroup_subsys_state *css, struct cgroup *cgrp, | |||
3868 | spin_unlock_irq(&cgroup_file_kn_lock); | 3851 | spin_unlock_irq(&cgroup_file_kn_lock); |
3869 | } | 3852 | } |
3870 | 3853 | ||
3871 | if (cft->flags & CFTYPE_SYMLINKED) { | ||
3872 | kn_link = kernfs_create_link(cgrp->kn, | ||
3873 | cgroup_link_name(cgrp, cft, name), | ||
3874 | kn); | ||
3875 | if (IS_ERR(kn_link)) | ||
3876 | return PTR_ERR(kn_link); | ||
3877 | } | ||
3878 | |||
3879 | return 0; | 3854 | return 0; |
3880 | } | 3855 | } |
3881 | 3856 | ||