Commit b7fc5ad2 authored by Tejun Heo's avatar Tejun Heo

cgroup: remove cgroup->control_kn

Now that cgroup_subtree_control_write() has access to the associated
kernfs_open_file and thus the kernfs_node, there's no need to cache it
in cgroup->control_kn on creation.  Remove cgroup->control_kn and use
@of->kn directly.
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Acked-by: default avatarLi Zefan <lizefan@huawei.com>
parent acbef755
...@@ -177,7 +177,6 @@ struct cgroup { ...@@ -177,7 +177,6 @@ struct cgroup {
struct cgroup *parent; /* my parent */ struct cgroup *parent; /* my parent */
struct kernfs_node *kn; /* cgroup kernfs entry */ struct kernfs_node *kn; /* cgroup kernfs entry */
struct kernfs_node *control_kn; /* kn for "cgroup.subtree_control" */
struct kernfs_node *populated_kn; /* kn for "cgroup.subtree_populated" */ struct kernfs_node *populated_kn; /* kn for "cgroup.subtree_populated" */
/* /*
......
...@@ -2580,7 +2580,7 @@ static ssize_t cgroup_subtree_control_write(struct kernfs_open_file *of, ...@@ -2580,7 +2580,7 @@ static ssize_t cgroup_subtree_control_write(struct kernfs_open_file *of,
* active_ref protection. * active_ref protection.
*/ */
cgroup_get(cgrp); cgroup_get(cgrp);
kernfs_break_active_protection(cgrp->control_kn); kernfs_break_active_protection(of->kn);
mutex_lock(&cgroup_tree_mutex); mutex_lock(&cgroup_tree_mutex);
...@@ -2697,7 +2697,7 @@ static ssize_t cgroup_subtree_control_write(struct kernfs_open_file *of, ...@@ -2697,7 +2697,7 @@ static ssize_t cgroup_subtree_control_write(struct kernfs_open_file *of,
out_unlock_tree: out_unlock_tree:
mutex_unlock(&cgroup_tree_mutex); mutex_unlock(&cgroup_tree_mutex);
out_unbreak: out_unbreak:
kernfs_unbreak_active_protection(cgrp->control_kn); kernfs_unbreak_active_protection(of->kn);
cgroup_put(cgrp); cgroup_put(cgrp);
return ret ?: nbytes; return ret ?: nbytes;
...@@ -2887,9 +2887,7 @@ static int cgroup_add_file(struct cgroup *cgrp, struct cftype *cft) ...@@ -2887,9 +2887,7 @@ static int cgroup_add_file(struct cgroup *cgrp, struct cftype *cft)
return ret; return ret;
} }
if (cft->seq_show == cgroup_subtree_control_show) if (cft->seq_show == cgroup_populated_show)
cgrp->control_kn = kn;
else if (cft->seq_show == cgroup_populated_show)
cgrp->populated_kn = kn; cgrp->populated_kn = kn;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment