All of lore.kernel.org
 help / color / mirror / Atom feed
From: Juergen Quade <quade@hsnr.de>
To: torvalds@osdl.org, axboe@suse.de
Cc: linux-kernel@vger.kernel.org
Subject: PATCH for a little bug in deadline-iosched.c
Date: Tue, 28 Dec 2004 16:56:57 +0100	[thread overview]
Message-ID: <20041228155657.GA372@hsnr.de> (raw)

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...

                Juergen.

P.S.: Does it really make sense to allow a negative "writes_starved"?

==========================================================================
Signed-off-by: Juergen Quade <quade@hsnr.de>

--- linux-2.6.10/drivers/block/deadline-iosched.c.org	2004-12-28 16:19:46.000000000 +0100
+++ linux-2.6.10/drivers/block/deadline-iosched.c	2004-12-28 16:36:59.000000000 +0100
@@ -791,24 +791,24 @@
 };
 
 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 = (int)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 @@
 #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);						\

                 reply	other threads:[~2004-12-28 15:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041228155657.GA372@hsnr.de \
    --to=quade@hsnr.de \
    --cc=axboe@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.