From: Douglas Gilbert <dougg@torque.net>
To: linux-scsi@vger.kernel.org
Subject: [PATCH] scsi_debug 1.64 , remove detect(), "hotplug" hosts
Date: Sat, 09 Nov 2002 21:26:46 +1100 [thread overview]
Message-ID: <3DCCE2E6.6050800@torque.net> (raw)
[-- 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 --]
next reply other threads:[~2002-11-09 10:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-09 10:26 Douglas Gilbert [this message]
2002-11-10 1:27 ` [PATCH] scsi_debug 1.64 , remove detect(), "hotplug" hosts Mike Anderson
2002-11-11 1:44 ` Douglas Gilbert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3DCCE2E6.6050800@torque.net \
--to=dougg@torque.net \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.