Skip to content

Commit

Permalink
cgroup/bfq: revert bfq.weight symlink change
Browse files Browse the repository at this point in the history
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 54b7b86 and 19e9da9 for 5.2, and this
can be done properly for 5.3.

Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
axboe committed Jun 10, 2019
1 parent d1fdb6d commit cf89298
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 36 deletions.
6 changes: 2 additions & 4 deletions block/bfq-cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -1046,8 +1046,7 @@ struct blkcg_policy blkcg_policy_bfq = {
struct cftype bfq_blkcg_legacy_files[] = {
{
.name = "bfq.weight",
.link_name = "weight",
.flags = CFTYPE_NOT_ON_ROOT | CFTYPE_SYMLINKED,
.flags = CFTYPE_NOT_ON_ROOT,
.seq_show = bfq_io_show_weight,
.write_u64 = bfq_io_set_weight_legacy,
},
Expand Down Expand Up @@ -1167,8 +1166,7 @@ struct cftype bfq_blkcg_legacy_files[] = {
struct cftype bfq_blkg_files[] = {
{
.name = "bfq.weight",
.link_name = "weight",
.flags = CFTYPE_NOT_ON_ROOT | CFTYPE_SYMLINKED,
.flags = CFTYPE_NOT_ON_ROOT,
.seq_show = bfq_io_show_weight,
.write = bfq_io_set_weight,
},
Expand Down
3 changes: 0 additions & 3 deletions include/linux/cgroup-defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,6 @@ enum {
CFTYPE_WORLD_WRITABLE = (1 << 4), /* (DON'T USE FOR NEW FILES) S_IWUGO */
CFTYPE_DEBUG = (1 << 5), /* create when cgroup_debug */

CFTYPE_SYMLINKED = (1 << 6), /* pointed to by symlink too */

/* internal flags, do not use outside cgroup core proper */
__CFTYPE_ONLY_ON_DFL = (1 << 16), /* only on default hierarchy */
__CFTYPE_NOT_ON_DFL = (1 << 17), /* not on default hierarchy */
Expand Down Expand Up @@ -545,7 +543,6 @@ struct cftype {
* end of cftype array.
*/
char name[MAX_CFTYPE_NAME];
char link_name[MAX_CFTYPE_NAME];
unsigned long private;

/*
Expand Down
33 changes: 4 additions & 29 deletions kernel/cgroup/cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -1460,8 +1460,8 @@ struct cgroup *task_cgroup_from_root(struct task_struct *task,

static struct kernfs_syscall_ops cgroup_kf_syscall_ops;

static char *cgroup_fill_name(struct cgroup *cgrp, const struct cftype *cft,
char *buf, bool write_link_name)
static char *cgroup_file_name(struct cgroup *cgrp, const struct cftype *cft,
char *buf)
{
struct cgroup_subsys *ss = cft->ss;

Expand All @@ -1471,26 +1471,13 @@ static char *cgroup_fill_name(struct cgroup *cgrp, const struct cftype *cft,

snprintf(buf, CGROUP_FILE_NAME_MAX, "%s%s.%s",
dbg, cgroup_on_dfl(cgrp) ? ss->name : ss->legacy_name,
write_link_name ? cft->link_name : cft->name);
cft->name);
} else {
strscpy(buf, write_link_name ? cft->link_name : cft->name,
CGROUP_FILE_NAME_MAX);
strscpy(buf, cft->name, CGROUP_FILE_NAME_MAX);
}
return buf;
}

static char *cgroup_file_name(struct cgroup *cgrp, const struct cftype *cft,
char *buf)
{
return cgroup_fill_name(cgrp, cft, buf, false);
}

static char *cgroup_link_name(struct cgroup *cgrp, const struct cftype *cft,
char *buf)
{
return cgroup_fill_name(cgrp, cft, buf, true);
}

/**
* cgroup_file_mode - deduce file mode of a control file
* @cft: the control file in question
Expand Down Expand Up @@ -1649,9 +1636,6 @@ static void cgroup_rm_file(struct cgroup *cgrp, const struct cftype *cft)
}

kernfs_remove_by_name(cgrp->kn, cgroup_file_name(cgrp, cft, name));
if (cft->flags & CFTYPE_SYMLINKED)
kernfs_remove_by_name(cgrp->kn,
cgroup_link_name(cgrp, cft, name));
}

/**
Expand Down Expand Up @@ -3837,7 +3821,6 @@ static int cgroup_add_file(struct cgroup_subsys_state *css, struct cgroup *cgrp,
{
char name[CGROUP_FILE_NAME_MAX];
struct kernfs_node *kn;
struct kernfs_node *kn_link;
struct lock_class_key *key = NULL;
int ret;

Expand Down Expand Up @@ -3868,14 +3851,6 @@ static int cgroup_add_file(struct cgroup_subsys_state *css, struct cgroup *cgrp,
spin_unlock_irq(&cgroup_file_kn_lock);
}

if (cft->flags & CFTYPE_SYMLINKED) {
kn_link = kernfs_create_link(cgrp->kn,
cgroup_link_name(cgrp, cft, name),
kn);
if (IS_ERR(kn_link))
return PTR_ERR(kn_link);
}

return 0;
}

Expand Down

0 comments on commit cf89298

Please sign in to comment.