From: Miklos Szeredi <mszeredi@suse.cz>
This managed to completely evade testing :(
Fix return value to be count or -errno. Also bring the function in
line with the other store functions on this object, which have more
strict input checking.
Also fix bdi_set_max_ratio() to actually return an error, instead of
always zero.
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
---
Index: linux/mm/backing-dev.c
===================================================================
--- linux.orig/mm/backing-dev.c 2008-02-02 23:21:50.000000000 +0100
+++ linux/mm/backing-dev.c 2008-02-02 23:26:01.000000000 +0100
@@ -16,10 +16,15 @@ static ssize_t read_ahead_kb_store(struc
{
struct backing_dev_info *bdi = dev_get_drvdata(dev);
char *end;
+ unsigned long read_ahead_kb;
+ ssize_t ret = -EINVAL;
- bdi->ra_pages = simple_strtoul(buf, &end, 10) >> (PAGE_SHIFT - 10);
-
- return end - buf;
+ 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;
}
#define K(pages) ((pages) << (PAGE_SHIFT - 10))
Index: linux/mm/page-writeback.c
===================================================================
--- linux.orig/mm/page-writeback.c 2008-02-02 20:51:26.000000000 +0100
+++ linux/mm/page-writeback.c 2008-02-02 23:26:15.000000000 +0100
@@ -288,7 +288,7 @@ int bdi_set_max_ratio(struct backing_dev
}
spin_unlock_irqrestore(&bdi_lock, flags);
- return 0;
+ return ret;
}
EXPORT_SYMBOL(bdi_set_max_ratio);
--
--
| Greg Kroah-Hartman | [PATCH 005/196] Chinese: add translation of SubmittingDrivers |
| Nick Piggin | [patch] my mmu notifier sample driver |
| Sean | Re: [AppArmor 39/45] AppArmor: Profile loading and manipulation, pathname matching |
| Arjan van de Ven | [Patch v2] Make PCI extended config space (MMCONFIG) a driver opt-in |
git: | |
| Antonio Almeida | HTB accuracy for high speed |
| Gerrit Renker | [PATCH 0/37] dccp: Feature negotiation - last call for comments |
| Jens Axboe | Re: [BUG] New Kernel Bugs |
| Jarek Poplawski | [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
