mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Chen, Kenneth W" <kenneth.w.chen@intel.com>
To: <linux-kernel@vger.kernel.org>
Cc: "Jens Axboe" <axboe@suse.de>
Subject: [patch] remove gendisk->stamp_idle field
Date: Thu, 13 Oct 2005 12:13:00 -0700	[thread overview]
Message-ID: <200510131913.j9DJDNg07632@unix-os.sc.intel.com> (raw)

struct gendisk has these two fields: stamp, stamp_idle.  Update to
stamp_idle is always in sync with stamp and they are always the same.
Therefore, it does not add any value in having two fields tracking
same timestamp.  Suggest to remove it.

Also, we should only update gendisk stats with non-zero value.
Advantage is that we don't have to needlessly calculate memory address,
and then add zero to the content.


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

--- ./drivers/block/ll_rw_blk.c.orig	2005-10-13 11:47:02.265928213 -0700
+++ ./drivers/block/ll_rw_blk.c	2005-10-13 11:50:22.289363262 -0700
@@ -2433,13 +2433,12 @@ void disk_round_stats(struct gendisk *di
 {
 	unsigned long now = jiffies;
 
-	__disk_stat_add(disk, time_in_queue,
-			disk->in_flight * (now - disk->stamp));
+	if (disk->in_flight) {
+		__disk_stat_add(disk, time_in_queue,
+				disk->in_flight * (now - disk->stamp));
+		__disk_stat_add(disk, io_ticks, (now - disk->stamp));
+	}
 	disk->stamp = now;
-
-	if (disk->in_flight)
-		__disk_stat_add(disk, io_ticks, (now - disk->stamp_idle));
-	disk->stamp_idle = now;
 }
 
 /*
--- ./fs/partitions/check.c.orig	2005-10-13 11:52:09.186822890 -0700
+++ ./fs/partitions/check.c	2005-10-13 11:52:41.332330309 -0700
@@ -430,7 +430,7 @@ void del_gendisk(struct gendisk *disk)
 	disk->flags &= ~GENHD_FL_UP;
 	unlink_gendisk(disk);
 	disk_stat_set_all(disk, 0);
-	disk->stamp = disk->stamp_idle = 0;
+	disk->stamp = 0;
 
 	devfs_remove_disk(disk);
 
--- ./include/linux/genhd.h.orig	2005-10-13 11:51:24.137995317 -0700
+++ ./include/linux/genhd.h	2005-10-13 11:51:43.293268520 -0700
@@ -119,7 +119,7 @@ struct gendisk {
 	int policy;
 
 	atomic_t sync_io;		/* RAID */
-	unsigned long stamp, stamp_idle;
+	unsigned long stamp;
 	int in_flight;
 #ifdef	CONFIG_SMP
 	struct disk_stats *dkstats;


             reply	other threads:[~2005-10-13 19:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-13 19:13 Chen, Kenneth W [this message]
2005-10-13 19:16 ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200510131913.j9DJDNg07632@unix-os.sc.intel.com \
    --to=kenneth.w.chen@intel.com \
    --cc=axboe@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®