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

Guest section DW (dwguest@win.tue.nl)
Tue, 26 Jun 2001 17:49:42 +0200


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 aeb@cwi.nl if anything is wrong]
-
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/