aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Jackson <pj@sgi.com>2005-10-30 18:02:31 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-10-30 20:37:21 -0500
commit18a19cb3047e454ee5ecbc35d7acf3f8e09e0466 (patch)
treead91d0024d886bdd207ba72e875e736e833de616
parent053199edf54f685e7dea765b60d4d5e9070dadec (diff)
[PATCH] cpusets: simple rename
Add support for renaming cpusets. Only allow simple rename of cpuset directories in place. Don't allow moving cpusets elsewhere in hierarchy or renaming the special cpuset files in each cpuset directory. The usefulness of this simple rename became apparent when developing task migration facilities. It allows building a second cpuset hierarchy using new names and containing new CPUs and Memory Nodes, moving tasks from the old to the new cpusets, removing the old cpusets, and then renaming the new cpusets to be just like the old names, so that any knowledge that the tasks had of their cpuset names will still be valid. Leaf node cpusets can be migrated to other CPUs or Memory Nodes by just updating their 'cpus' and 'mems' files, but because no cpuset can contain CPUs or Nodes not in its parent cpuset, one cannot do this in a cpuset hierarchy without first expanding all the non-leaf cpusets to contain the union of both the old and new CPUs and Nodes, which would obfuscate the one-to-one migration of a task from one cpuset to another required to correctly migrate the physical page frames currently allocated to that task. Signed-off-by: Paul Jackson <pj@sgi.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--kernel/cpuset.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 7491352276b2..6633f3fb6417 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -1113,6 +1113,21 @@ static int cpuset_file_release(struct inode *inode, struct file *file)
1113 return 0; 1113 return 0;
1114} 1114}
1115 1115
1116/*
1117 * cpuset_rename - Only allow simple rename of directories in place.
1118 */
1119static int cpuset_rename(struct inode *old_dir, struct dentry *old_dentry,
1120 struct inode *new_dir, struct dentry *new_dentry)
1121{
1122 if (!S_ISDIR(old_dentry->d_inode->i_mode))
1123 return -ENOTDIR;
1124 if (new_dentry->d_inode)
1125 return -EEXIST;
1126 if (old_dir != new_dir)
1127 return -EIO;
1128 return simple_rename(old_dir, old_dentry, new_dir, new_dentry);
1129}
1130
1116static struct file_operations cpuset_file_operations = { 1131static struct file_operations cpuset_file_operations = {
1117 .read = cpuset_file_read, 1132 .read = cpuset_file_read,
1118 .write = cpuset_file_write, 1133 .write = cpuset_file_write,
@@ -1125,6 +1140,7 @@ static struct inode_operations cpuset_dir_inode_operations = {
1125 .lookup = simple_lookup, 1140 .lookup = simple_lookup,
1126 .mkdir = cpuset_mkdir, 1141 .mkdir = cpuset_mkdir,
1127 .rmdir = cpuset_rmdir, 1142 .rmdir = cpuset_rmdir,
1143 .rename = cpuset_rename,
1128}; 1144};
1129 1145
1130static int cpuset_create_file(struct dentry *dentry, int mode) 1146static int cpuset_create_file(struct dentry *dentry, int mode)