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
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
12 The patch also removes some unnecessary tests when a request is
13 removed from the queue's timer list.
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>
20 block/blk-timeout.c | 20 +++-----------------
21 1 file changed, 3 insertions(+), 17 deletions(-)
23 --- a/block/blk-timeout.c
24 +++ b/block/blk-timeout.c
25 @@ -16,14 +16,7 @@ void blk_delete_timer(struct request *re
27 struct request_queue *q = req->q;
32 - if (!q->rq_timed_out_fn || !req->deadline)
35 list_del_init(&req->timeout_list);
37 if (list_empty(&q->timeout_list))
38 del_timer(&q->timeout);
40 @@ -83,7 +76,7 @@ void blk_rq_timed_out_timer(unsigned lon
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));
47 spin_unlock_irqrestore(q->queue_lock, flags);
49 @@ -139,17 +132,10 @@ void blk_add_timer(struct request *req)
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
57 - expiry = round_jiffies(req->deadline);
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
63 - if (unlikely(!req->deadline))
65 + expiry = round_jiffies_up(req->deadline);
67 if (!timer_pending(&q->timeout) ||
68 time_before(expiry, q->timeout.expires))