Skip to content

Commit

Permalink
Merge branch 'writeback-for-next' of git://git.kernel.org/pub/scm/lin…
Browse files Browse the repository at this point in the history
…ux/kernel/git/wfg/linux

Pull writeback fixes from Fengguang Wu:
 "Three trivial writeback fixes"

* 'writeback-for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/wfg/linux:
  CPU hotplug, writeback: Don't call writeback_set_ratelimit() too often during hotplug
  writeback: correct comment for move_expired_inodes()
  backing-dev: use kstrto* in preference to simple_strtoul
  • Loading branch information
torvalds committed Oct 12, 2012
2 parents cbd8aca + 2f60d62 commit 4092475
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 28 deletions.
2 changes: 1 addition & 1 deletion fs/fs-writeback.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ static bool inode_dirtied_after(struct inode *inode, unsigned long t)
}

/*
* Move expired (dirtied after work->older_than_this) dirty inodes from
* Move expired (dirtied before work->older_than_this) dirty inodes from
* @delaying_queue to @dispatch_queue.
*/
static int move_expired_inodes(struct list_head *delaying_queue,
Expand Down
50 changes: 26 additions & 24 deletions mm/backing-dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,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))
Expand All @@ -187,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)
Expand All @@ -205,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)
Expand Down
14 changes: 11 additions & 3 deletions mm/page-writeback.c
Original file line number Diff line number Diff line change
Expand Up @@ -1602,10 +1602,18 @@ void writeback_set_ratelimit(void)
}

static int __cpuinit
ratelimit_handler(struct notifier_block *self, unsigned long u, void *v)
ratelimit_handler(struct notifier_block *self, unsigned long action,
void *hcpu)
{
writeback_set_ratelimit();
return NOTIFY_DONE;

switch (action & ~CPU_TASKS_FROZEN) {
case CPU_ONLINE:
case CPU_DEAD:
writeback_set_ratelimit();
return NOTIFY_OK;
default:
return NOTIFY_DONE;
}
}

static struct notifier_block __cpuinitdata ratelimit_nb = {
Expand Down

0 comments on commit 4092475

Please sign in to comment.