[444] in linux-scsi channel archive
Re: Generic Scsi Driver Bug Report and comments.
daemon@ATHENA.MIT.EDU (Heiko Eissfeldt)
Tue Aug 1 02:25:03 1995
From: heiko@colossus.escape.de (Heiko Eissfeldt)
To: mike@ringo.reno.nv.us (Michael Morrison)
Date: Mon, 31 Jul 1995 00:37:08 +0200 (MET DST)
Cc: linux-scsi@vger.rutgers.edu
In-Reply-To: <m0sc56K-000SmpC@ringo> from "Michael Morrison" at Jul 28, 95 11:10:19 pm
> I intend to make the changes
> to the sg driver we use to provide a better interface and device mapping
> stratagy. I will follow this message up with a formal specification.
> But before I do, I'd like comments from sg driver users. Do you agree
> with the following comments? Would having another sg driver that is
> based on the existing one but with a slightly different interface and
> better error reporting be desirable?
IMHO yes.
> I believe this method of device mapping is not the best way.
> A better way would to map devices as follows:
>
> /dev/sg00 -> Controller 0, Id 0
> /dev/sg01 -> Controller 0, Id 1
> /dev/sg10 -> Controller 1, Id 0
> /dev/sg11 -> Controller 1, Id 1
> etc.
I got frequent requests from HOWTO readers for static device mappings, too.
It seems to be the natural way.
> On machine 1 the "exotic" device is mapped to /dev/sgc
> and on machine 2 the "exotic" device is mapped to /dev/sgb.
>
> My application code wants to talk to the "exotic" device at
> SCSI id 6, but there is no way to assertain which generic device
> name this is mapped to without scanning the whole bus. Our application
> software typically has command line arguments for controller number
> and target id. It is impossible to translate controller number and
> target id to a device file name in the current scheme.
Another point is: it makes a difference whether your device is switched
on at boot time or not.
To achieve this static mapping, you will have to reserve a device
structure for every potential SCSI device. 8 luns for 8 IDs for 4
controllers will fill the minor device space. To save memory one
could allocate a device from a pool of say ten generic devices.
This would be much less waste than 256 structures. It would suit
fine when direct copies to/from user space could obsolete kernel
internal buffers (a la SG_BIGBUFF), reducing memory usage further.
As far as I understood the user memory has to be locked to avoid
swapping out. This seems to be the tricky part. Unfortunately I
don't understand enough of the internals of memory management to
implement it myself.
The Inquiry could be done at the open call to ensure a device is present.
I have mentioned this before too to Eric and Drew, and am really interested
in their opinion.
Heiko