[patch] optimize disk_round_stats

From: Chen, Kenneth W
Date: Thu Oct 13 2005 - 14:20:37 EST


Following the same idea, it occurs to me that we should only update
disk stat when "now" is different from disk->stamp. Otherwise, we
are again needlessly adding zero to the stats.


Signed-off-by: Ken Chen <kenneth.w.chen@xxxxxxxxx>

--- ./drivers/block/ll_rw_blk.c.orig 2005-10-13 11:54:07.474907379 -0700
+++ ./drivers/block/ll_rw_blk.c 2005-10-13 11:54:39.074516367 -0700
@@ -2433,6 +2433,9 @@ void disk_round_stats(struct gendisk *di
{
unsigned long now = jiffies;

+ if (now == disk->stamp)
+ return;
+
if (disk->in_flight) {
__disk_stat_add(disk, time_in_queue,
disk->in_flight * (now - disk->stamp));



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/