Skip to content

Commit

Permalink
block: optimizations in blk_rq_timed_out_timer()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
[email protected] authored and Jens Axboe committed Dec 29, 2008
1 parent 66d352e commit 565e411
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions block/blk-timeout.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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))
Expand Down

0 comments on commit 565e411

Please sign in to comment.