lkml.org 
[lkml]   [1999]   [Mar]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: disk head scheduling
torvalds@transmeta.com (Linus Torvalds)  wrote on 22.03.99 in <Pine.LNX.3.95.990322075646.9730B-100000@penguin.transmeta.com>:

> On Mon, 22 Mar 1999, Rogier Wolff wrote:
> >
> > To save on the (indirect) function call, I would like to suggest:
> >
> > unsigned char **queue_numbers;
> >
> > queue_number = queue_numbers[major][minor];
>
> This is what we do for block sizes, and it's a complete horror to maintain
> and debug. Even worse: it forces us to have 8-bit minor and major numbers
> forever.

Not necessarily. Just make sure you allocate those numbers intelligently -
which should be fairly easy: have everybody who needs a number request it
from a global allocator at initialization time.

That way, you can also try to do something more or less intelligent (like
doing a printk and starting over) when you run out of numbers, as you
would sooner or later if you really used unsigned char, aka 256 numbers
max.

You could even automate that by reserving one value for "no number
assigned", and then when trying to access a queue you notice you have no
value assigned, depending on what you want to do, either take this as
equivalent to an empty queue, or go allocate a value - this way, unused
devices don't occupy queue numbers.

No static numbers anywhere to keep track of.

And it's easy to encapsulate so that code remains correct when minor/major
type sizes, or queue number type sizes, change (except for the allocation
routines themselves).

> The function would be slightly more CPU work, but is a _lot_ more
> flexible.

All such a function could do would be aliasing devices together. You can
get that effect by defining a per-major bitmask to and with the device
number before indexing the queue number table - I assume that every device
on a major would want to use the same level of aliasing (typically, one
queue per disk drive), and that ought to mean the same bit mask for all
devices on one major.

What did I miss?

MfG Kai

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

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