2002-03-13 16:34:23

by Dana Lacoste

[permalink] [raw]
Subject: proc/stat question

I'm looking at the disk_io: field from /proc/stat and I'm seeing
some inconsistencies. On systems with two scsi disks, everything's
fine. On systems with 2 IDE disks (hda and hdc) it only shows hda's info.
on systems with the compaq smart array controller, i get nothing.

It looks like the scsi is working fine, the IDE is not working properly,
and kstat doesn't search for /dev/ida devices (actually, that might
not be a bug, the devices are kind of annoying :)

If I understand it right, it does a loop checking all majors from
0 to 16 (DK_MAX_MAJOR, defined in kernel_stat.h) and checks each
disk (0 to 16, once again) on that major. The problem is that hdc
has major 22 and ida has major 72, so the 0-16 search just misses
everything.

So my main question : is there a way we can just print out for the known
disk devices? devfs and driverfs know how to tell if a disk is connected,
so I would think the information has to be there somewhere, right?

The relevant code is shown below (from fs/proc/proc_misc.c) :
(2.4.18 shown)

len += sprintf(page + len, "\ndisk_io: ");

for (major = 0; major < DK_MAX_MAJOR; major++) {
for (disk = 0; disk < DK_MAX_DISK; disk++) {
int active = kstat.dk_drive[major][disk] +
kstat.dk_drive_rblk[major][disk] +
kstat.dk_drive_wblk[major][disk];
if (active)
len += sprintf(page + len,
"(%u,%u):(%u,%u,%u,%u,%u) ",
major, disk,
kstat.dk_drive[major][disk],
kstat.dk_drive_rio[major][disk],
kstat.dk_drive_rblk[major][disk],
kstat.dk_drive_wio[major][disk],
kstat.dk_drive_wblk[major][disk]
);
}
}


2002-03-13 16:57:05

by Alan

[permalink] [raw]
Subject: Re: proc/stat question

> fine. On systems with 2 IDE disks (hda and hdc) it only shows hda's info.
> on systems with the compaq smart array controller, i get nothing.

Yeah - its old stuff, and its a bit limited. Take a look at /proc/partitions
in a currentish -ac kernel. That has the sard stuff that Red Hat did finally
merged into it