All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi_debug 1.64 , remove detect(), "hotplug" hosts
@ 2002-11-09 10:26 Douglas Gilbert
  2002-11-10  1:27 ` Mike Anderson
  0 siblings, 1 reply; 3+ messages in thread
From: Douglas Gilbert @ 2002-11-09 10:26 UTC (permalink / raw)
  To: linux-scsi

[-- Attachment #1: Type: text/plain, Size: 2084 bytes --]

This patch is against lk 2.5.46-bk3 which includes
Christoph's work removing the requirement for
detect() functions in LLDDs. He sent me an example
for scsi_debug which I have built on with this patch.

As threatened, this version includes a "scsi_debug_add_host"
parameter. At kernel or module load time this is an absolute
number (0..127 are allowable and 1 is the default). So:
     modprobe scsi_debug scsi_debug_num_devs=20 scsi_debug_add_host=0
will result in no scsi_debug hosts (thus no devices) but
the driver has 20 slots available for devices.

Then a host can be introduced (simulated hotplug) by
     echo 1 > /sysfs/bus/scsi/drivers/scsi_debug/add_host
This causes a scsi_debug host to appear and devices get
found on it [14 in my system: 7 targets (0..6) each with
2 luns (0..1)]. Another host hotplug can be simulated by
     echo 1 > /sysfs/bus/scsi/drivers/scsi_debug/add_host
which results in another 6 devices being attached (for a
total of 20 scsi_debug devices as dictated by the original
scsi_debug_num_devs).

That last (second) scsi_debug host can be removed by
     echo -1 > /sysfs/bus/scsi/drivers/scsi_debug/add_host
and its 6 devices go. Another application of this "echo"
removes the first host and all remaining devices.

Seems to work fine.


Notes:
   - Christoph and Mike A. are pulling me in 2 different
     directions. In this case Christoph got to me first
     so I have moved along that direction. Mike's
     "/sysfs/bus/scsi_dbg_fake" has me perplexed ...
   - rmmod and subsequent modprobe's on scsi_debug
     sometimes blow up.
     Hopefully Patrick's fix (not in bk3?) addresses that.
   - this patch has a work around for a kernel sscanf() bug
     (parsing -ve numbers). Randy Dunlap has attended to that.
   - the simulated "hotplug" thread belongs to the echo command
     or some sysfs magic. scsi_debug could schedule a timer
     event and do the hotplug (hot unplug) in the context of
     a timer interrupt (?) for added reality.
   - cleaned out some extraneous includes and comments.
     Suggestions welcome.

Doug Gilbert


[-- Attachment #2: scsi_debug_164_46bk3.diff.gz --]
[-- Type: application/x-gzip, Size: 4086 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-11-11  1:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-09 10:26 [PATCH] scsi_debug 1.64 , remove detect(), "hotplug" hosts Douglas Gilbert
2002-11-10  1:27 ` Mike Anderson
2002-11-11  1:44   ` Douglas Gilbert

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.