Re: [PATCH 04/84] ata: Call scsi_done() directly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 9/18/21 09:04, Bart Van Assche wrote:
> Conditional statements are faster than indirect calls. Hence call
> scsi_done() directly.
> 
> Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx>
> ---
>  drivers/ata/libata-sata.c |  2 +-
>  drivers/ata/libata-scsi.c | 14 +++++++-------
>  2 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/ata/libata-sata.c b/drivers/ata/libata-sata.c
> index 8f3ff830ab0c..60418d872c12 100644
> --- a/drivers/ata/libata-sata.c
> +++ b/drivers/ata/libata-sata.c
> @@ -1258,7 +1258,7 @@ int ata_sas_queuecmd(struct scsi_cmnd *cmd, struct ata_port *ap)
>  		rc = __ata_scsi_queuecmd(cmd, ap->link.device);
>  	else {
>  		cmd->result = (DID_BAD_TARGET << 16);
> -		cmd->scsi_done(cmd);
> +		scsi_done(cmd);
>  	}
>  	return rc;
>  }
> diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
> index 1fb4611f7eeb..4afe1abc4709 100644
> --- a/drivers/ata/libata-scsi.c
> +++ b/drivers/ata/libata-scsi.c
> @@ -634,7 +634,7 @@ static struct ata_queued_cmd *ata_scsi_qc_new(struct ata_device *dev,
>  	qc = ata_qc_new_init(dev, scsi_cmd_to_rq(cmd)->tag);
>  	if (qc) {
>  		qc->scsicmd = cmd;
> -		qc->scsidone = cmd->scsi_done;
> +		qc->scsidone = scsi_done;
>  
>  		qc->sg = scsi_sglist(cmd);
>  		qc->n_elem = scsi_sg_count(cmd);
> @@ -643,7 +643,7 @@ static struct ata_queued_cmd *ata_scsi_qc_new(struct ata_device *dev,
>  			qc->flags |= ATA_QCFLAG_QUIET;
>  	} else {
>  		cmd->result = (DID_OK << 16) | SAM_STAT_TASK_SET_FULL;
> -		cmd->scsi_done(cmd);
> +		scsi_done(cmd);
>  	}
>  
>  	return qc;
> @@ -1738,14 +1738,14 @@ static int ata_scsi_translate(struct ata_device *dev, struct scsi_cmnd *cmd,
>  
>  early_finish:
>  	ata_qc_free(qc);
> -	cmd->scsi_done(cmd);
> +	scsi_done(cmd);
>  	DPRINTK("EXIT - early finish (good or error)\n");
>  	return 0;
>  
>  err_did:
>  	ata_qc_free(qc);
>  	cmd->result = (DID_ERROR << 16);
> -	cmd->scsi_done(cmd);
> +	scsi_done(cmd);
>  err_mem:
>  	DPRINTK("EXIT - internal\n");
>  	return 0;
> @@ -4018,7 +4018,7 @@ int __ata_scsi_queuecmd(struct scsi_cmnd *scmd, struct ata_device *dev)
>  	DPRINTK("bad CDB len=%u, scsi_op=0x%02x, max=%u\n",
>  		scmd->cmd_len, scsi_op, dev->cdb_len);
>  	scmd->result = DID_ERROR << 16;
> -	scmd->scsi_done(scmd);
> +	scsi_done(scmd);
>  	return 0;
>  }
>  
> @@ -4060,7 +4060,7 @@ int ata_scsi_queuecmd(struct Scsi_Host *shost, struct scsi_cmnd *cmd)
>  		rc = __ata_scsi_queuecmd(cmd, dev);
>  	else {
>  		cmd->result = (DID_BAD_TARGET << 16);
> -		cmd->scsi_done(cmd);
> +		scsi_done(cmd);
>  	}
>  
>  	spin_unlock_irqrestore(ap->lock, irq_flags);
> @@ -4188,7 +4188,7 @@ void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd)
>  		break;
>  	}
>  
> -	cmd->scsi_done(cmd);
> +	scsi_done(cmd);
>  }
>  
>  int ata_scsi_add_hosts(struct ata_host *host, struct scsi_host_template *sht)
> 

Acked-by: Damien Le Moal <damien.lemoal@xxxxxxxxxxxxxxxxxx>

-- 
Damien Le Moal
Western Digital Research



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux