Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 42458
b: refs/heads/master
c: 1aa8fab
h: refs/heads/master
v: v3
  • Loading branch information
Matthew Wilcox authored and James Bottomley committed Nov 22, 2006
1 parent 81671f8 commit 7fd3588
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 93b45af5c6b9d41bbe9da11442291ac4eefc15b4
refs/heads/master: 1aa8fab2acf1cb8b341131b726773fcff0abc707
27 changes: 20 additions & 7 deletions trunk/drivers/scsi/scsi_scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1642,7 +1642,7 @@ static void scsi_sysfs_add_devices(struct Scsi_Host *shost)
* that other asynchronous scans started after this one won't affect the
* ordering of the discovered devices.
*/
struct async_scan_data *scsi_prep_async_scan(struct Scsi_Host *shost)
static struct async_scan_data *scsi_prep_async_scan(struct Scsi_Host *shost)
{
struct async_scan_data *data;

Expand Down Expand Up @@ -1686,7 +1686,7 @@ struct async_scan_data *scsi_prep_async_scan(struct Scsi_Host *shost)
* This function announces all the devices it has found to the rest
* of the system.
*/
void scsi_finish_async_scan(struct async_scan_data *data)
static void scsi_finish_async_scan(struct async_scan_data *data)
{
struct Scsi_Host *shost;

Expand Down Expand Up @@ -1719,12 +1719,25 @@ void scsi_finish_async_scan(struct async_scan_data *data)
kfree(data);
}

static int do_scan_async(void *_data)
static void do_scsi_scan_host(struct Scsi_Host *shost)
{
struct async_scan_data *data = _data;
scsi_scan_host_selected(data->shost, SCAN_WILD_CARD, SCAN_WILD_CARD,
if (shost->hostt->scan_finished) {
unsigned long start = jiffies;
if (shost->hostt->scan_start)
shost->hostt->scan_start(shost);

while (!shost->hostt->scan_finished(shost, jiffies - start))
msleep(10);
} else {
scsi_scan_host_selected(shost, SCAN_WILD_CARD, SCAN_WILD_CARD,
SCAN_WILD_CARD, 0);
}
}

static int do_scan_async(void *_data)
{
struct async_scan_data *data = _data;
do_scsi_scan_host(data->shost);
scsi_finish_async_scan(data);
return 0;
}
Expand All @@ -1742,10 +1755,10 @@ void scsi_scan_host(struct Scsi_Host *shost)

data = scsi_prep_async_scan(shost);
if (!data) {
scsi_scan_host_selected(shost, SCAN_WILD_CARD, SCAN_WILD_CARD,
SCAN_WILD_CARD, 0);
do_scsi_scan_host(shost);
return;
}

kthread_run(do_scan_async, data, "scsi_scan_%d", shost->host_no);
}
EXPORT_SYMBOL(scsi_scan_host);
Expand Down
18 changes: 18 additions & 0 deletions trunk/include/scsi/scsi_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,24 @@ struct scsi_host_template {
*/
void (* target_destroy)(struct scsi_target *);

/*
* If a host has the ability to discover targets on its own instead
* of scanning the entire bus, it can fill in this function and
* call scsi_scan_host(). This function will be called periodically
* until it returns 1 with the scsi_host and the elapsed time of
* the scan in jiffies.
*
* Status: OPTIONAL
*/
int (* scan_finished)(struct Scsi_Host *, unsigned long);

/*
* If the host wants to be called before the scan starts, but
* after the midlayer has set up ready for the scan, it can fill
* in this function.
*/
void (* scan_start)(struct Scsi_Host *);

/*
* fill in this function to allow the queue depth of this host
* to be changeable (on a per device basis). returns either
Expand Down

0 comments on commit 7fd3588

Please sign in to comment.