
From: Nick Piggin <piggin@cyberone.com.au>

Following patch converts sysfs input and output to ms for all HZ.



 drivers/block/as-iosched.c |   30 +++++++++++++++++++-----------
 1 files changed, 19 insertions(+), 11 deletions(-)

diff -puN drivers/block/as-iosched.c~as-HZ drivers/block/as-iosched.c
--- 25/drivers/block/as-iosched.c~as-HZ	2003-06-11 19:49:19.000000000 -0700
+++ 25-akpm/drivers/block/as-iosched.c	2003-06-11 19:49:19.000000000 -0700
@@ -32,19 +32,19 @@
 /*
  * max time before a read is submitted.
  */
-static unsigned long read_expire = HZ / 20;
+#define default_read_expire (HZ / 20)
 
 /*
  * ditto for writes, these limits are not hard, even
  * if the disk is capable of satisfying them.
  */
-static unsigned long write_expire = HZ / 5;
+#define default_write_expire (HZ / 5)
 
 /*
  * read_batch_expire describes how long we will allow a stream of reads to
  * persist before looking to see whether it is time to switch over to writes.
  */
-static unsigned long read_batch_expire = HZ / 5;
+#define default_read_batch_expire (HZ / 5)
 
 /*
  * write_batch_expire describes how long we want a stream of writes to run for.
@@ -52,12 +52,12 @@ static unsigned long read_batch_expire =
  * See, the problem is: we can send a lot of writes to disk cache / TCQ in
  * a short amount of time...
  */
-static unsigned long write_batch_expire = HZ / 20;
+#define default_write_batch_expire (HZ / 20)
 
 /*
  * max time we may wait to anticipate a read (default around 6ms)
  */
-static unsigned long antic_expire = ((HZ / 150) ? HZ / 150 : 1);
+#define default_antic_expire ((HZ / 150) ? HZ / 150 : 1)
 
 /*
  * This is the per-process anticipatory I/O scheduler state.  It is refcounted
@@ -1679,12 +1679,12 @@ static int as_init(request_queue_t *q, e
 	ad->sort_list[REQ_SYNC] = RB_ROOT;
 	ad->sort_list[REQ_ASYNC] = RB_ROOT;
 	ad->dispatch = &q->queue_head;
-	ad->fifo_expire[REQ_SYNC] = read_expire;
-	ad->fifo_expire[REQ_ASYNC] = write_expire;
+	ad->fifo_expire[REQ_SYNC] = default_read_expire;
+	ad->fifo_expire[REQ_ASYNC] = default_write_expire;
 	ad->hash_valid_count = 1;
-	ad->antic_expire = antic_expire;
-	ad->batch_expire[REQ_SYNC] = read_batch_expire;
-	ad->batch_expire[REQ_ASYNC] = write_batch_expire;
+	ad->antic_expire = default_antic_expire;
+	ad->batch_expire[REQ_SYNC] = default_read_batch_expire;
+	ad->batch_expire[REQ_ASYNC] = default_write_batch_expire;
 	e->elevator_data = ad;
 
 	ad->current_batch_expires = jiffies + ad->batch_expire[REQ_SYNC];
@@ -1706,15 +1706,23 @@ struct as_fs_entry {
 static ssize_t
 as_var_show(unsigned int var, char *page)
 {
+	var = (var * 1000) / HZ;
 	return sprintf(page, "%d\n", var);
 }
 
 static ssize_t
 as_var_store(unsigned long *var, const char *page, size_t count)
 {
+	unsigned long tmp;
 	char *p = (char *) page;
 
-	*var = simple_strtoul(p, &p, 10);
+	tmp = simple_strtoul(p, &p, 10);
+	if (tmp != 0) {
+		tmp = (tmp * HZ) / 1000;
+		if (tmp == 0)
+			tmp = 1;
+	}
+	*var = tmp;
 	return count;
 }
 

_
