diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2008-11-06 02:42:49 -0500 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2008-11-06 02:42:49 -0500 |
commit | 7838c15b8dd18e78a523513749e5b54bda07b0cb (patch) | |
tree | 7fa295ce51f263c55756d3693f5f5ed7beb68a87 /block/blk-timeout.c | |
parent | 9c133c469d38043d5aadaa03f2fb840d88d1cf4f (diff) |
Block: use round_jiffies_up()
This patch (as1159b) changes the timeout routines in the block core to
use round_jiffies_up(). There's no point in rounding the timer
deadline down, since if it expires too early we will have to restart
it.
The patch also removes some unnecessary tests when a request is
removed from the queue's timer list.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'block/blk-timeout.c')
-rw-r--r-- | block/blk-timeout.c | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/block/blk-timeout.c b/block/blk-timeout.c index 972a63f848fb..69185ea9fae2 100644 --- a/block/blk-timeout.c +++ b/block/blk-timeout.c | |||
@@ -75,14 +75,7 @@ void blk_delete_timer(struct request *req) | |||
75 | { | 75 | { |
76 | struct request_queue *q = req->q; | 76 | struct request_queue *q = req->q; |
77 | 77 | ||
78 | /* | ||
79 | * Nothing to detach | ||
80 | */ | ||
81 | if (!q->rq_timed_out_fn || !req->deadline) | ||
82 | return; | ||
83 | |||
84 | list_del_init(&req->timeout_list); | 78 | list_del_init(&req->timeout_list); |
85 | |||
86 | if (list_empty(&q->timeout_list)) | 79 | if (list_empty(&q->timeout_list)) |
87 | del_timer(&q->timeout); | 80 | del_timer(&q->timeout); |
88 | } | 81 | } |
@@ -142,7 +135,7 @@ void blk_rq_timed_out_timer(unsigned long data) | |||
142 | } | 135 | } |
143 | 136 | ||
144 | if (next_set && !list_empty(&q->timeout_list)) | 137 | if (next_set && !list_empty(&q->timeout_list)) |
145 | mod_timer(&q->timeout, round_jiffies(next)); | 138 | mod_timer(&q->timeout, round_jiffies_up(next)); |
146 | 139 | ||
147 | spin_unlock_irqrestore(q->queue_lock, flags); | 140 | spin_unlock_irqrestore(q->queue_lock, flags); |
148 | } | 141 | } |
@@ -198,17 +191,10 @@ void blk_add_timer(struct request *req) | |||
198 | 191 | ||
199 | /* | 192 | /* |
200 | * If the timer isn't already pending or this timeout is earlier | 193 | * If the timer isn't already pending or this timeout is earlier |
201 | * than an existing one, modify the timer. Round to next nearest | 194 | * than an existing one, modify the timer. Round up to next nearest |
202 | * second. | 195 | * second. |
203 | */ | 196 | */ |
204 | expiry = round_jiffies(req->deadline); | 197 | expiry = round_jiffies_up(req->deadline); |
205 | |||
206 | /* | ||
207 | * We use ->deadline == 0 to detect whether a timer was added or | ||
208 | * not, so just increase to next jiffy for that specific case | ||
209 | */ | ||
210 | if (unlikely(!req->deadline)) | ||
211 | req->deadline = 1; | ||
212 | 198 | ||
213 | if (!timer_pending(&q->timeout) || | 199 | if (!timer_pending(&q->timeout) || |
214 | time_before(expiry, q->timeout.expires)) | 200 | time_before(expiry, q->timeout.expires)) |