diff options
author | Tejun Heo <tj@kernel.org> | 2013-06-28 19:24:10 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2013-07-12 15:34:01 -0400 |
commit | 8f89140ae41ccd9c63344e6823faa862aa7435e3 (patch) | |
tree | 319446c51b515bd3f6bc9e22e6de8841a4b5f4cb | |
parent | 9903883f1dd6e86f286b7bfa6e4b423f98c1cd9e (diff) |
cgroup: minor updates around cgroup_clear_directory()
* Rename it to cgroup_clear_dir() and make it take the pointer to the
target cgroup instead of the the dentry. This makes the function
consistent with its counterpart - cgroup_populate_dir().
* Move cgroup_clear_directory() invocation from cgroup_d_remove_dir()
to cgroup_remount() so that the function doesn't have to determine
the cgroup pointer back from the dentry. cgroup_d_remove_dir() now
only deals with vfs, which is slightly cleaner.
This patch doesn't introduce any functional differences.
Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Li Zefan <lizefan@huawei.com>
-rw-r--r-- | kernel/cgroup.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index e5583d10a325..09bfa870e698 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -957,15 +957,14 @@ static void cgroup_rm_file(struct cgroup *cgrp, const struct cftype *cft) | |||
957 | } | 957 | } |
958 | 958 | ||
959 | /** | 959 | /** |
960 | * cgroup_clear_directory - selective removal of base and subsystem files | 960 | * cgroup_clear_dir - selective removal of base and subsystem files |
961 | * @dir: directory containing the files | 961 | * @cgrp: target cgroup |
962 | * @base_files: true if the base files should be removed | 962 | * @base_files: true if the base files should be removed |
963 | * @subsys_mask: mask of the subsystem ids whose files should be removed | 963 | * @subsys_mask: mask of the subsystem ids whose files should be removed |
964 | */ | 964 | */ |
965 | static void cgroup_clear_directory(struct dentry *dir, bool base_files, | 965 | static void cgroup_clear_dir(struct cgroup *cgrp, bool base_files, |
966 | unsigned long subsys_mask) | 966 | unsigned long subsys_mask) |
967 | { | 967 | { |
968 | struct cgroup *cgrp = __d_cgrp(dir); | ||
969 | struct cgroup_subsys *ss; | 968 | struct cgroup_subsys *ss; |
970 | 969 | ||
971 | for_each_root_subsys(cgrp->root, ss) { | 970 | for_each_root_subsys(cgrp->root, ss) { |
@@ -987,9 +986,6 @@ static void cgroup_clear_directory(struct dentry *dir, bool base_files, | |||
987 | static void cgroup_d_remove_dir(struct dentry *dentry) | 986 | static void cgroup_d_remove_dir(struct dentry *dentry) |
988 | { | 987 | { |
989 | struct dentry *parent; | 988 | struct dentry *parent; |
990 | struct cgroupfs_root *root = dentry->d_sb->s_fs_info; | ||
991 | |||
992 | cgroup_clear_directory(dentry, true, root->subsys_mask); | ||
993 | 989 | ||
994 | parent = dentry->d_parent; | 990 | parent = dentry->d_parent; |
995 | spin_lock(&parent->d_lock); | 991 | spin_lock(&parent->d_lock); |
@@ -1376,7 +1372,7 @@ static int cgroup_remount(struct super_block *sb, int *flags, char *data) | |||
1376 | * this before rebind_subsystems, since rebind_subsystems may | 1372 | * this before rebind_subsystems, since rebind_subsystems may |
1377 | * change this hierarchy's subsys_list. | 1373 | * change this hierarchy's subsys_list. |
1378 | */ | 1374 | */ |
1379 | cgroup_clear_directory(cgrp->dentry, false, removed_mask); | 1375 | cgroup_clear_dir(cgrp, false, removed_mask); |
1380 | 1376 | ||
1381 | ret = rebind_subsystems(root, added_mask, removed_mask); | 1377 | ret = rebind_subsystems(root, added_mask, removed_mask); |
1382 | if (ret) { | 1378 | if (ret) { |
@@ -4541,9 +4537,10 @@ static int cgroup_destroy_locked(struct cgroup *cgrp) | |||
4541 | raw_spin_unlock(&release_list_lock); | 4537 | raw_spin_unlock(&release_list_lock); |
4542 | 4538 | ||
4543 | /* | 4539 | /* |
4544 | * Remove @cgrp directory. The removal puts the base ref but we | 4540 | * Clear and remove @cgrp directory. The removal puts the base ref |
4545 | * aren't quite done with @cgrp yet, so hold onto it. | 4541 | * but we aren't quite done with @cgrp yet, so hold onto it. |
4546 | */ | 4542 | */ |
4543 | cgroup_clear_dir(cgrp, true, cgrp->root->subsys_mask); | ||
4547 | dget(d); | 4544 | dget(d); |
4548 | cgroup_d_remove_dir(d); | 4545 | cgroup_d_remove_dir(d); |
4549 | 4546 | ||