From: Jerome Marchand <jmarchand@redhat.com> Date: Tue, 15 Jul 2008 15:55:47 +0200 Subject: [block] Enhanced Partition Statistics: sysfs Message-id: 20080715135910.837467193@redhat.com O-Subject: [Patch RHEL5.3 6/9] Enhanced Partition Statistics: sysfs Bugzilla: 224322 RH-Acked-by: Anton Arapov <aarapov@redhat.com> bz224322 Reports enhanced partition statistics in sysfs. commit: 34e8beac92c27d292938065f8375842d2840767c diff --git a/fs/partitions/check.c b/fs/partitions/check.c index 075a221..d60d586 100644 --- a/fs/partitions/check.c +++ b/fs/partitions/check.c @@ -250,11 +250,27 @@ static ssize_t part_size_read(struct hd_struct * p, char *page) { return sprintf(page, "%llu\n",(unsigned long long)p->nr_sects); } -static ssize_t part_stat_read(struct hd_struct * p, char *page) +static ssize_t part_stats_read(struct hd_struct *p, char *page) { - return sprintf(page, "%8u %8llu %8u %8llu\n", - p->ios[0], (unsigned long long)p->sectors[0], - p->ios[1], (unsigned long long)p->sectors[1]); + preempt_disable(); + part_round_stats(p); + preempt_enable(); + return sprintf(page, + "%8lu %8lu %8llu %8u " + "%8lu %8lu %8llu %8u " + "%8u %8u %8u" + "\n", + part_stat_read(p, ios[READ]), + part_stat_read(p, merges[READ]), + (unsigned long long)part_stat_read(p, sectors[READ]), + jiffies_to_msecs(part_stat_read(p, ticks[READ])), + part_stat_read(p, ios[WRITE]), + part_stat_read(p, merges[WRITE]), + (unsigned long long)part_stat_read(p, sectors[WRITE]), + jiffies_to_msecs(part_stat_read(p, ticks[WRITE])), + get_partstats(p)->in_flight, + jiffies_to_msecs(part_stat_read(p, io_ticks)), + jiffies_to_msecs(part_stat_read(p, time_in_queue))); } static struct part_attribute part_attr_uevent = { .attr = {.name = "uevent", .mode = S_IWUSR }, @@ -274,7 +290,7 @@ static struct part_attribute part_attr_size = { }; static struct part_attribute part_attr_stat = { .attr = {.name = "stat", .mode = S_IRUGO }, - .show = part_stat_read + .show = part_stats_read }; static struct attribute * default_attrs[] = {