Skip to content

Commit 565e411

Browse files
malahalJens Axboe
authored andcommitted
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>
1 parent 66d352e commit 565e411

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

‎block/blk-timeout.c‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ static void blk_rq_timed_out(struct request *req)
111111
void blk_rq_timed_out_timer(unsigned long data)
112112
{
113113
struct request_queue *q = (struct request_queue *) data;
114-
unsigned long flags, uninitialized_var(next), next_set = 0;
114+
unsigned long flags, next = 0;
115115
struct request *rq, *tmp;
116116

117117
spin_lock_irqsave(q->queue_lock, flags);
@@ -126,12 +126,10 @@ void blk_rq_timed_out_timer(unsigned long data)
126126
if (blk_mark_rq_complete(rq))
127127
continue;
128128
blk_rq_timed_out(rq);
129+
} else {
130+
if (!next || time_after(next, rq->deadline))
131+
next = rq->deadline;
129132
}
130-
if (!next_set) {
131-
next = rq->deadline;
132-
next_set = 1;
133-
} else if (time_after(next, rq->deadline))
134-
next = rq->deadline;
135133
}
136134

137135
if (next_set && !list_empty(&q->timeout_list))

0 commit comments

Comments
 (0)