mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] wrong disk index in /proc/stat
@ 2001-06-25 19:40 Martin Wilck
  2001-06-26  2:56 ` Guest section DW
  0 siblings, 1 reply; 6+ messages in thread
From: Martin Wilck @ 2001-06-25 19:40 UTC (permalink / raw)
  To: Linux Kernel mailing list


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;
 }



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2001-06-26 17:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-25 19:40 [PATCH] wrong disk index in /proc/stat Martin Wilck
2001-06-26  2:56 ` Guest section DW
2001-06-26 14:07   ` Martin Wilck
2001-06-26 15:49     ` Guest section DW
2001-06-26 16:55       ` Martin Wilck
2001-06-26 17:16         ` Guest section DW

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®