Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/shaggy...
[pandora-kernel.git] / kernel / cpuset.c
index 9d850ae..2c3b443 100644 (file)
@@ -413,8 +413,8 @@ static struct file_system_type cpuset_fs_type = {
  *
  *
  * When reading/writing to a file:
- *     - the cpuset to use in file->f_dentry->d_parent->d_fsdata
- *     - the 'cftype' of the file is file->f_dentry->d_fsdata
+ *     - the cpuset to use in file->f_path.dentry->d_parent->d_fsdata
+ *     - the 'cftype' of the file is file->f_path.dentry->d_fsdata
  */
 
 struct cftype {
@@ -729,9 +729,11 @@ static int validate_change(const struct cpuset *cur, const struct cpuset *trial)
        }
 
        /* Remaining checks don't apply to root cpuset */
-       if ((par = cur->parent) == NULL)
+       if (cur == &top_cpuset)
                return 0;
 
+       par = cur->parent;
+
        /* We must be a subset of our parent cpuset */
        if (!is_cpuset_subset(trial, par))
                return -EACCES;
@@ -1060,10 +1062,7 @@ static int update_flag(cpuset_flagbits_t bit, struct cpuset *cs, char *buf)
        cpu_exclusive_changed =
                (is_cpu_exclusive(cs) != is_cpu_exclusive(&trialcs));
        mutex_lock(&callback_mutex);
-       if (turning_on)
-               set_bit(bit, &cs->flags);
-       else
-               clear_bit(bit, &cs->flags);
+       cs->flags = trialcs.flags;
        mutex_unlock(&callback_mutex);
 
        if (cpu_exclusive_changed)
@@ -1281,18 +1280,19 @@ typedef enum {
        FILE_TASKLIST,
 } cpuset_filetype_t;
 
-static ssize_t cpuset_common_file_write(struct file *file, const char __user *userbuf,
+static ssize_t cpuset_common_file_write(struct file *file,
+                                       const char __user *userbuf,
                                        size_t nbytes, loff_t *unused_ppos)
 {
-       struct cpuset *cs = __d_cs(file->f_dentry->d_parent);
-       struct cftype *cft = __d_cft(file->f_dentry);
+       struct cpuset *cs = __d_cs(file->f_path.dentry->d_parent);
+       struct cftype *cft = __d_cft(file->f_path.dentry);
        cpuset_filetype_t type = cft->private;
        char *buffer;
        char *pathbuf = NULL;
        int retval = 0;
 
        /* Crude upper limit on largest legitimate cpulist user might write. */
-       if (nbytes > 100 + 6 * NR_CPUS)
+       if (nbytes > 100 + 6 * max(NR_CPUS, MAX_NUMNODES))
                return -E2BIG;
 
        /* +1 for nul-terminator */
@@ -1367,7 +1367,7 @@ static ssize_t cpuset_file_write(struct file *file, const char __user *buf,
                                                size_t nbytes, loff_t *ppos)
 {
        ssize_t retval = 0;
-       struct cftype *cft = __d_cft(file->f_dentry);
+       struct cftype *cft = __d_cft(file->f_path.dentry);
        if (!cft)
                return -ENODEV;
 
@@ -1417,8 +1417,8 @@ static int cpuset_sprintf_memlist(char *page, struct cpuset *cs)
 static ssize_t cpuset_common_file_read(struct file *file, char __user *buf,
                                size_t nbytes, loff_t *ppos)
 {
-       struct cftype *cft = __d_cft(file->f_dentry);
-       struct cpuset *cs = __d_cs(file->f_dentry->d_parent);
+       struct cftype *cft = __d_cft(file->f_path.dentry);
+       struct cpuset *cs = __d_cs(file->f_path.dentry->d_parent);
        cpuset_filetype_t type = cft->private;
        char *page;
        ssize_t retval = 0;
@@ -1476,7 +1476,7 @@ static ssize_t cpuset_file_read(struct file *file, char __user *buf, size_t nbyt
                                                                loff_t *ppos)
 {
        ssize_t retval = 0;
-       struct cftype *cft = __d_cft(file->f_dentry);
+       struct cftype *cft = __d_cft(file->f_path.dentry);
        if (!cft)
                return -ENODEV;
 
@@ -1498,7 +1498,7 @@ static int cpuset_file_open(struct inode *inode, struct file *file)
        if (err)
                return err;
 
-       cft = __d_cft(file->f_dentry);
+       cft = __d_cft(file->f_path.dentry);
        if (!cft)
                return -ENODEV;
        if (cft->open)
@@ -1511,7 +1511,7 @@ static int cpuset_file_open(struct inode *inode, struct file *file)
 
 static int cpuset_file_release(struct inode *inode, struct file *file)
 {
-       struct cftype *cft = __d_cft(file->f_dentry);
+       struct cftype *cft = __d_cft(file->f_path.dentry);
        if (cft->release)
                return cft->release(inode, file);
        return 0;
@@ -1532,7 +1532,7 @@ static int cpuset_rename(struct inode *old_dir, struct dentry *old_dentry,
        return simple_rename(old_dir, old_dentry, new_dir, new_dentry);
 }
 
-static struct file_operations cpuset_file_operations = {
+static const struct file_operations cpuset_file_operations = {
        .read = cpuset_file_read,
        .write = cpuset_file_write,
        .llseek = generic_file_llseek,
@@ -1700,7 +1700,7 @@ static int pid_array_to_buf(char *buf, int sz, pid_t *a, int npids)
  */
 static int cpuset_tasks_open(struct inode *unused, struct file *file)
 {
-       struct cpuset *cs = __d_cs(file->f_dentry->d_parent);
+       struct cpuset *cs = __d_cs(file->f_path.dentry->d_parent);
        struct ctr_struct *ctr;
        pid_t *pidarray;
        int npids;
@@ -2045,7 +2045,6 @@ out:
        return err;
 }
 
-#if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_MEMORY_HOTPLUG)
 /*
  * If common_cpu_mem_hotplug_unplug(), below, unplugs any CPUs
  * or memory nodes, we need to walk over the cpuset hierarchy,
@@ -2109,9 +2108,7 @@ static void common_cpu_mem_hotplug_unplug(void)
        mutex_unlock(&callback_mutex);
        mutex_unlock(&manage_mutex);
 }
-#endif
 
-#ifdef CONFIG_HOTPLUG_CPU
 /*
  * The top_cpuset tracks what CPUs and Memory Nodes are online,
  * period.  This is necessary in order to make cpusets transparent
@@ -2128,7 +2125,6 @@ static int cpuset_handle_cpuhp(struct notifier_block *nb,
        common_cpu_mem_hotplug_unplug();
        return 0;
 }
-#endif
 
 #ifdef CONFIG_MEMORY_HOTPLUG
 /*
@@ -2137,7 +2133,7 @@ static int cpuset_handle_cpuhp(struct notifier_block *nb,
  * See also the previous routine cpuset_handle_cpuhp().
  */
 
-void cpuset_track_online_nodes()
+void cpuset_track_online_nodes(void)
 {
        common_cpu_mem_hotplug_unplug();
 }
@@ -2610,7 +2606,7 @@ static int cpuset_open(struct inode *inode, struct file *file)
        return single_open(file, proc_cpuset_show, pid);
 }
 
-struct file_operations proc_cpuset_operations = {
+const struct file_operations proc_cpuset_operations = {
        .open           = cpuset_open,
        .read           = seq_read,
        .llseek         = seq_lseek,