[libata] remove SCSI host lock and serial number usage from ata_scsi_queuecmd

cmd->serial_number is never tested in any path we reach; therefore we may
remove the call to scsi_cmd_get_serial() inside DEF_SCSI_QCMD, the SCSI
host_lock acquisition surrounding it, and our own SCSI host_lock
unlock+relock cycle.

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
This commit is contained in:
Jeff Garzik 2010-11-17 12:03:58 -05:00 committed by Jeff Garzik
parent d33fdee4d0
commit 23e701e620

View file

@ -3166,8 +3166,8 @@ static inline int __ata_scsi_queuecmd(struct scsi_cmnd *scmd,
/** /**
* ata_scsi_queuecmd - Issue SCSI cdb to libata-managed device * ata_scsi_queuecmd - Issue SCSI cdb to libata-managed device
* @shost: SCSI host of command to be sent
* @cmd: SCSI command to be sent * @cmd: SCSI command to be sent
* @done: Completion function, called when command is complete
* *
* In some cases, this function translates SCSI commands into * In some cases, this function translates SCSI commands into
* ATA taskfiles, and queues the taskfiles to be sent to * ATA taskfiles, and queues the taskfiles to be sent to
@ -3177,42 +3177,39 @@ static inline int __ata_scsi_queuecmd(struct scsi_cmnd *scmd,
* ATA and ATAPI devices appearing as SCSI devices. * ATA and ATAPI devices appearing as SCSI devices.
* *
* LOCKING: * LOCKING:
* Releases scsi-layer-held lock, and obtains host lock. * ATA host lock
* *
* RETURNS: * RETURNS:
* Return value from __ata_scsi_queuecmd() if @cmd can be queued, * Return value from __ata_scsi_queuecmd() if @cmd can be queued,
* 0 otherwise. * 0 otherwise.
*/ */
static int ata_scsi_queuecmd_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) int ata_scsi_queuecmd(struct Scsi_Host *shost, struct scsi_cmnd *cmd)
{ {
struct ata_port *ap; struct ata_port *ap;
struct ata_device *dev; struct ata_device *dev;
struct scsi_device *scsidev = cmd->device; struct scsi_device *scsidev = cmd->device;
struct Scsi_Host *shost = scsidev->host;
int rc = 0; int rc = 0;
unsigned long irq_flags;
ap = ata_shost_to_port(shost); ap = ata_shost_to_port(shost);
spin_unlock(shost->host_lock); spin_lock_irqsave(ap->lock, irq_flags);
spin_lock(ap->lock);
ata_scsi_dump_cdb(ap, cmd); ata_scsi_dump_cdb(ap, cmd);
dev = ata_scsi_find_dev(ap, scsidev); dev = ata_scsi_find_dev(ap, scsidev);
if (likely(dev)) if (likely(dev))
rc = __ata_scsi_queuecmd(cmd, done, dev); rc = __ata_scsi_queuecmd(cmd, cmd->scsi_done, dev);
else { else {
cmd->result = (DID_BAD_TARGET << 16); cmd->result = (DID_BAD_TARGET << 16);
done(cmd); cmd->scsi_done(cmd);
} }
spin_unlock(ap->lock); spin_unlock_irqrestore(ap->lock, irq_flags);
spin_lock(shost->host_lock);
return rc; return rc;
} }
DEF_SCSI_QCMD(ata_scsi_queuecmd)
/** /**
* ata_scsi_simulate - simulate SCSI command on ATA device * ata_scsi_simulate - simulate SCSI command on ATA device
* @dev: the target device * @dev: the target device