Subject: Re: Dynamic SCSI ids (was: A possible way of handling...)
To: Scott Reynolds <scottr@plexus.com>
From: Bill Studenmund <wrstuden@loki.stanford.edu>
List: tech-kern
Date: 05/12/1997 10:04:06
> 
> On Mon, 12 May 1997, der Mouse wrote:
> 
> > This wouldn't be such a problem except that those ports have
> > MAXPARTITIONS set to 8, which is awfully small.  I've raised that to
> > 16, and even sent-pr the changes for the SPARC, but have seen no sign
> > of interest.
> 
> While I can't speak for anyone else, this sort of change has the potential
> to screw a _lot_ of people if not done carefully, something that I'm sure
> is not lost on the folks that maintain the SPARC port.  It seems to me
> that the amount of hostility created by making this move could easily be
> greater than that created by leaving things alone...  (Users -- can't live
> with 'em, and can't live with 'em. ;-)

I kinda agree with both of you. 8 is generally on the small side.. But
one BIG convcern is that the kernel and the device special files MUST
agree, or all hell breaks loose.

My idea on what to do is to have the kernel ask user space. During boot,
at about the time we mount the root file system, we go take a look at
/dev/wd1a and /dev/sd1a (and /dev/cd1a and ...). The minor number of this
device is exactly the number of partitions for this device type.

If we don't find such a device, we just assume the default (8?).

Needed changes in the code:

Each of these devices needs to know about its own number of partitions
and that it's only known at run time.

The disklabel code in general needs to be happy with the number of
partitions changing from device type to device type (wd's can have a
different number of partitions than sd's).

The md part of the kernel needs a hook to re-calculate the boot
partition device. As long as the wd/sd code's idea of the partition
count agrees with the boot device's at all times, it doesn't matter
if we start with 8 partitions and then change it later. Basically right
after we read all the device nodes, we change the # of partitions/device
and then immediately ask for the md code to re-calc the boot partition.

If we wanted to get fancy, we could add a hook such that when we've
booted into single-user mode we can ask the kernel to re-calculate
the number of partitions. The idea is that you can boot and then rebuild
devices with a different number of partitions/device, re-sync the kernel,
and continue boot.

Another possability of this scheme is to permit having 4 (maybe 3?)
partitions per device. If your system uses lots of ccd's, you can then
have twice as many hd's hooked up at once. If ccd's can be partitioned,
you get the best of both worlds.

Just a thought.

Take care,

Bill