提交 18a19cb3 编写于 作者: P Paul Jackson 提交者: Linus Torvalds

[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: NPaul Jackson <pj@sgi.com>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 053199ed
...@@ -1113,6 +1113,21 @@ static int cpuset_file_release(struct inode *inode, struct file *file) ...@@ -1113,6 +1113,21 @@ static int cpuset_file_release(struct inode *inode, struct file *file)
return 0; return 0;
} }
/*
* cpuset_rename - Only allow simple rename of directories in place.
*/
static int cpuset_rename(struct inode *old_dir, struct dentry *old_dentry,
struct inode *new_dir, struct dentry *new_dentry)
{
if (!S_ISDIR(old_dentry->d_inode->i_mode))
return -ENOTDIR;
if (new_dentry->d_inode)
return -EEXIST;
if (old_dir != new_dir)
return -EIO;
return simple_rename(old_dir, old_dentry, new_dir, new_dentry);
}
static struct file_operations cpuset_file_operations = { static struct file_operations cpuset_file_operations = {
.read = cpuset_file_read, .read = cpuset_file_read,
.write = cpuset_file_write, .write = cpuset_file_write,
...@@ -1125,6 +1140,7 @@ static struct inode_operations cpuset_dir_inode_operations = { ...@@ -1125,6 +1140,7 @@ static struct inode_operations cpuset_dir_inode_operations = {
.lookup = simple_lookup, .lookup = simple_lookup,
.mkdir = cpuset_mkdir, .mkdir = cpuset_mkdir,
.rmdir = cpuset_rmdir, .rmdir = cpuset_rmdir,
.rename = cpuset_rename,
}; };
static int cpuset_create_file(struct dentry *dentry, int mode) static int cpuset_create_file(struct dentry *dentry, int mode)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册