libata: improve device scan
PATCH 1/1 libata: improve device scan
The attached patch changes libata device scanning from using the legacy "bang at the door" method of probing devices, to one that calls scsi_scan_target() for each target (ATA device) that the libata transport layer found.
Completely untested, feedback welcome. This should improve the speed of SATA probing a tad, and certainly makes it quite a bit less ugly.
This might get moved, eventually, into an ATA transport class, depending on how things shape up in the future.
Jeff
drivers/scsi/libata-core.c +1 -1
@@ -4113,7 +4113,7 @@ int ata_device_add(struct ata_probe_entfor (i =0 ; i < count; i++) {struct ata_port *ap = host_set->ports[i]; -scsi_scan_host (ap->host); +ata_scsi_scan_host (ap); }dev_set_drvdata (dev, host_set);
drivers/scsi/libata-scsi.c +12 -0
@@ -1678,3 +1678,15 @@ void ata_scsi_simulate(u16 *id, } } +void ata_scsi_scan_host (struct ata_port *ap) +{ +unsigned int i; + +if (ap->flags &ATA_FLAG_PORT_DISABLED ) +return ; + +for (i =0 ; i <ATA_MAX_DEVICES ; i++) +if (ata_dev_present (&ap->device[i])) +scsi_scan_target (&ap->host->shost_gendev,0 , i, ~0 ,0 ); +} +
drivers/scsi/libata.h +1 -0
@@ -51,6 +51,7 @@ extern void swap_buf_le16(u16 *buf, unsi/* libata-scsi.c */ +extern void ata_scsi_scan_host (struct ata_port *ap);extern void ata_to_sense_error (struct ata_queued_cmd *qc,u8 drv_stat);extern int ata_scsi_error (struct Scsi_Host *host); extern unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf,