lkml.org 
[lkml]   [2001]   [Jun]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] wrong disk index in /proc/stat

Hi,

I posted this patch already from my home mail account on June 20 (subject:
disk_index weirdness), but no one seems to have noticed - therefore I
try again. Those who _have_ noticed the other mail - sorry for bothering).

The disk_index routine erroneously adds 2 to the index of disks on the
first IDE controller which is wriong in 2.4, because disks are indexed
by major number now. The patch fixes this and adds support for some more
major numbers. (To fully benefit, DK_MAX_MAJOR in
include/linux/kernel_stat.h must be increased).

The patch is against plain 2.4.5.

Regards,
Martin

--
Martin Wilck <Martin.Wilck@fujitsu-siemens.com>
FSC EP PS DS1, Paderborn Tel. +49 5251 8 15113

diff -ru linux-2.4.5/include/linux/genhd.h linux-2.4.5mw/include/linux/genhd.h
--- linux-2.4.5/include/linux/genhd.h Tue Mar 27 01:48:11 2001
+++ linux-2.4.5mw/include/linux/genhd.h Mon Jun 25 14:23:57 2001
@@ -248,21 +248,30 @@
unsigned int index;

switch (major) {
- case DAC960_MAJOR+0:
- index = (minor & 0x00f8) >> 3;
- break;
case SCSI_DISK0_MAJOR:
index = (minor & 0x00f0) >> 4;
break;
case IDE0_MAJOR: /* same as HD_MAJOR */
case XT_DISK_MAJOR:
+ case IDE1_MAJOR:
+ case IDE2_MAJOR:
+ case IDE3_MAJOR:
+ case IDE4_MAJOR:
+ case IDE5_MAJOR:
index = (minor & 0x0040) >> 6;
break;
- case IDE1_MAJOR:
- index = ((minor & 0x0040) >> 6) + 2;
+ case SCSI_CDROM_MAJOR:
+ index = minor & 0x000f;
break;
default:
- return 0;
+ if (major >= SCSI_DISK1_MAJOR && major <= SCSI_DISK7_MAJOR)
+ index = (minor & 0x00f0) >> 4;
+ else if (major >= DAC960_MAJOR && major <= DAC960_MAJOR + 7)
+ index = (minor & 0x00f8) >> 3;
+ else if (major >= IDE6_MAJOR && major <= IDE9_MAJOR)
+ index = (minor & 0x0040) >> 6;
+ else
+ return 0;
}
return index;
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:55    [W:0.058 / U:48.856 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site