diff options
author | malahal@us.ibm.com <malahal@us.ibm.com> | 2008-10-30 08:51:58 +0100 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2008-12-29 08:28:42 +0100 |
commit | 565e411d764eeda006738dfadbccca79d48381e1 (patch) | |
tree | 5bd835b9aed2df0dc91ed58740834d6e156e86ea /block/blk-timeout.c | |
parent | 66d352e1e410dcea22fecb9fa9ec09dd23a62e1c (diff) |
block: optimizations in blk_rq_timed_out_timer()
Now the rq->deadline can't be zero if the request is in the
timeout_list, so there is no need to have next_set. There is no need to
access a request's deadline field if blk_rq_timed_out is called on it.
Signed-off-by: Malahal Naineni <malahal@us.ibm.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'block/blk-timeout.c')
-rw-r--r-- | block/blk-timeout.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/block/blk-timeout.c b/block/blk-timeout.c index 69185ea9fae..116bbf394fb 100644 --- a/block/blk-timeout.c +++ b/block/blk-timeout.c @@ -111,7 +111,7 @@ static void blk_rq_timed_out(struct request *req) void blk_rq_timed_out_timer(unsigned long data) { struct request_queue *q = (struct request_queue *) data; - unsigned long flags, uninitialized_var(next), next_set = 0; + unsigned long flags, next = 0; struct request *rq, *tmp; spin_lock_irqsave(q->queue_lock, flags); @@ -126,12 +126,10 @@ void blk_rq_timed_out_timer(unsigned long data) if (blk_mark_rq_complete(rq)) continue; blk_rq_timed_out(rq); + } else { + if (!next || time_after(next, rq->deadline)) + next = rq->deadline; } - if (!next_set) { - next = rq->deadline; - next_set = 1; - } else if (time_after(next, rq->deadline)) - next = rq->deadline; } if (next_set && !list_empty(&q->timeout_list)) |