]> Pileus Git - ~andy/linux/blobdiff - mm/backing-dev.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal
[~andy/linux] / mm / backing-dev.c
index 6b4718e2ee341d7fd7f068d83e31da014d1a5ef0..d3ca2b3ee17657f8045c4dca291721ac6c38c9be 100644 (file)
@@ -39,12 +39,6 @@ DEFINE_SPINLOCK(bdi_lock);
 LIST_HEAD(bdi_list);
 LIST_HEAD(bdi_pending_list);
 
-static struct task_struct *sync_supers_tsk;
-static struct timer_list sync_supers_timer;
-
-static int bdi_sync_supers(void *);
-static void sync_supers_timer_fn(unsigned long);
-
 void bdi_lock_two(struct bdi_writeback *wb1, struct bdi_writeback *wb2)
 {
        if (wb1 < wb2) {
@@ -164,16 +158,16 @@ static ssize_t read_ahead_kb_store(struct device *dev,
                                  const char *buf, size_t count)
 {
        struct backing_dev_info *bdi = dev_get_drvdata(dev);
-       char *end;
        unsigned long read_ahead_kb;
-       ssize_t ret = -EINVAL;
+       ssize_t ret;
 
-       read_ahead_kb = simple_strtoul(buf, &end, 10);
-       if (*buf && (end[0] == '\0' || (end[0] == '\n' && end[1] == '\0'))) {
-               bdi->ra_pages = read_ahead_kb >> (PAGE_SHIFT - 10);
-               ret = count;
-       }
-       return ret;
+       ret = kstrtoul(buf, 10, &read_ahead_kb);
+       if (ret < 0)
+               return ret;
+
+       bdi->ra_pages = read_ahead_kb >> (PAGE_SHIFT - 10);
+
+       return count;
 }
 
 #define K(pages) ((pages) << (PAGE_SHIFT - 10))
@@ -193,16 +187,17 @@ static ssize_t min_ratio_store(struct device *dev,
                struct device_attribute *attr, const char *buf, size_t count)
 {
        struct backing_dev_info *bdi = dev_get_drvdata(dev);
-       char *end;
        unsigned int ratio;
-       ssize_t ret = -EINVAL;
+       ssize_t ret;
+
+       ret = kstrtouint(buf, 10, &ratio);
+       if (ret < 0)
+               return ret;
+
+       ret = bdi_set_min_ratio(bdi, ratio);
+       if (!ret)
+               ret = count;
 
-       ratio = simple_strtoul(buf, &end, 10);
-       if (*buf && (end[0] == '\0' || (end[0] == '\n' && end[1] == '\0'))) {
-               ret = bdi_set_min_ratio(bdi, ratio);
-               if (!ret)
-                       ret = count;
-       }
        return ret;
 }
 BDI_SHOW(min_ratio, bdi->min_ratio)
@@ -211,16 +206,17 @@ static ssize_t max_ratio_store(struct device *dev,
                struct device_attribute *attr, const char *buf, size_t count)
 {
        struct backing_dev_info *bdi = dev_get_drvdata(dev);
-       char *end;
        unsigned int ratio;
-       ssize_t ret = -EINVAL;
+       ssize_t ret;
+
+       ret = kstrtouint(buf, 10, &ratio);
+       if (ret < 0)
+               return ret;
+
+       ret = bdi_set_max_ratio(bdi, ratio);
+       if (!ret)
+               ret = count;
 
-       ratio = simple_strtoul(buf, &end, 10);
-       if (*buf && (end[0] == '\0' || (end[0] == '\n' && end[1] == '\0'))) {
-               ret = bdi_set_max_ratio(bdi, ratio);
-               if (!ret)
-                       ret = count;
-       }
        return ret;
 }
 BDI_SHOW(max_ratio, bdi->max_ratio)
@@ -250,12 +246,6 @@ static int __init default_bdi_init(void)
 {
        int err;
 
-       sync_supers_tsk = kthread_run(bdi_sync_supers, NULL, "sync_supers");
-       BUG_ON(IS_ERR(sync_supers_tsk));
-
-       setup_timer(&sync_supers_timer, sync_supers_timer_fn, 0);
-       bdi_arm_supers_timer();
-
        err = bdi_init(&default_backing_dev_info);
        if (!err)
                bdi_register(&default_backing_dev_info, NULL, "default");
@@ -270,46 +260,6 @@ int bdi_has_dirty_io(struct backing_dev_info *bdi)
        return wb_has_dirty_io(&bdi->wb);
 }
 
-/*
- * kupdated() used to do this. We cannot do it from the bdi_forker_thread()
- * or we risk deadlocking on ->s_umount. The longer term solution would be
- * to implement sync_supers_bdi() or similar and simply do it from the
- * bdi writeback thread individually.
- */
-static int bdi_sync_supers(void *unused)
-{
-       set_user_nice(current, 0);
-
-       while (!kthread_should_stop()) {
-               set_current_state(TASK_INTERRUPTIBLE);
-               schedule();
-
-               /*
-                * Do this periodically, like kupdated() did before.
-                */
-               sync_supers();
-       }
-
-       return 0;
-}
-
-void bdi_arm_supers_timer(void)
-{
-       unsigned long next;
-
-       if (!dirty_writeback_interval)
-               return;
-
-       next = msecs_to_jiffies(dirty_writeback_interval * 10) + jiffies;
-       mod_timer(&sync_supers_timer, round_jiffies_up(next));
-}
-
-static void sync_supers_timer_fn(unsigned long unused)
-{
-       wake_up_process(sync_supers_tsk);
-       bdi_arm_supers_timer();
-}
-
 static void wakeup_timer_fn(unsigned long data)
 {
        struct backing_dev_info *bdi = (struct backing_dev_info *)data;