From: Anton Blanchard <anton@samba.org>
To: Christoph Hellwig <hch@lst.de>
Cc: James Bottomley <James.Bottomley@SteelEye.com>,
linux-scsi@vger.kernel.org
Subject: Re: [PATCH] serialize bus scanning
Date: Wed, 10 Sep 2003 17:57:42 +1000 [thread overview]
Message-ID: <20030910075741.GC1532@krispykreme> (raw)
In-Reply-To: <20030827203544.GA27020@lst.de>
> you can just add a per-host mutex and lock it in the same places as
> indicated by the comment in the patch.
How does this look? This restores the ability to do parallel scsi scan
via sysfs.
Anton
--
Change scsi_scan_mutex from global to per host, which is needed for
parallel SCSI probe.
gr16_work-anton/drivers/scsi/hosts.c | 2 ++
gr16_work-anton/drivers/scsi/scsi_scan.c | 15 ++++-----------
gr16_work-anton/include/scsi/scsi_host.h | 6 ++++++
3 files changed, 12 insertions(+), 11 deletions(-)
diff -puN drivers/scsi/scsi_scan.c~per_host_scan_mutex drivers/scsi/scsi_scan.c
--- gr16_work/drivers/scsi/scsi_scan.c~per_host_scan_mutex 2003-09-07 00:01:57.000000000 -0500
+++ gr16_work-anton/drivers/scsi/scsi_scan.c 2003-09-07 00:01:57.000000000 -0500
@@ -95,13 +95,6 @@ MODULE_PARM_DESC(max_report_luns,
" between 1 and 16384)");
#endif
-/*
- * This mutex serializes all scsi scanning activity from kernel- and
- * userspace. It could easily be made per-host but I'd like to avoid
- * the overhead for now.
- */
-static DECLARE_MUTEX(scsi_scan_mutex);
-
/**
* scsi_unlock_floptical - unlock device via a special MODE SENSE command
* @sreq: used to send the command
@@ -1075,11 +1068,11 @@ struct scsi_device *scsi_add_device(stru
struct scsi_device *sdev;
int res;
- down(&scsi_scan_mutex);
+ down(&shost->scan_mutex);
res = scsi_probe_and_add_lun(shost, channel, id, lun, NULL, &sdev, 1);
if (res != SCSI_SCAN_LUN_PRESENT)
sdev = ERR_PTR(-ENODEV);
- up(&scsi_scan_mutex);
+ up(&shost->scan_mutex);
return sdev;
}
@@ -1202,13 +1195,13 @@ int scsi_scan_host_selected(struct Scsi_
((lun != SCAN_WILD_CARD) && (lun > shost->max_lun)))
return -EINVAL;
- down(&scsi_scan_mutex);
+ down(&shost->scan_mutex);
if (channel == SCAN_WILD_CARD)
for (channel = 0; channel <= shost->max_channel; channel++)
scsi_scan_channel(shost, channel, id, lun, rescan);
else
scsi_scan_channel(shost, channel, id, lun, rescan);
- up(&scsi_scan_mutex);
+ up(&shost->scan_mutex);
return 0;
}
diff -puN include/scsi/scsi_host.h~per_host_scan_mutex include/scsi/scsi_host.h
--- gr16_work/include/scsi/scsi_host.h~per_host_scan_mutex 2003-09-07 00:01:57.000000000 -0500
+++ gr16_work-anton/include/scsi/scsi_host.h 2003-09-10 02:53:34.000000000 -0500
@@ -480,6 +480,12 @@ struct Scsi_Host {
struct list_head sht_legacy_list;
/*
+ * This mutex serializes all scsi scanning activity from kernel- and
+ * userspace.
+ */
+ struct semaphore scan_mutex;
+
+ /*
* We should ensure that this is aligned, both for better performance
* and also because some compilers (m68k) don't automatically force
* alignment to a long boundary.
diff -puN drivers/scsi/hosts.c~per_host_scan_mutex drivers/scsi/hosts.c
--- gr16_work/drivers/scsi/hosts.c~per_host_scan_mutex 2003-09-07 00:01:57.000000000 -0500
+++ gr16_work-anton/drivers/scsi/hosts.c 2003-09-07 00:01:57.000000000 -0500
@@ -214,6 +214,8 @@ struct Scsi_Host *scsi_host_alloc(struct
INIT_LIST_HEAD(&shost->starved_list);
init_waitqueue_head(&shost->host_wait);
+ init_MUTEX(&shost->scan_mutex);
+
shost->host_no = scsi_host_next_hn++; /* XXX(hch): still racy */
shost->dma_channel = 0xff;
_
next prev parent reply other threads:[~2003-09-10 8:02 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-08-25 12:24 [PATCH] serialize bus scanning Christoph Hellwig
2003-08-27 20:29 ` Anton Blanchard
2003-08-27 20:35 ` Christoph Hellwig
2003-09-10 7:57 ` Anton Blanchard [this message]
2003-09-11 20:34 ` Patrick Mansfield
2003-09-15 7:13 ` Anton Blanchard
2003-09-15 9:10 ` Christoph Hellwig
2003-08-27 22:32 ` Mike Anderson
2003-08-27 22:59 ` Anton Blanchard
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=20030910075741.GC1532@krispykreme \
--to=anton@samba.org \
--cc=James.Bottomley@SteelEye.com \
--cc=hch@lst.de \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox