Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 28f39d55 authored by Jerome Marchand's avatar Jerome Marchand Committed by Jens Axboe
Browse files

Enhanced partition statistics: procfs



Reports enhanced partition statistics in /proc/diskstats.

Signed-off-by: default avatarJerome Marchand <jmarchan@redhat.com>
parent 34e8beac
Loading
Loading
Loading
Loading
+22 −6
Original line number Original line Diff line number Diff line
@@ -584,12 +584,28 @@ static int diskstats_show(struct seq_file *s, void *v)
	for (n = 0; n < gp->minors - 1; n++) {
	for (n = 0; n < gp->minors - 1; n++) {
		struct hd_struct *hd = gp->part[n];
		struct hd_struct *hd = gp->part[n];


		if (hd && hd->nr_sects)
		if (!hd || !hd->nr_sects)
			seq_printf(s, "%4d %4d %s %u %u %u %u\n",
			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,
			   gp->major, n + gp->first_minor + 1,
			   disk_name(gp, n + 1, buf),
			   disk_name(gp, n + 1, buf),
				hd->ios[0], hd->sectors[0],
			   part_stat_read(hd, ios[0]),
				hd->ios[1], hd->sectors[1]);
			   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;
	return 0;