Re: [PATCH] wrong disk index in /proc/stat

2001-06-26 Thread Guest section DW

On Tue, Jun 26, 2001 at 06:55:54PM +0200, Martin Wilck wrote:

> I (being new to kernel hacking) have yet to understand what needs
> to happen for patches to enter the main branches.

You mail them to Linus, with a cc to linux-kernel.
If he likes the patch it will be part of the next (pre)release.
Since your patch is short and corrects an actual bug,
your chances may be good.
If Linus starts 2.5 and Alan takes 2.4 the patch may be
relevant to both branches.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: [PATCH] wrong disk index in /proc/stat

2001-06-26 Thread Martin Wilck


> [go to ftp://ftp.XX.kernel.org/pub/linux/kernel/people/aeb/ or so
> and get patches 01*, 02*, ... and apply them successively to 2.4.6pre5.
> complain to [EMAIL PROTECTED] if anything is wrong]

I see, you're going for a much deeper patch. No objections whatsoever,
that's certainly a better solution, but I can't start testing it now (my
IA-64 machine has enough other problems to solve yet).

My patch was merely intended to correct the index for disks on the 1st
IDE controller, which is just plain wrong.

I (being new to kernel hacking) have yet to understand what needs
to happen for patches to enter the main branches.

Cheers,
Martin

-- 
Martin Wilck <[EMAIL PROTECTED]>
FSC EP PS DS1, Paderborn  Tel. +49 5251 8 15113



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



Re: [PATCH] wrong disk index in /proc/stat

2001-06-26 Thread Guest section DW

On Tue, Jun 26, 2001 at 04:07:33PM +0200, Martin Wilck wrote:

> > static inline unsigned int disk_index (kdev_t dev)
> > {
> > struct gendisk *g = get_gendisk(dev);
> > return g ? (MINOR(dev) >> g->minor_shift) : 0;
> > }
> 
> Well,
> 
> a) this is not in the official kernel,
> b) the original genhd.h says that's too slow (is it really slower?)

Ad a): true.
Ad b): if you only make this change then it will be faster or slower
  depending on how many disks you have (because get_gendisk() used
  to be a linear search through a list that has as length the number
  of disk majors); however, my get_gendisk today is

static inline struct gendisk *
get_gendisk(kdev_t dev) {
return blk_gendisk[MAJOR(dev)];
}

  hence is faster.

Andries

[go to ftp://ftp.XX.kernel.org/pub/linux/kernel/people/aeb/ or so
and get patches 01*, 02*, ... and apply them successively to 2.4.6pre5.
complain to [EMAIL PROTECTED] if anything is wrong]
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: [PATCH] wrong disk index in /proc/stat

2001-06-26 Thread Martin Wilck

Hi,

> On the other hand, in my tree:
>
> static inline unsigned int disk_index (kdev_t dev)
> {
> struct gendisk *g = get_gendisk(dev);
> return g ? (MINOR(dev) >> g->minor_shift) : 0;
> }

Well,

a) this is not in the official kernel,
b) the original genhd.h says that's too slow (is it really slower?)

Regards,
Martin

-- 
Martin Wilck <[EMAIL PROTECTED]>
FSC EP PS DS1, Paderborn  Tel. +49 5251 8 15113



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



Re: [PATCH] wrong disk index in /proc/stat

2001-06-25 Thread Guest section DW

On Mon, Jun 25, 2001 at 09:40:56PM +0200, Martin Wilck wrote:

> no one seems to have noticed

Don't worry. The set of people who noticed was nonempty.

On the other hand, in my tree:

static inline unsigned int disk_index (kdev_t dev)
{
struct gendisk *g = get_gendisk(dev);
return g ? (MINOR(dev) >> g->minor_shift) : 0;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



[PATCH] wrong disk index in /proc/stat

2001-06-25 Thread Martin Wilck


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 <[EMAIL PROTECTED]>
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 [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/