aboutsummaryrefslogtreecommitdiff
path: root/block/genhd.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-08 09:42:46 -0800
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-08 09:42:46 -0800
commit03054de1e0b90b33e9974107d84dabd2509f5898 (patch)
treea85e92d5387d94ef9e3d10bf11467136c681ad04 /block/genhd.c
parentb5eb9513f7c1bee862ada22bf1489f53752686bd (diff)
parent0e53c2be0495afa97c6b0d06397adcbff9c65347 (diff)
Merge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block
* 'for-linus' of git://git.kernel.dk/linux-2.6-block: Enhanced partition statistics: documentation update Enhanced partition statistics: remove old partition statistics Enhanced partition statistics: procfs Enhanced partition statistics: sysfs Enhanced partition statistics: aoe fix Enhanced partition statistics: update partition statitics Enhanced partition statistics: core statistics block: fixup rq_init() a bit Manually fixed conflict in drivers/block/aoe/aoecmd.c due to statistics support.
Diffstat (limited to 'block/genhd.c')
-rw-r--r--block/genhd.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/block/genhd.c b/block/genhd.c
index de2ebb2fab4..53f2238e69c 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -584,12 +584,28 @@ static int diskstats_show(struct seq_file *s, void *v)
for (n = 0; n < gp->minors - 1; n++) {
struct hd_struct *hd = gp->part[n];
- if (hd && hd->nr_sects)
- seq_printf(s, "%4d %4d %s %u %u %u %u\n",
- gp->major, n + gp->first_minor + 1,
- disk_name(gp, n + 1, buf),
- hd->ios[0], hd->sectors[0],
- hd->ios[1], hd->sectors[1]);
+ if (!hd || !hd->nr_sects)
+ continue;
+
+ preempt_disable();
+ part_round_stats(hd);
+ preempt_enable();
+ seq_printf(s, "%4d %4d %s %lu %lu %llu "
+ "%u %lu %lu %llu %u %u %u %u\n",
+ gp->major, n + gp->first_minor + 1,
+ disk_name(gp, n + 1, buf),
+ part_stat_read(hd, ios[0]),
+ part_stat_read(hd, merges[0]),
+ (unsigned long long)part_stat_read(hd, sectors[0]),
+ jiffies_to_msecs(part_stat_read(hd, ticks[0])),
+ part_stat_read(hd, ios[1]),
+ part_stat_read(hd, merges[1]),
+ (unsigned long long)part_stat_read(hd, sectors[1]),
+ jiffies_to_msecs(part_stat_read(hd, ticks[1])),
+ hd->in_flight,
+ jiffies_to_msecs(part_stat_read(hd, io_ticks)),
+ jiffies_to_msecs(part_stat_read(hd, time_in_queue))
+ );
}
return 0;