2003-06-18 10:31:13

by Hariprasad Nellitheertha

[permalink] [raw]
Subject: [PATCH] /proc/stat doesn't display stats for more than 16 devices

Hello,

Currently, /proc/stat doesn't display statistics correctly if there are
more than 16 devices connected. Tests with more than 16 SCSI devices
show that /proc/stat displays statistics only for the first 16 devices.

This is because of the way the disk stats array has been implemented.
There is no room to capture the additional SCSI majors in the array. The
following patch corrects this behavior. It also makes a small adjustment
in the disk_index funtion to parse the additional majors correctly.

Also, this was first observed while using iostat. A small change is
needed in iostat as well to make it work properly. I am attaching the
iostat patch along with this.

The kernel patch is at the 2.4.2* level and the iostat (sysstat
actually) is at 4.0.* level. Both /proc/stat and iostat work correctly
after these changes.

Kindly review.

--- kernel_stat.h.org 2003-05-19 16:58:39.000000000 +0530
+++ kernel_stat.h 2003-05-19 17:03:41.000000000 +0530
@@ -12,7 +12,7 @@
* used by rstatd/perfmeter
*/

-#define DK_MAX_MAJOR 16
+#define DK_MAX_MAJOR 256
#define DK_MAX_DISK 16

struct kernel_stat {
--- genhd.h.org 2003-05-19 16:58:48.000000000 +0530
+++ genhd.h 2003-05-19 17:04:01.000000000 +0530
@@ -298,6 +298,13 @@
index = (minor & 0x00f8) >> 3;
break;
case SCSI_DISK0_MAJOR:
+ case SCSI_DISK1_MAJOR:
+ case SCSI_DISK2_MAJOR:
+ case SCSI_DISK3_MAJOR:
+ case SCSI_DISK4_MAJOR:
+ case SCSI_DISK5_MAJOR:
+ case SCSI_DISK6_MAJOR:
+ case SCSI_DISK7_MAJOR:
index = (minor & 0x00f0) >> 4;
break;
case IDE0_MAJOR: /* same as HD_MAJOR */


Regards,
Hari



Attachments:
iostat.patch (904.00 B)