public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block: optimizations in blk_rq_timed_out_timer()
@ 2008-10-28 18:22 malahal
  2008-10-29  4:07 ` FUJITA Tomonori
  0 siblings, 1 reply; 10+ messages in thread
From: malahal @ 2008-10-28 18:22 UTC (permalink / raw)
  To: linux-scsi; +Cc: jens.axboe

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>

diff -r a6ae42397ede block/blk-timeout.c
--- a/block/blk-timeout.c	Thu Oct 23 11:48:45 2008 -0700
+++ b/block/blk-timeout.c	Fri Oct 24 17:08:24 2008 -0700
@@ -118,7 +118,7 @@
 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);
@@ -133,15 +133,13 @@
 			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))
+	if (next)
 		mod_timer(&q->timeout, round_jiffies(next));
 
 	spin_unlock_irqrestore(q->queue_lock, flags);

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2008-10-30 10:30 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-28 18:22 [PATCH] block: optimizations in blk_rq_timed_out_timer() malahal
2008-10-29  4:07 ` FUJITA Tomonori
2008-10-29  6:06   ` malahal
2008-10-29 13:26     ` Jens Axboe
2008-10-29 18:21       ` malahal
2008-10-30  2:33     ` FUJITA Tomonori
2008-10-30  7:49       ` Jens Axboe
2008-10-30  8:29         ` FUJITA Tomonori
2008-10-30  8:55           ` Jens Axboe
2008-10-30 10:29             ` FUJITA Tomonori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox