Commit 565e411d authored by malahal@us.ibm.com's avatar malahal@us.ibm.com Committed by Jens Axboe

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: default avatarMalahal Naineni <malahal@us.ibm.com>
Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
parent 66d352e1
...@@ -111,7 +111,7 @@ static void blk_rq_timed_out(struct request *req) ...@@ -111,7 +111,7 @@ static void blk_rq_timed_out(struct request *req)
void blk_rq_timed_out_timer(unsigned long data) void blk_rq_timed_out_timer(unsigned long data)
{ {
struct request_queue *q = (struct request_queue *) 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; struct request *rq, *tmp;
spin_lock_irqsave(q->queue_lock, flags); spin_lock_irqsave(q->queue_lock, flags);
...@@ -126,13 +126,11 @@ void blk_rq_timed_out_timer(unsigned long data) ...@@ -126,13 +126,11 @@ void blk_rq_timed_out_timer(unsigned long data)
if (blk_mark_rq_complete(rq)) if (blk_mark_rq_complete(rq))
continue; continue;
blk_rq_timed_out(rq); blk_rq_timed_out(rq);
} } else {
if (!next_set) { if (!next || time_after(next, rq->deadline))
next = rq->deadline;
next_set = 1;
} else if (time_after(next, rq->deadline))
next = rq->deadline; next = rq->deadline;
} }
}
if (next_set && !list_empty(&q->timeout_list)) if (next_set && !list_empty(&q->timeout_list))
mod_timer(&q->timeout, round_jiffies_up(next)); mod_timer(&q->timeout, round_jiffies_up(next));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment