diff options
author | Matthew Wilcox <matthew@wil.cx> | 2006-09-28 17:19:20 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2006-10-11 14:44:25 -0400 |
commit | 3e082a910d217b2e7b186077ebf5a1126a68c62f (patch) | |
tree | b4ef4152b8ad0198283e36c74c990f38d90d27b7 /include/scsi | |
parent | 53a5fbdc2dff55161a206ed1a1385a8fa8055c34 (diff) |
[SCSI] Add ability to scan scsi busses asynchronously
Since it often takes around 20-30 seconds to scan a scsi bus, it's
highly advantageous to do this in parallel with other things. The bulk
of this patch is ensuring that devices don't change numbering, and that
all devices are discovered prior to trying to start init. For those
who build SCSI as modules, there's a new scsi_wait_scan module that will
ensure all bus scans are finished.
This patch only handles drivers which call scsi_scan_host. Fibre Channel,
SAS, SATA, USB and Firewire all need additional work.
Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'include/scsi')
-rw-r--r-- | include/scsi/scsi_device.h | 30 | ||||
-rw-r--r-- | include/scsi/scsi_host.h | 3 |
2 files changed, 18 insertions, 15 deletions
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index b401c82036be..ebf31b16dc49 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h | |||
@@ -223,13 +223,13 @@ extern struct scsi_device *__scsi_iterate_devices(struct Scsi_Host *, | |||
223 | struct scsi_device *); | 223 | struct scsi_device *); |
224 | 224 | ||
225 | /** | 225 | /** |
226 | * shost_for_each_device - iterate over all devices of a host | 226 | * shost_for_each_device - iterate over all devices of a host |
227 | * @sdev: iterator | 227 | * @sdev: the &struct scsi_device to use as a cursor |
228 | * @host: host whiches devices we want to iterate over | 228 | * @shost: the &struct scsi_host to iterate over |
229 | * | 229 | * |
230 | * This traverses over each devices of @shost. The devices have | 230 | * Iterator that returns each device attached to @shost. This loop |
231 | * a reference that must be released by scsi_host_put when breaking | 231 | * takes a reference on each device and releases it at the end. If |
232 | * out of the loop. | 232 | * you break out of the loop, you must call scsi_device_put(sdev). |
233 | */ | 233 | */ |
234 | #define shost_for_each_device(sdev, shost) \ | 234 | #define shost_for_each_device(sdev, shost) \ |
235 | for ((sdev) = __scsi_iterate_devices((shost), NULL); \ | 235 | for ((sdev) = __scsi_iterate_devices((shost), NULL); \ |
@@ -237,17 +237,17 @@ extern struct scsi_device *__scsi_iterate_devices(struct Scsi_Host *, | |||
237 | (sdev) = __scsi_iterate_devices((shost), (sdev))) | 237 | (sdev) = __scsi_iterate_devices((shost), (sdev))) |
238 | 238 | ||
239 | /** | 239 | /** |
240 | * __shost_for_each_device - iterate over all devices of a host (UNLOCKED) | 240 | * __shost_for_each_device - iterate over all devices of a host (UNLOCKED) |
241 | * @sdev: iterator | 241 | * @sdev: the &struct scsi_device to use as a cursor |
242 | * @host: host whiches devices we want to iterate over | 242 | * @shost: the &struct scsi_host to iterate over |
243 | * | 243 | * |
244 | * This traverses over each devices of @shost. It does _not_ take a | 244 | * Iterator that returns each device attached to @shost. It does _not_ |
245 | * reference on the scsi_device, thus it the whole loop must be protected | 245 | * take a reference on the scsi_device, so the whole loop must be |
246 | * by shost->host_lock. | 246 | * protected by shost->host_lock. |
247 | * | 247 | * |
248 | * Note: The only reason why drivers would want to use this is because | 248 | * Note: The only reason to use this is because you need to access the |
249 | * they're need to access the device list in irq context. Otherwise you | 249 | * device list in interrupt context. Otherwise you really want to use |
250 | * really want to use shost_for_each_device instead. | 250 | * shost_for_each_device instead. |
251 | */ | 251 | */ |
252 | #define __shost_for_each_device(sdev, shost) \ | 252 | #define __shost_for_each_device(sdev, shost) \ |
253 | list_for_each_entry((sdev), &((shost)->__devices), siblings) | 253 | list_for_each_entry((sdev), &((shost)->__devices), siblings) |
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 39c6f8cc20c3..ba5b3eb6b43f 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h | |||
@@ -552,6 +552,9 @@ struct Scsi_Host { | |||
552 | /* task mgmt function in progress */ | 552 | /* task mgmt function in progress */ |
553 | unsigned tmf_in_progress:1; | 553 | unsigned tmf_in_progress:1; |
554 | 554 | ||
555 | /* Asynchronous scan in progress */ | ||
556 | unsigned async_scan:1; | ||
557 | |||
555 | /* | 558 | /* |
556 | * Optional work queue to be utilized by the transport | 559 | * Optional work queue to be utilized by the transport |
557 | */ | 560 | */ |