Skip to contentSkip to conversation

block: jiffies fixes

PATCH In review Randy Dunlap 2 participants 2 messages Nov 11, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block: jiffies fixes

From: Randy Dunlap <[email protected]>

Use HZ-independent calculation of milliseconds. Add jiffies.h where it was missing since functions or macros from it are used.

Oh, where has as-iosched.c in linux-next?

---
 block/as-iosched.c   |    3 ++-
 block/blk-settings.c |    3 ++-
 block/bsg.c          |    3 ++-
 block/cfq-iosched.c  |    1 +
 4 files changed, 7 insertions(+), 3 deletions(-)
block/blk-settings.c +2 -1
@@ -8,6 +8,7 @@
 #include <linux/blkdev.h>
 #include <linux/bootmem.h>	/* for max_pfn/max_low_pfn */
 #include <linux/gcd.h>
+#include <linux/jiffies.h>
 
 #include "blk.h"
 
@@ -141,7 +142,7 @@ void blk_queue_make_request(struct reque
 	q->nr_batching = BLK_BATCH_REQ;
 
 	q->unplug_thresh = 4;		/* hmm */
-	q->unplug_delay = (3 * HZ) / 1000;	/* 3 milliseconds */
+	q->unplug_delay = msecs_to_jiffies(3);	/* 3 milliseconds */
 	if (q->unplug_delay == 0)
 		q->unplug_delay = 1;
 
block/bsg.c +2 -1
@@ -15,6 +15,7 @@
 #include <linux/blkdev.h>
 #include <linux/poll.h>
 #include <linux/cdev.h>
+#include <linux/jiffies.h>
 #include <linux/percpu.h>
 #include <linux/uio.h>
 #include <linux/idr.h>
@@ -197,7 +198,7 @@ static int blk_fill_sgv4_hdr_rq(struct r
 	rq->cmd_len = hdr->request_len;
 	rq->cmd_type = REQ_TYPE_BLOCK_PC;
 
-	rq->timeout = (hdr->timeout * HZ) / 1000;
+	rq->timeout = msecs_to_jiffies(hdr->timeout);
 	if (!rq->timeout)
 		rq->timeout = q->sg_timeout;
 	if (!rq->timeout)
block/as-iosched.c +2 -1
@@ -10,6 +10,7 @@
 #include <linux/blkdev.h>
 #include <linux/elevator.h>
 #include <linux/bio.h>
+#include <linux/jiffies.h>
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/init.h>
@@ -600,7 +601,7 @@ static int as_close_req(struct as_data *
 
 	if (delay == 0)
 		delta = 8192;
-	else if (delay <= (20 * HZ / 1000) && delay <= ad->antic_expire)
+	else if (delay <= msecs_to_jiffies(20) && delay <= ad->antic_expire)
 		delta = 8192 << delay;
 	else
 		return 1;
block/cfq-iosched.c +1 -0
@@ -9,6 +9,7 @@
 #include <linux/module.h>
 #include <linux/blkdev.h>
 #include <linux/elevator.h>
+#include <linux/jiffies.h>
 #include <linux/rbtree.h>
 #include <linux/ioprio.h>
 #include <linux/blktrace_api.h>
#1 lore raw
Quoted 5 lines · Randy Dunlap

From: Randy Dunlap <[email protected]>

Use HZ-independent calculation of milliseconds. Add jiffies.h where it was missing since functions or macros from it are used.

Looks good, applied for 2.6.33.

Quoted 1 line

Oh, where has as-iosched.c in linux-next?

It's gone, it'll be dropped in the next release.

Signature · 1 line
Jens Axboe