aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorBen Woodard <woodard@redhat.com>2006-03-22 02:09:31 -0500
committerJens Axboe <axboe@nelson.home.kernel.dk>2006-03-27 02:29:02 -0500
commit837c7878771c15ed8d85ecf814ece7fcb4551b46 (patch)
tree28b06f0734958802ab98e1e6712ac3c6bf8f2518 /block
parent4c5d0bbde9669cfb7f7fd4670dc9a117aea90384 (diff)
[BLOCK] increase size of disk stat counters
The kernel's representation of the disk statistics uses the type unsigned which is 32b on both 32b and 64b platforms. Unfortunately, most system tools that work with these numbers that are exported in /proc/diskstats including iostat read these numbers into unsigned longs. This works fine on 32b platforms and when the number of IO transactions are small on 64b platforms. However, when the numbers wrap on 64b platforms & you read the numbers into unsigned longs, and compare the numbers to previous readings, then you get an unsigned representation of a negative number. This looks like a very large 64b number & gives you bizarre readouts in iostat: ilc4: Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s rkB/s wkB/s avgrq-sz avgqu-sz await svctm %util ilc4: sda 5.50 0.00 143.96 0.00 307496983987862656.00 0.00 153748491993931328.00 0.00 2136028725038430.00 7.94 55.12 5.59 80.42 Though fixing iostat in user space is possible, and a quick survey indicates that several other similar tools also use unsigned longs when processing /proc/diskstats. Therefore, it seems like a better approach would be to extend the length of the disk_stats structure on 64b architectures to 64b. The following patch does that. It should not affect the operation on 32b platforms. Signed-off-by: Ben Woodard <woodard@redhat.com> Cc: Rick Lindsley <ricklind@us.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Jens Axboe <axboe@suse.de>
Diffstat (limited to 'block')
-rw-r--r--block/genhd.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/block/genhd.c b/block/genhd.c
index 64510fd88621..db4c60c802d6 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -454,8 +454,8 @@ static ssize_t disk_stats_read(struct gendisk * disk, char *page)
454 disk_round_stats(disk); 454 disk_round_stats(disk);
455 preempt_enable(); 455 preempt_enable();
456 return sprintf(page, 456 return sprintf(page,
457 "%8u %8u %8llu %8u " 457 "%8lu %8lu %8llu %8u "
458 "%8u %8u %8llu %8u " 458 "%8lu %8lu %8llu %8u "
459 "%8u %8u %8u" 459 "%8u %8u %8u"
460 "\n", 460 "\n",
461 disk_stat_read(disk, ios[READ]), 461 disk_stat_read(disk, ios[READ]),
@@ -649,7 +649,7 @@ static int diskstats_show(struct seq_file *s, void *v)
649 preempt_disable(); 649 preempt_disable();
650 disk_round_stats(gp); 650 disk_round_stats(gp);
651 preempt_enable(); 651 preempt_enable();
652 seq_printf(s, "%4d %4d %s %u %u %llu %u %u %u %llu %u %u %u %u\n", 652 seq_printf(s, "%4d %4d %s %lu %lu %llu %u %lu %lu %llu %u %u %u %u\n",
653 gp->major, n + gp->first_minor, disk_name(gp, n, buf), 653 gp->major, n + gp->first_minor, disk_name(gp, n, buf),
654 disk_stat_read(gp, ios[0]), disk_stat_read(gp, merges[0]), 654 disk_stat_read(gp, ios[0]), disk_stat_read(gp, merges[0]),
655 (unsigned long long)disk_stat_read(gp, sectors[0]), 655 (unsigned long long)disk_stat_read(gp, sectors[0]),