Commit cd3ae7b3 authored by Jürgen Quade's avatar Jürgen Quade Committed by Linus Torvalds

[PATCH] signedness fix in deadline-iosched.c

There is some (obvious) mess with "unsigned int" and "int" in the
deadline-io-scheduler (sysfs-section).  Try to change the attribute
"writes_starved":

	root@ezs-mobil:/sys/block/hda/queue# cat scheduler
	noop anticipatory [deadline]
	root@ezs-mobil:/sys/block/hda/queue# cd iosched/
	root@ezs-mobil:/sys/block/hda/queue/iosched# ls
	fifo_batch  front_merges  read_expire  write_expire  writes_starved
	root@ezs-mobil:/sys/block/hda/queue/iosched# cat writes_starved
	2
	root@ezs-mobil:/sys/block/hda/queue/iosched# echo 4 >writes_starved
	root@ezs-mobil:/sys/block/hda/queue/iosched# cat writes_starved
	-2147483648
	root@ezs-mobil:/sys/block/hda/queue/iosched#

Because all attribute-variables are defined as "int", the patch
below changes them to "int". Now it works as expected...
Signed-off-by: default avatarJuergen Quade <quade@hsnr.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 9db4a6ed
......@@ -791,24 +791,24 @@ struct deadline_fs_entry {
};
static ssize_t
deadline_var_show(unsigned int var, char *page)
deadline_var_show(int var, char *page)
{
return sprintf(page, "%d\n", var);
}
static ssize_t
deadline_var_store(unsigned int *var, const char *page, size_t count)
deadline_var_store(int *var, const char *page, size_t count)
{
char *p = (char *) page;
*var = simple_strtoul(p, &p, 10);
*var = simple_strtol(p, &p, 10);
return count;
}
#define SHOW_FUNCTION(__FUNC, __VAR, __CONV) \
static ssize_t __FUNC(struct deadline_data *dd, char *page) \
{ \
unsigned int __data = __VAR; \
int __data = __VAR; \
if (__CONV) \
__data = jiffies_to_msecs(__data); \
return deadline_var_show(__data, (page)); \
......@@ -823,7 +823,7 @@ SHOW_FUNCTION(deadline_fifobatch_show, dd->fifo_batch, 0);
#define STORE_FUNCTION(__FUNC, __PTR, MIN, MAX, __CONV) \
static ssize_t __FUNC(struct deadline_data *dd, const char *page, size_t count) \
{ \
unsigned int __data; \
int __data; \
int ret = deadline_var_store(&__data, (page), count); \
if (__data < (MIN)) \
__data = (MIN); \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment