Commit 20e5c81f authored by Chen, Kenneth W's avatar Chen, Kenneth W Committed by Jens Axboe

[patch] remove gendisk->stamp_idle field

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: default avatarKen Chen <kenneth.w.chen@intel.com>
Signed-off-by: default avatarJens Axboe <axboe@suse.de>
parent 741b2252
...@@ -2433,13 +2433,12 @@ void disk_round_stats(struct gendisk *disk) ...@@ -2433,13 +2433,12 @@ void disk_round_stats(struct gendisk *disk)
{ {
unsigned long now = jiffies; unsigned long now = jiffies;
__disk_stat_add(disk, time_in_queue, if (disk->in_flight) {
disk->in_flight * (now - disk->stamp)); __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; disk->stamp = now;
if (disk->in_flight)
__disk_stat_add(disk, io_ticks, (now - disk->stamp_idle));
disk->stamp_idle = now;
} }
/* /*
......
...@@ -430,7 +430,7 @@ void del_gendisk(struct gendisk *disk) ...@@ -430,7 +430,7 @@ void del_gendisk(struct gendisk *disk)
disk->flags &= ~GENHD_FL_UP; disk->flags &= ~GENHD_FL_UP;
unlink_gendisk(disk); unlink_gendisk(disk);
disk_stat_set_all(disk, 0); disk_stat_set_all(disk, 0);
disk->stamp = disk->stamp_idle = 0; disk->stamp = 0;
devfs_remove_disk(disk); devfs_remove_disk(disk);
......
...@@ -119,7 +119,7 @@ struct gendisk { ...@@ -119,7 +119,7 @@ struct gendisk {
int policy; int policy;
atomic_t sync_io; /* RAID */ atomic_t sync_io; /* RAID */
unsigned long stamp, stamp_idle; unsigned long stamp;
int in_flight; int in_flight;
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
struct disk_stats *dkstats; struct disk_stats *dkstats;
......
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