]>
Commit | Line | Data |
---|---|---|
00e5a55c BS |
1 | Subject: Block: use round_jiffies_up() |
2 | From: Alan Stern <stern@rowland.harvard.edu> | |
3 | Date: Thu Nov 6 08:42:49 2008 +0100: | |
4 | Git: 7838c15b8dd18e78a523513749e5b54bda07b0cb | |
5 | References: bnc#464155 | |
6 | ||
7 | This patch (as1159b) changes the timeout routines in the block core to | |
8 | use round_jiffies_up(). There's no point in rounding the timer | |
9 | deadline down, since if it expires too early we will have to restart | |
10 | it. | |
11 | ||
12 | The patch also removes some unnecessary tests when a request is | |
13 | removed from the queue's timer list. | |
14 | ||
15 | Signed-off-by: Alan Stern <stern@rowland.harvard.edu> | |
16 | Signed-off-by: Jens Axboe <jens.axboe@oracle.com> | |
17 | Signed-off-by: Hannes Reinecke <hare@suse.de> | |
18 | ||
19 | --- | |
20 | block/blk-timeout.c | 20 +++----------------- | |
21 | 1 file changed, 3 insertions(+), 17 deletions(-) | |
22 | ||
23 | --- a/block/blk-timeout.c | |
24 | +++ b/block/blk-timeout.c | |
25 | @@ -16,14 +16,7 @@ void blk_delete_timer(struct request *re | |
26 | { | |
27 | struct request_queue *q = req->q; | |
28 | ||
29 | - /* | |
30 | - * Nothing to detach | |
31 | - */ | |
32 | - if (!q->rq_timed_out_fn || !req->deadline) | |
33 | - return; | |
34 | - | |
35 | list_del_init(&req->timeout_list); | |
36 | - | |
37 | if (list_empty(&q->timeout_list)) | |
38 | del_timer(&q->timeout); | |
39 | } | |
40 | @@ -83,7 +76,7 @@ void blk_rq_timed_out_timer(unsigned lon | |
41 | } | |
42 | ||
43 | if (next_set && !list_empty(&q->timeout_list)) | |
44 | - mod_timer(&q->timeout, round_jiffies(next)); | |
45 | + mod_timer(&q->timeout, round_jiffies_up(next)); | |
46 | ||
47 | spin_unlock_irqrestore(q->queue_lock, flags); | |
48 | } | |
49 | @@ -139,17 +132,10 @@ void blk_add_timer(struct request *req) | |
50 | ||
51 | /* | |
52 | * If the timer isn't already pending or this timeout is earlier | |
53 | - * than an existing one, modify the timer. Round to next nearest | |
54 | + * than an existing one, modify the timer. Round up to next nearest | |
55 | * second. | |
56 | */ | |
57 | - expiry = round_jiffies(req->deadline); | |
58 | - | |
59 | - /* | |
60 | - * We use ->deadline == 0 to detect whether a timer was added or | |
61 | - * not, so just increase to next jiffy for that specific case | |
62 | - */ | |
63 | - if (unlikely(!req->deadline)) | |
64 | - req->deadline = 1; | |
65 | + expiry = round_jiffies_up(req->deadline); | |
66 | ||
67 | if (!timer_pending(&q->timeout) || | |
68 | time_before(expiry, q->timeout.expires)) |