Commit 9c0a5002 authored by Li Dongyang's avatar Li Dongyang Committed by Martin K. Petersen

scsi: ses: don't ask for diagnostic pages repeatedly during probe

We are testing if there is a match with the ses device in a loop by
calling ses_match_to_enclosure(), which will issue scsi receive
diagnostics commands to the ses device for every device on the same
host.  On one of our boxes with 840 disks, it takes a long time to load
the driver:

[root@g1b-oss06 ~]# time modprobe ses

real	40m48.247s
user	0m0.001s
sys	0m0.196s

With the patch:

[root@g1b-oss06 ~]# time modprobe ses

real	0m17.915s
user	0m0.008s
sys	0m0.053s

Note that we still need to refresh page 10 when we see a new disk to
create the link.
Signed-off-by: default avatarLi Dongyang <dongyang.li@anu.edu.au>
Tested-by: default avatarJason Ozolins <jason.ozolins@hpe.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent d828e5c6
...@@ -615,13 +615,16 @@ static void ses_enclosure_data_process(struct enclosure_device *edev, ...@@ -615,13 +615,16 @@ static void ses_enclosure_data_process(struct enclosure_device *edev,
} }
static void ses_match_to_enclosure(struct enclosure_device *edev, static void ses_match_to_enclosure(struct enclosure_device *edev,
struct scsi_device *sdev) struct scsi_device *sdev,
int refresh)
{ {
struct scsi_device *edev_sdev = to_scsi_device(edev->edev.parent);
struct efd efd = { struct efd efd = {
.addr = 0, .addr = 0,
}; };
ses_enclosure_data_process(edev, to_scsi_device(edev->edev.parent), 0); if (refresh)
ses_enclosure_data_process(edev, edev_sdev, 0);
if (scsi_is_sas_rphy(sdev->sdev_target->dev.parent)) if (scsi_is_sas_rphy(sdev->sdev_target->dev.parent))
efd.addr = sas_get_address(sdev); efd.addr = sas_get_address(sdev);
...@@ -652,7 +655,7 @@ static int ses_intf_add(struct device *cdev, ...@@ -652,7 +655,7 @@ static int ses_intf_add(struct device *cdev,
struct enclosure_device *prev = NULL; struct enclosure_device *prev = NULL;
while ((edev = enclosure_find(&sdev->host->shost_gendev, prev)) != NULL) { while ((edev = enclosure_find(&sdev->host->shost_gendev, prev)) != NULL) {
ses_match_to_enclosure(edev, sdev); ses_match_to_enclosure(edev, sdev, 1);
prev = edev; prev = edev;
} }
return -ENODEV; return -ENODEV;
...@@ -768,7 +771,7 @@ static int ses_intf_add(struct device *cdev, ...@@ -768,7 +771,7 @@ static int ses_intf_add(struct device *cdev,
shost_for_each_device(tmp_sdev, sdev->host) { shost_for_each_device(tmp_sdev, sdev->host) {
if (tmp_sdev->lun != 0 || scsi_device_enclosure(tmp_sdev)) if (tmp_sdev->lun != 0 || scsi_device_enclosure(tmp_sdev))
continue; continue;
ses_match_to_enclosure(edev, tmp_sdev); ses_match_to_enclosure(edev, tmp_sdev, 0);
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment