Call scsi_done() directly
Bart Van Assche
maintainerv2 cover Call scsi_done() directly
Hi Martin,
This patch series increases IOPS by 5% on my test setup in a single-threaded test with queue depth 1 on top of the scsi_debug driver. Please consider this patch series for kernel v5.16.
Thanks,
Bart.
Changes compared to v1:
- Inserted the SUBMITTED_BY_ prefix in front of the enumeration constants introduced in patch 1.
- Reworked the fas216 patch such that the scsi_done pointer is preserved.
- Moved some SCSI core changes from the start of this series to the end to improve bisectability of this series.
- Added explicit initialization of the new "submitter" member variable instead of relying on implicit initialization.
- Added Reviewed-by/Acked-by tags.
Bart Van Assche (84):
scsi: core: Use a member variable to track the SCSI command submitter
scsi: core: Rename scsi_mq_done() into scsi_done() and export it
ata: Call scsi_done() directly
firewire: sbp2: Call scsi_done() directly
ib_srp: Call scsi_done() directly
message: fusion: Call scsi_done() directly
zfcp_scsi: Call scsi_done() directly
3w-9xxx: Call scsi_done() directly
3w-sas: Call scsi_done() directly
3w-xxxx: Call scsi_done() directly
53c700: Call scsi_done() directly
BusLogic: Call scsi_done() directly
NCR5380: Call scsi_done() directly
a100u2w: Call scsi_done() directly
aacraid: Introduce aac_scsi_done()
aacraid: Call scsi_done() directly
acornscsi: Call scsi_done() directly
advansys: Call scsi_done() directly
aha152x: Call scsi_done() directly
aha1542: Call scsi_done() directly
aic7xxx: Call scsi_done() directly
arcmsr: Call scsi_done() directly
atp870u: Call scsi_done() directly
bfa: Call scsi_done() directly
bnx2fc: Call scsi_done() directly
csiostor: Call scsi_done() directly
cxlflash: Call scsi_done() directly
dc395x: Call scsi_done() directly
dpt_i2o: Call scsi_done() directly
esas2r: Call scsi_done() directly
esp_scsi: Call scsi_done() directly
fas216: Introduce struct fas216_cmd_priv
fas216: Stop using scsi_cmnd.scsi_done
fdomain: Call scsi_done() directly
fnic: Call scsi_done() directly
hpsa: Call scsi_done() directly
hptiop: Call scsi_done() directly
ibmvscsi: Call scsi_done() directly
imm: Call scsi_done() directly
initio: Call scsi_done() directly
ipr: Call scsi_done() directly
ips: Call scsi_done() directly
libfc: Call scsi_done() directly
libiscsi: Call scsi_done() directly
libsas: Call scsi_done() directly
lpfc: Call scsi_done() directly
mac53c94: Call scsi_done() directly
megaraid: Call scsi_done() directly
megaraid: Call scsi_done() directly
mesh: Call scsi_done() directly
mpi3mr: Call scsi_done() directly
mpt3sas: Call scsi_done() directly
mvumi: Call scsi_done() directly
myrb: Call scsi_done() directly
myrs: Call scsi_done() directly
ncr53c8xx: Call scsi_done() directly
nsp32: Call scsi_done() directly
pcmcia: Call scsi_done() directly
pmcraid: Call scsi_done() directly
ppa: Call scsi_done() directly
ps3rom: Call scsi_done() directly
qedf: Call scsi_done() directly
qla1280: Call scsi_done() directly
qla2xxx: Call scsi_done() directly
qla4xxx: Call scsi_done() directly
qlogicfas408: Call scsi_done() directly
qlogicpti: Call scsi_done() directly
scsi_debug: Call scsi_done() directly
smartpqi: Call scsi_done() directly
snic: Call scsi_done() directly
stex: Call scsi_done() directly
storvsc_drv: Call scsi_done() directly
sym53c8xx_2: Call scsi_done() directly
ufs: Call scsi_done() directly
virtio_scsi: Call scsi_done() directly
vmw_pvscsi: Call scsi_done() directly
wd33c93: Call scsi_done() directly
wd719x: Call scsi_done() directly
xen-scsifront: Call scsi_done() directly
staging: rts5208: Call scsi_done() directly
staging: unisys: visorhba: Call scsi_done() directly target/tcm_loop: Call scsi_done() directly
usb: Call scsi_done() directly
scsi: core: Call scsi_done directly
drivers/ata/libata-sata.c | 2 +- drivers/ata/libata-scsi.c | 14 +-- drivers/firewire/sbp2.c | 2 +- drivers/infiniband/ulp/srp/ib_srp.c | 8 +- drivers/message/fusion/mptfc.c | 6 +- drivers/message/fusion/mptsas.c | 2 +- drivers/message/fusion/mptscsih.c | 10 +- drivers/message/fusion/mptspi.c | 4 +- drivers/s390/scsi/zfcp_fsf.c | 2 +- drivers/s390/scsi/zfcp_scsi.c | 4 +- drivers/scsi/3w-9xxx.c | 7 +- drivers/scsi/3w-sas.c | 7 +- drivers/scsi/3w-xxxx.c | 13 +- drivers/scsi/53c700.c | 5 +- drivers/scsi/BusLogic.c | 9 +- drivers/scsi/NCR5380.c | 12 +- drivers/scsi/a100u2w.c | 3 +- drivers/scsi/aacraid/aachba.c | 53 ++++---- drivers/scsi/advansys.c | 3 +- drivers/scsi/aha152x.c | 27 ++-- drivers/scsi/aha1542.c | 10 +- drivers/scsi/aic7xxx/aic79xx_osm.c | 3 +- drivers/scsi/aic7xxx/aic7xxx_osm.c | 3 +- drivers/scsi/arcmsr/arcmsr_hba.c | 17 ++- drivers/scsi/arm/acornscsi.c | 6 +- drivers/scsi/arm/arxescsi.c | 1 + drivers/scsi/arm/cumana_2.c | 1 + drivers/scsi/arm/eesox.c | 1 + drivers/scsi/arm/fas216.c | 8 +- drivers/scsi/arm/fas216.h | 10 ++ drivers/scsi/arm/powertec.c | 2 +- drivers/scsi/atp870u.c | 13 +- drivers/scsi/bfa/bfad_im.c | 8 +- drivers/scsi/bnx2fc/bnx2fc_io.c | 8 +- drivers/scsi/csiostor/csio_scsi.c | 8 +- drivers/scsi/cxlflash/main.c | 6 +- drivers/scsi/dc395x.c | 8 +- drivers/scsi/dpt_i2o.c | 11 +- drivers/scsi/esas2r/esas2r_main.c | 8 +- drivers/scsi/esp_scsi.c | 10 +- drivers/scsi/fdomain.c | 2 +- drivers/scsi/fnic/fnic_scsi.c | 119 ++++++++---------- drivers/scsi/hosts.c | 2 +- drivers/scsi/hpsa.c | 12 +- drivers/scsi/hptiop.c | 7 +- drivers/scsi/ibmvscsi/ibmvfc.c | 8 +- drivers/scsi/imm.c | 3 +- drivers/scsi/initio.c | 4 +- drivers/scsi/ipr.c | 10 +- drivers/scsi/ips.c | 28 ++--- drivers/scsi/libfc/fc_fcp.c | 6 +- drivers/scsi/libiscsi.c | 4 +- drivers/scsi/libsas/sas_scsi_host.c | 4 +- drivers/scsi/lpfc/lpfc_scsi.c | 8 +- drivers/scsi/mac53c94.c | 3 +- drivers/scsi/megaraid.c | 21 ++-- drivers/scsi/megaraid/megaraid_mbox.c | 9 +- drivers/scsi/megaraid/megaraid_sas_base.c | 16 +-- drivers/scsi/megaraid/megaraid_sas_fusion.c | 6 +- drivers/scsi/mesh.c | 16 +-- drivers/scsi/mpi3mr/mpi3mr_os.c | 26 ++-- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 18 +-- drivers/scsi/mvumi.c | 4 +- drivers/scsi/myrb.c | 32 ++--- drivers/scsi/myrs.c | 10 +- drivers/scsi/ncr53c8xx.c | 3 +- drivers/scsi/nsp32.c | 3 +- drivers/scsi/pcmcia/nsp_cs.c | 4 +- drivers/scsi/pcmcia/sym53c500_cs.c | 3 +- drivers/scsi/pmcraid.c | 11 +- drivers/scsi/ppa.c | 3 +- drivers/scsi/ps3rom.c | 5 +- drivers/scsi/qedf/qedf_io.c | 19 +-- drivers/scsi/qla1280.c | 5 +- drivers/scsi/qla2xxx/qla_os.c | 8 +- drivers/scsi/qla4xxx/ql4_os.c | 4 +- drivers/scsi/qlogicfas408.c | 3 +- drivers/scsi/qlogicpti.c | 4 +- drivers/scsi/scsi_debug.c | 8 +- drivers/scsi/scsi_error.c | 18 ++- drivers/scsi/scsi_lib.c | 16 ++- drivers/scsi/scsi_priv.h | 1 + drivers/scsi/smartpqi/smartpqi_init.c | 2 +- drivers/scsi/snic/snic_scsi.c | 33 +++-- drivers/scsi/stex.c | 6 +- drivers/scsi/storvsc_drv.c | 4 +- drivers/scsi/sym53c8xx_2/sym_glue.c | 3 +- drivers/scsi/ufs/ufshcd.c | 6 +- drivers/scsi/virtio_scsi.c | 7 +- drivers/scsi/vmw_pvscsi.c | 7 +- drivers/scsi/wd33c93.c | 14 +-- drivers/scsi/wd719x.c | 4 +- drivers/scsi/xen-scsifront.c | 4 +- drivers/staging/rts5208/rtsx.c | 5 +- .../staging/unisys/visorhba/visorhba_main.c | 14 +-- drivers/target/loopback/tcm_loop.c | 4 +- drivers/usb/storage/scsiglue.c | 1 - drivers/usb/storage/uas.c | 10 +- drivers/usb/storage/usb.c | 4 +- include/scsi/scsi_cmnd.h | 13 +- include/scsi/scsi_host.h | 2 +- 101 files changed, 452 insertions(+), 522 deletions(-)
Bart Van Assche
maintainerPATCH v2 1/84 scsi: core: Use a member variable to track the SCSI command submitter
Conditional statements are faster than indirect calls. Use a member variable to track the SCSI command submitter such that later patches can call scsi_done(scmd) instead of scmd->scsi_done(scmd).
The asymmetric behavior that scsi_send_eh_cmnd() sets the submission context to the SCSI error handler and that it does not restore the submission context to the SCSI core is retained.
--- drivers/scsi/scsi_error.c | 18 +++++++----------- drivers/scsi/scsi_lib.c | 10 ++++++++++ drivers/scsi/scsi_priv.h | 1 + include/scsi/scsi_cmnd.h | 7 +++++++ 4 files changed, 25 insertions(+), 11 deletions(-)
drivers/scsi/scsi_error.c +7 -11
@@ -50,8 +50,6 @@#include <asm/unaligned.h> -static void scsi_eh_done (struct scsi_cmnd *scmd); -/* * These should *probably* be handled by the host itself. * Since it is allowed to sleep, it probably should.
@@ -520,7 +518,8 @@ enum scsi_disposition scsi_check_sense(struct scsi_cmnd *scmd)/* handler does not care. Drop down to default handling */ } -if (scmd->cmnd[0 ] ==TEST_UNIT_READY && scmd->scsi_done != scsi_eh_done) +if (scmd->cmnd[0 ] ==TEST_UNIT_READY && + scmd->submitter !=SUBMITTED_BY_SCSI_ERROR_HANDLER )/* * nasty: for mid-layer issued TURs, we need to return the * actual sense data without any recovery attempt. For eh
@@ -782,7 +781,7 @@ static enum scsi_disposition scsi_eh_completed_normally(struct scsi_cmnd *scmd)* scsi_eh_done - Completion function for error handling. * @scmd: Cmd that is done. */ -static void scsi_eh_done (struct scsi_cmnd *scmd) +void scsi_eh_done (struct scsi_cmnd *scmd) {struct completion *eh_action;
@@ -986,6 +985,7 @@ void scsi_eh_prep_cmnd(struct scsi_cmnd *scmd, struct scsi_eh_save *ses, ses->prot_op = scmd->prot_op; ses->eh_eflags = scmd->eh_eflags; +WARN_ON_ONCE (scmd->submitter !=SUBMITTED_BY_BLOCK_LAYER ); scmd->prot_op =SCSI_PROT_NORMAL ; scmd->eh_eflags =0 ; scmd->cmnd = ses->eh_cmnd;
@@ -1082,7 +1082,7 @@ static enum scsi_disposition scsi_send_eh_cmnd(struct scsi_cmnd *scmd, shost->eh_action = &done;scsi_log_send (scmd); - scmd->scsi_done = scsi_eh_done; + scmd->submitter =SUBMITTED_BY_SCSI_ERROR_HANDLER ;/* * Lock sdev->state_mutex to avoid that scsi_device_quiesce() can
@@ -1109,6 +1109,7 @@ static enum scsi_disposition scsi_send_eh_cmnd(struct scsi_cmnd *scmd,if (rtn) {if (timeleft > stall_for) {scsi_eh_restore_cmnd (scmd, &ses); + timeleft -= stall_for;msleep (jiffies_to_msecs (stall_for)); goto retry;
@@ -2338,11 +2339,6 @@ void scsi_report_device_reset(struct Scsi_Host *shost, int channel, int target) }EXPORT_SYMBOL (scsi_report_device_reset); -static void -scsi_reset_provider_done_command (struct scsi_cmnd *scmd) -{ -} -/** * scsi_ioctl_reset: explicitly reset a host/bus/target/device * @dev: scsi_device to operate on
@@ -2379,7 +2375,7 @@ scsi_ioctl_reset(struct scsi_device *dev, int __user *arg)scsi_init_command (dev, scmd); scmd->cmnd =scsi_req (rq)->cmd; - scmd->scsi_done = scsi_reset_provider_done_command; + scmd->submitter =SUBMITTED_BY_SCSI_RESET_IOCTL ;memset (&scmd->sdb,0 ,sizeof (scmd->sdb)); scmd->cmd_len =0 ;
drivers/scsi/scsi_lib.c +10 -0
@@ -1577,6 +1577,15 @@ static blk_status_t scsi_prepare_cmd(struct request *req)static void scsi_mq_done (struct scsi_cmnd *cmd) { +switch (cmd->submitter) { +case SUBMITTED_BY_BLOCK_LAYER : +break ; +case SUBMITTED_BY_SCSI_ERROR_HANDLER : +return scsi_eh_done (cmd); +case SUBMITTED_BY_SCSI_RESET_IOCTL : +return ; + } +if (unlikely (blk_should_fake_timeout (scsi_cmd_to_rq (cmd)->q)))return ;if (unlikely (test_and_set_bit (SCMD_STATE_COMPLETE , &cmd->state)))
@@ -1683,6 +1692,7 @@ static blk_status_t scsi_queue_rq(struct blk_mq_hw_ctx *hctx,scsi_set_resid (cmd,0 );memset (cmd->sense_buffer,0 ,SCSI_SENSE_BUFFERSIZE ); + cmd->submitter =SUBMITTED_BY_BLOCK_LAYER ; cmd->scsi_done = scsi_mq_done;blk_mq_start_request (req);
drivers/scsi/scsi_priv.h +1 -0
@@ -84,6 +84,7 @@ void scsi_eh_ready_devs(struct Scsi_Host *shost,int scsi_eh_get_sense (struct list_head *work_q,struct list_head *done_q);int scsi_noretry_cmd (struct scsi_cmnd *scmd); +void scsi_eh_done (struct scsi_cmnd *scmd);/* scsi_lib.c */ extern int scsi_maybe_unblock_host (struct scsi_device *sdev);
include/scsi/scsi_cmnd.h +7 -0
@@ -64,6 +64,12 @@ struct scsi_pointer {#define SCMD_STATE_COMPLETE 0#define SCMD_STATE_INFLIGHT 1 +enum scsi_cmnd_submitter { +SUBMITTED_BY_BLOCK_LAYER =0 , +SUBMITTED_BY_SCSI_ERROR_HANDLER =1 , +SUBMITTED_BY_SCSI_RESET_IOCTL =2 , +} __packed; +struct scsi_cmnd {struct scsi_request req;struct scsi_device *device;
@@ -89,6 +95,7 @@ struct scsi_cmnd {unsigned char prot_op;unsigned char prot_type;unsigned char prot_flags; +enum scsi_cmnd_submitter submitter;unsigned short cmd_len;enum dma_data_direction sc_data_direction;
Re: [PATCH v2 01/84] scsi: core: Use a member variable to track the SCSI command submitter
Hey Bart,
Quoted 12 lines · Bart Van Assche
Conditional statements are faster than indirect calls. Use a member variable to track the SCSI command submitter such that later patches can call
scsi_done(scmd)instead ofscmd->scsi_done(scmd).The asymmetric behavior that
scsi_send_eh_cmnd()sets the submission context to the SCSI error handler and that it does not restore the submission context to the SCSI core is retained.Cc Hannes Reinecke <[email protected]>Cc Ming Lei <[email protected]>Cc Christoph Hellwig <[email protected]>Signed-off-by Bart Van Assche <[email protected]>
Quoted 7 lines
--- drivers/scsi/scsi_error.c | 18 +++++++----------- drivers/scsi/scsi_lib.c | 10 ++++++++++ drivers/scsi/scsi_priv.h | 1 + include/scsi/scsi_cmnd.h | 7 +++++++ 4 files changed, 25 insertions(+), 11 deletions(-)
I think its good!
Signature · 4 lines
Best Regards, Benjamin Block / Linux on IBM Z Kernel Development / IBM Systems IBM Deutschland Research & Development GmbH / https://www.ibm.com/privacy Vorsitz. AufsR.: Gregor Pillen / Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen / Registergericht: AmtsG Stuttgart, HRB 243294
Re: [PATCH v2 01/84] scsi: core: Use a member variable to track the SCSI command submitter
In reply to Bart Van AsscheQuoted 17 lines · Bart Van Assche
Conditional statements are faster than indirect calls. Use a member variable
to track the SCSI command submitter such that later patches can call
scsi_done(scmd)instead ofscmd->scsi_done(scmd).The asymmetric behavior that
scsi_send_eh_cmnd()sets the submissioncontext to the SCSI error handler and that it does not restore the
submission context to the SCSI core is retained.
Quoted 7 lines
Cc Hannes Reinecke <[email protected]>Cc Ming Lei <[email protected]>Cc Christoph Hellwig <[email protected]>Signed-off-by Bart Van Assche <[email protected]>
Bart Van Assche
maintainerPATCH v2 2/84 scsi: core: Rename scsi_mq_done() into scsi_done() and export it
In reply to Bart Van AsscheSince the removal of the legacy block layer there is only one completion function left in the SCSI core, namely scsi_mq_done(). Rename it into scsi_done(). Export that function to allow SCSI LLDs to call it directly.
--- drivers/scsi/scsi_lib.c | 5 +++-- include/scsi/scsi_cmnd.h | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-)
drivers/scsi/scsi_lib.c +3 -2
@@ -1575,7 +1575,7 @@ static blk_status_t scsi_prepare_cmd(struct request *req)return scsi_cmd_to_driver (cmd)->init_command (cmd); } -static void scsi_mq_done (struct scsi_cmnd *cmd) +void scsi_done (struct scsi_cmnd *cmd) {switch (cmd->submitter) {case SUBMITTED_BY_BLOCK_LAYER :
@@ -1593,6 +1593,7 @@ static void scsi_mq_done(struct scsi_cmnd *cmd)trace_scsi_dispatch_cmd_done (cmd);blk_mq_complete_request (scsi_cmd_to_rq (cmd)); } +EXPORT_SYMBOL (scsi_done);static void scsi_mq_put_budget (struct request_queue *q,int budget_token) {
@@ -1693,7 +1694,7 @@ static blk_status_t scsi_queue_rq(struct blk_mq_hw_ctx *hctx,scsi_set_resid (cmd,0 );memset (cmd->sense_buffer,0 ,SCSI_SENSE_BUFFERSIZE ); cmd->submitter =SUBMITTED_BY_BLOCK_LAYER ; - cmd->scsi_done = scsi_mq_done; + cmd->scsi_done = scsi_done;blk_mq_start_request (req); reason =scsi_dispatch_cmd (cmd);
include/scsi/scsi_cmnd.h +2 -0
@@ -171,6 +171,8 @@ static inline struct scsi_driver *scsi_cmd_to_driver(struct scsi_cmnd *cmd)return *(struct scsi_driver **)rq->rq_disk->private_data; } +void scsi_done (struct scsi_cmnd *cmd); +extern void scsi_finish_command (struct scsi_cmnd *cmd); extern void *scsi_kmap_atomic_sg(struct scatterlist *sg, int sg_count,
Re: [PATCH v2 02/84] scsi: core: Rename scsi_mq_done() into scsi_done() and export it
Quoted 5 lines · Bart Van Assche
Since the removal of the legacy block layer there is only one completion
function left in the SCSI core, namely
scsi_mq_done(). Rename it into
Quoted 8 lines
scsi_done(). Export that function to allow SCSI LLDs to call it directly.Reviewed-by Benjamin Block <[email protected]>Signed-off-by Bart Van Assche <[email protected]>
Bart Van Assche
maintainerPATCH v2 3/84 ata: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/ata/libata-sata.c | 2 +- drivers/ata/libata-scsi.c | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-)
drivers/ata/libata-sata.c +1 -1
@@ -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; }
drivers/ata/libata-scsi.c +7 -7
@@ -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)
Bart Van Assche
maintainerPATCH v2 4/84 firewire: sbp2: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/firewire/sbp2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firewire/sbp2.c +1 -1
@@ -1375,7 +1375,7 @@ static void complete_command_orb(struct sbp2_orb *base_orb,sbp2_unmap_scatterlist (device->card->device, orb); orb->cmd->result = result; - orb->cmd->scsi_done (orb->cmd); +scsi_done (orb->cmd); } static int sbp2_map_scatterlist(struct sbp2_command_orb *orb,
Bart Van Assche
maintainerPATCH v2 5/84 ib_srp: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/infiniband/ulp/srp/ib_srp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/infiniband/ulp/srp/ib_srp.c +4 -4
@@ -1266,7 +1266,7 @@ static void srp_finish_req(struct srp_rdma_ch *ch, struct srp_request *req,if (scmnd) {srp_free_req (ch, req, scmnd,0 ); scmnd->result = result; - scmnd->scsi_done (scmnd); +scsi_done (scmnd); } }
@@ -1987,7 +1987,7 @@ static void srp_process_rsp(struct srp_rdma_ch *ch, struct srp_rsp *rsp)srp_free_req (ch, req, scmnd,be32_to_cpu (rsp->req_lim_delta)); - scmnd->scsi_done (scmnd); +scsi_done (scmnd); } }
@@ -2239,7 +2239,7 @@ static int srp_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd) err:if (scmnd->result) { - scmnd->scsi_done (scmnd); +scsi_done (scmnd); ret =0 ; }else { ret =SCSI_MLQUEUE_HOST_BUSY ;
@@ -2811,7 +2811,7 @@ static int srp_abort(struct scsi_cmnd *scmnd)if (ret ==SUCCESS ) {srp_free_req (ch, req, scmnd,0 ); scmnd->result =DID_ABORT <<16 ; - scmnd->scsi_done (scmnd); +scsi_done (scmnd); }return ret;
Bart Van Assche
maintainerPATCH v2 6/84 message: fusion: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/message/fusion/mptfc.c | 6 +++--- drivers/message/fusion/mptsas.c | 2 +- drivers/message/fusion/mptscsih.c | 10 +++++----- drivers/message/fusion/mptspi.c | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-)
drivers/message/fusion/mptfc.c +3 -3
@@ -649,14 +649,14 @@ mptfc_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *SCpnt)if (!vdevice || !vdevice->vtarget) { SCpnt->result =DID_NO_CONNECT <<16 ; - SCpnt->scsi_done (SCpnt); +scsi_done (SCpnt);return 0 ; } err =fc_remote_port_chkready (rport);if (unlikely (err)) { SCpnt->result = err; - SCpnt->scsi_done (SCpnt); +scsi_done (SCpnt);return 0 ; }
@@ -664,7 +664,7 @@ mptfc_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *SCpnt) ri = *((struct mptfc_rport_info **)rport->dd_data);if (unlikely (!ri)) { SCpnt->result =DID_IMM_RETRY <<16 ; - SCpnt->scsi_done (SCpnt); +scsi_done (SCpnt);return 0 ; }
drivers/message/fusion/mptsas.c +1 -1
@@ -1929,7 +1929,7 @@ mptsas_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *SCpnt)if (!vdevice || !vdevice->vtarget || vdevice->vtarget->deleted) { SCpnt->result =DID_NO_CONNECT <<16 ; - SCpnt->scsi_done (SCpnt); +scsi_done (SCpnt);return 0 ; }
drivers/message/fusion/mptscsih.c +5 -5
@@ -1009,7 +1009,7 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)/* Unmap the DMA buffers, if any. */ scsi_dma_unmap (sc); - sc->scsi_done (sc);/* Issue the command callback */ +scsi_done (sc);/* Issue the command callback */ /* Free Chain buffers */ mptscsih_freeChainBuffers (ioc, req_idx);
@@ -1054,7 +1054,7 @@ mptscsih_flush_running_cmds(MPT_SCSI_HOST *hd)dtmprintk (ioc,sdev_printk (KERN_INFO , sc->device, MYIOC_s_FMT"completing cmds: fw_channel %d, fw_id %d, sc=%p, mf = %p, " "idx=%x\n" , ioc->name, channel, id, sc, mf, ii)); - sc->scsi_done (sc); +scsi_done (sc); } }EXPORT_SYMBOL (mptscsih_flush_running_cmds);
@@ -1118,7 +1118,7 @@ mptscsih_search_running_cmds(MPT_SCSI_HOST *hd, VirtDevice *vdevice)"fw_id %d, sc=%p, mf = %p, idx=%x\n" , ioc->name, vdevice->vtarget->channel, vdevice->vtarget->id, sc, mf, ii)); - sc->scsi_done (sc); +scsi_done (sc);spin_lock_irqsave (&ioc->scsi_lookup_lock, flags); } }
@@ -1693,7 +1693,7 @@ mptscsih_abort(struct scsi_cmnd * SCpnt)*/ if ((hd =shost_priv (SCpnt->device->host)) ==NULL ) { SCpnt->result =DID_RESET <<16 ; - SCpnt->scsi_done (SCpnt); +scsi_done (SCpnt); printk(KERN_ERR MYNAM ": task abort: " "can't locate host! (sc=%p)\n", SCpnt);return FAILED ;
@@ -1710,7 +1710,7 @@ mptscsih_abort(struct scsi_cmnd * SCpnt)"task abort: device has been deleted (sc=%p)\n" , ioc->name, SCpnt)); SCpnt->result =DID_NO_CONNECT <<16 ; - SCpnt->scsi_done (SCpnt); +scsi_done (SCpnt); retval =SUCCESS ; goto out; }
drivers/message/fusion/mptspi.c +2 -2
@@ -782,14 +782,14 @@ mptspi_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *SCpnt)if (!vdevice || !vdevice->vtarget) { SCpnt->result =DID_NO_CONNECT <<16 ; - SCpnt->scsi_done (SCpnt); +scsi_done (SCpnt);return 0 ; }if (SCpnt->device->channel ==1 &&mptscsih_is_phys_disk (ioc,0 , SCpnt->device->id) ==0 ) { SCpnt->result =DID_NO_CONNECT <<16 ; - SCpnt->scsi_done (SCpnt); +scsi_done (SCpnt);return 0 ; }
Bart Van Assche
maintainerPATCH v2 7/84 zfcp_scsi: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/s390/scsi/zfcp_fsf.c | 2 +- drivers/s390/scsi/zfcp_scsi.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/s390/scsi/zfcp_fsf.c +1 -1
@@ -2501,7 +2501,7 @@ static void zfcp_fsf_fcp_cmnd_handler(struct zfcp_fsf_req *req)zfcp_dbf_scsi_result (scpnt, req); scpnt->host_scribble =NULL ; - (scpnt->scsi_done) (scpnt); +scsi_done (scpnt);/* * We must hold this lock until scsi_done has been called. * Otherwise we may call scsi_done after abort regarding this
drivers/s390/scsi/zfcp_scsi.c +2 -2
@@ -60,7 +60,7 @@ static void zfcp_scsi_command_fail(struct scsi_cmnd *scpnt, int result) {set_host_byte (scpnt, result);zfcp_dbf_scsi_fail_send (scpnt); - scpnt->scsi_done (scpnt); +scsi_done (scpnt); } static
@@ -78,7 +78,7 @@ int zfcp_scsi_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scpnt)if (unlikely (scsi_result)) { scpnt->result = scsi_result;zfcp_dbf_scsi_fail_send (scpnt); - scpnt->scsi_done (scpnt); +scsi_done (scpnt);return 0 ; }
Bart Van Assche
maintainerPATCH v2 8/84 3w-9xxx: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/3w-9xxx.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/scsi/3w-9xxx.c +2 -5
@@ -1352,7 +1352,7 @@ static irqreturn_t twa_interrupt(int irq, void *dev_instance)/* Now complete the io */ if (twa_command_mapped (cmd))scsi_dma_unmap (cmd); - cmd->scsi_done (cmd); +scsi_done (cmd); tw_dev->state[request_id] =TW_S_COMPLETED ;twa_free_request_id (tw_dev, request_id); tw_dev->posted_request_count--;
@@ -1596,7 +1596,7 @@ static int twa_reset_device_extension(TW_Device_Extension *tw_dev) cmd->result = (DID_RESET <<16 );if (twa_command_mapped (cmd))scsi_dma_unmap (cmd); - cmd->scsi_done (cmd); +scsi_done (cmd); } } }
@@ -1763,9 +1763,6 @@ static int twa_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_ goto out; } -/* Save done function into scsi_cmnd struct */ - SCpnt->scsi_done = done; -/* Get a free request id */ twa_get_request_id (tw_dev, &request_id);
Bart Van Assche
maintainerPATCH v2 9/84 3w-sas: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/3w-sas.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/scsi/3w-sas.c +2 -5
@@ -1216,7 +1216,7 @@ static irqreturn_t twl_interrupt(int irq, void *dev_instance)/* Now complete the io */ scsi_dma_unmap (cmd); - cmd->scsi_done (cmd); +scsi_done (cmd); tw_dev->state[request_id] =TW_S_COMPLETED ;twl_free_request_id (tw_dev, request_id); tw_dev->posted_request_count--;
@@ -1369,7 +1369,7 @@ static int twl_reset_device_extension(TW_Device_Extension *tw_dev, int ioctl_resif (cmd) { cmd->result = (DID_RESET <<16 );scsi_dma_unmap (cmd); - cmd->scsi_done (cmd); +scsi_done (cmd); } } }
@@ -1461,9 +1461,6 @@ static int twl_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_ goto out; } -/* Save done function into scsi_cmnd struct */ - SCpnt->scsi_done = done; -/* Get a free request id */ twl_get_request_id (tw_dev, &request_id);
Bart Van Assche
maintainerPATCH v2 10/84 3w-xxxx: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/3w-xxxx.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
drivers/scsi/3w-xxxx.c +5 -8
@@ -1160,7 +1160,7 @@ static int tw_setfeature(TW_Device_Extension *tw_dev, int parm, int param_size, tw_dev->state[request_id] =TW_S_COMPLETED ;tw_state_request_finish (tw_dev, request_id); tw_dev->srb[request_id]->result = (DID_OK <<16 ); - tw_dev->srb[request_id]->scsi_done (tw_dev->srb[request_id]); +scsi_done (tw_dev->srb[request_id]); } command_packet->byte8.param.sgl[0 ].address = param_value; command_packet->byte8.param.sgl[0 ].length =sizeof (TW_Sector);
@@ -1305,7 +1305,7 @@ static int tw_reset_device_extension(TW_Device_Extension *tw_dev)if (srb !=NULL ) { srb->result = (DID_RESET <<16 );scsi_dma_unmap (srb); - srb->scsi_done (srb); +scsi_done (srb); } } }
@@ -1505,7 +1505,7 @@ static int tw_scsiop_mode_sense(TW_Device_Extension *tw_dev, int request_id) tw_dev->state[request_id] =TW_S_COMPLETED ;tw_state_request_finish (tw_dev, request_id); tw_dev->srb[request_id]->result = (DID_OK <<16 ); - tw_dev->srb[request_id]->scsi_done (tw_dev->srb[request_id]); +scsi_done (tw_dev->srb[request_id]);return 0 ; }
@@ -1796,7 +1796,7 @@ static int tw_scsiop_request_sense(TW_Device_Extension *tw_dev, int request_id)/* If we got a request_sense, we probably want a reset, return error */ tw_dev->srb[request_id]->result = (DID_ERROR <<16 ); - tw_dev->srb[request_id]->scsi_done (tw_dev->srb[request_id]); +scsi_done (tw_dev->srb[request_id]);return 0 ; }/* End tw_scsiop_request_sense() */
@@ -1929,9 +1929,6 @@ static int tw_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cif (test_bit (TW_IN_RESET , &tw_dev->flags))return SCSI_MLQUEUE_HOST_BUSY ; -/* Save done function into struct scsi_cmnd */ - SCpnt->scsi_done = done; -/* Queue the command and get a request id */ tw_state_request_start (tw_dev, &request_id);
@@ -2165,7 +2162,7 @@ static irqreturn_t tw_interrupt(int irq, void *dev_instance)/* Now complete the io */ if ((error !=TW_ISR_DONT_COMPLETE )) {scsi_dma_unmap (tw_dev->srb[request_id]); - tw_dev->srb[request_id]->scsi_done (tw_dev->srb[request_id]); +scsi_done (tw_dev->srb[request_id]); tw_dev->state[request_id] =TW_S_COMPLETED ;tw_state_request_finish (tw_dev, request_id); tw_dev->posted_request_count--;
Bart Van Assche
maintainerPATCH v2 11/84 53c700: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/53c700.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/scsi/53c700.c +2 -3
@@ -634,7 +634,7 @@ NCR_700_scsi_done(struct NCR_700_Host_Parameters *hostdata, SCp->host_scribble =NULL ; SCp->result = result; - SCp->scsi_done (SCp); +scsi_done (SCp); }else {printk (KERN_ERR "53c700: SCSI DONE HAS NULL SCp\n" ); }
@@ -1571,7 +1571,7 @@ NCR_700_intr(int irq, void *dev_id)* deadlock on the * hostdata->state_lock */ SCp->result =DID_RESET <<16 ; - SCp->scsi_done (SCp); +scsi_done (SCp); }mdelay (25 );NCR_700_chip_setup (host);
@@ -1792,7 +1792,6 @@ NCR_700_queuecommand_lck(struct scsi_cmnd *SCp, void (*done)(struct scsi_cmnd *) slot->cmnd = SCp; - SCp->scsi_done = done; SCp->host_scribble = (unsigned char *)slot; SCp->SCp.ptr =NULL ; SCp->SCp.buffer =NULL ;
Bart Van Assche
maintainerPATCH v2 12/84 BusLogic: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/BusLogic.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/scsi/BusLogic.c +4 -5
@@ -2624,7 +2624,7 @@ static void blogic_process_ccbs(struct blogic_adapter *adapter) command->reset_chain; command->reset_chain =NULL ; command->result =DID_RESET <<16 ; - command->scsi_done (command); +scsi_done (command); command = nxt_cmd; }#endif
@@ -2641,7 +2641,7 @@ static void blogic_process_ccbs(struct blogic_adapter *adapter)blogic_dealloc_ccb (ccb,1 ); adapter->active_cmds[tgt_id]--; command->result =DID_RESET <<16 ; - command->scsi_done (command); +scsi_done (command); } adapter->bdr_pend[tgt_id] =NULL ; }else {
@@ -2713,7 +2713,7 @@ static void blogic_process_ccbs(struct blogic_adapter *adapter)/* Call the SCSI Command Completion Routine. */ - command->scsi_done (command); +scsi_done (command); } } adapter->processing_ccbs = false;
@@ -3038,7 +3038,6 @@ static int blogic_qcmd_lck(struct scsi_cmnd *command,return SCSI_MLQUEUE_HOST_BUSY ; } ccb->sensedata = sense_buf; - command->scsi_done = comp_cb;if (blogic_multimaster_type (adapter)) {/* Place the CCB in an Outgoing Mailbox. The higher levels
@@ -3060,7 +3059,7 @@ static int blogic_qcmd_lck(struct scsi_cmnd *command,blogic_warn ("Still unable to write Outgoing Mailbox - Host Adapter Dead?\n" , adapter);blogic_dealloc_ccb (ccb,1 ); command->result =DID_ERROR <<16 ; - command->scsi_done (command); +scsi_done (command); } } }else {
Bart Van Assche
maintainerPATCH v2 13/84 NCR5380: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/NCR5380.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/scsi/NCR5380.c +6 -6
@@ -547,7 +547,7 @@ static void complete_cmd(struct Scsi_Host *instance, hostdata->sensing =NULL ; } - cmd->scsi_done (cmd); +scsi_done (cmd); }/**
@@ -573,7 +573,7 @@ static int NCR5380_queue_command(struct Scsi_Host *instance,case WRITE_10 :shost_printk (KERN_DEBUG , instance,"WRITE attempted with NDEBUG_NO_WRITE set\n" ); cmd->result = (DID_ERROR <<16 ); - cmd->scsi_done (cmd); +scsi_done (cmd); return 0; }#endif /* (NDEBUG & NDEBUG_NO_WRITE) */
@@ -960,7 +960,7 @@ static irqreturn_t __maybe_unused NCR5380_intr(int irq, void *dev_id)* hostdata->connected will be set to cmd. * SELECT interrupt will be disabled. * -* If failed (no target) : cmd->scsi_done() will be called, and the +* If failed (no target) : scsi_done() will be called, and the * cmd->result host byte set to DID_BAD_TARGET. */
@@ -2262,7 +2262,7 @@ static int NCR5380_abort(struct scsi_cmnd *cmd)dsprintk (NDEBUG_ABORT , instance,"abort: removed %p from issue queue\n" , cmd); cmd->result =DID_ABORT <<16 ; - cmd->scsi_done (cmd);/* No tag or busy flag to worry about */ +scsi_done (cmd);/* No tag or busy flag to worry about */ goto out; }
@@ -2357,7 +2357,7 @@ static void bus_reset_cleanup(struct Scsi_Host *instance)list_for_each_entry (ncmd, &hostdata->autosense, list) {struct scsi_cmnd *cmd =NCR5380_to_scmd (ncmd); - cmd->scsi_done (cmd); +scsi_done (cmd); }INIT_LIST_HEAD (&hostdata->autosense);
@@ -2400,7 +2400,7 @@ static int NCR5380_host_reset(struct scsi_cmnd *cmd)struct scsi_cmnd *scmd =NCR5380_to_scmd (ncmd); scmd->result =DID_RESET <<16 ; - scmd->scsi_done (scmd); +scsi_done (scmd); }INIT_LIST_HEAD (&hostdata->unissued);
Bart Van Assche
maintainerPATCH v2 14/84 a100u2w: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/a100u2w.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/a100u2w.c +1 -2
@@ -917,7 +917,6 @@ static int inia100_queue_lck(struct scsi_cmnd * cmd, void (*done) (struct scsi_cstruct orc_host *host;/* Point to Host adapter control block */ host = (struct orc_host *) cmd->device->host->hostdata; - cmd->scsi_done = done;/* Get free SCSI control block */ if ((scb =orc_alloc_scb (host)) ==NULL )return SCSI_MLQUEUE_HOST_BUSY ;
@@ -1042,7 +1041,7 @@ static void inia100_scb_handler(struct orc_host *host, struct orc_scb *scb) } cmd->result = scb->tastat | (scb->hastat <<16 );scsi_dma_unmap (cmd); - cmd->scsi_done (cmd);/* Notify system DONE */ +scsi_done (cmd);/* Notify system DONE */ orc_release_scb (host, scb);/* Release SCB for current channel */ }
Bart Van Assche
maintainerPATCH v2 15/84 aacraid: Introduce aac_scsi_done()
In reply to Bart Van AsscheThis patch does not change any functionality but makes the next patch in this series easier to read.
--- drivers/scsi/aacraid/aachba.c | 39 ++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 17 deletions(-)
drivers/scsi/aacraid/aachba.c +22 -17
@@ -517,6 +517,11 @@ int aac_get_containers(struct aac_dev *dev)return status; } +static void aac_scsi_done (struct scsi_cmnd *scmd) +{ + scmd->scsi_done (scmd); +} +static void get_container_name_callback (void *context,struct fib * fibptr) {struct aac_get_name_resp * get_name_reply;
@@ -558,7 +563,7 @@ static void get_container_name_callback(void *context, struct fib * fibptr) scsicmd->result =DID_OK <<16 |SAM_STAT_GOOD ;aac_fib_complete (fibptr); - scsicmd->scsi_done (scsicmd); +aac_scsi_done (scsicmd); }/*
@@ -614,7 +619,7 @@ static int aac_probe_container_callback2(struct scsi_cmnd * scsicmd)return aac_scsi_cmd (scsicmd); scsicmd->result =DID_NO_CONNECT <<16 ; - scsicmd->scsi_done (scsicmd); +aac_scsi_done (scsicmd);return 0 ; }
@@ -1094,7 +1099,7 @@ static void get_container_serial_callback(void *context, struct fib * fibptr) scsicmd->result =DID_OK <<16 |SAM_STAT_GOOD ;aac_fib_complete (fibptr); - scsicmd->scsi_done (scsicmd); +aac_scsi_done (scsicmd); }/*
@@ -1197,7 +1202,7 @@ static int aac_bounds_32(struct aac_dev * dev, struct scsi_cmnd * cmd, u64 lba)memcpy (cmd->sense_buffer, &dev->fsa_dev[cid].sense_data,min_t (size_t,sizeof (dev->fsa_dev[cid].sense_data),SCSI_SENSE_BUFFERSIZE )); - cmd->scsi_done (cmd); +aac_scsi_done (cmd);return 1 ; }return 0 ;
@@ -2392,7 +2397,7 @@ static void io_callback(void *context, struct fib * fibptr) }aac_fib_complete (fibptr); - scsicmd->scsi_done (scsicmd); +aac_scsi_done (scsicmd); }static int aac_read (struct scsi_cmnd * scsicmd)
@@ -2463,7 +2468,7 @@ static int aac_read(struct scsi_cmnd * scsicmd)memcpy (scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data,min_t (size_t,sizeof (dev->fsa_dev[cid].sense_data),SCSI_SENSE_BUFFERSIZE )); - scsicmd->scsi_done (scsicmd); +aac_scsi_done (scsicmd);return 0 ; }
@@ -2489,7 +2494,7 @@ static int aac_read(struct scsi_cmnd * scsicmd)* For some reason, the Fib didn't queue, return QUEUE_FULL */ scsicmd->result =DID_OK <<16 |SAM_STAT_TASK_SET_FULL ; - scsicmd->scsi_done (scsicmd); +aac_scsi_done (scsicmd);aac_fib_complete (cmd_fibcontext);aac_fib_free (cmd_fibcontext);return 0 ;
@@ -2554,7 +2559,7 @@ static int aac_write(struct scsi_cmnd * scsicmd)memcpy (scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data,min_t (size_t,sizeof (dev->fsa_dev[cid].sense_data),SCSI_SENSE_BUFFERSIZE )); - scsicmd->scsi_done (scsicmd); +aac_scsi_done (scsicmd);return 0 ; }
@@ -2580,7 +2585,7 @@ static int aac_write(struct scsi_cmnd * scsicmd)* For some reason, the Fib didn't queue, return QUEUE_FULL */ scsicmd->result =DID_OK <<16 |SAM_STAT_TASK_SET_FULL ; - scsicmd->scsi_done (scsicmd); +aac_scsi_done (scsicmd);aac_fib_complete (cmd_fibcontext);aac_fib_free (cmd_fibcontext);
@@ -2621,7 +2626,7 @@ static void synchronize_callback(void *context, struct fib *fibptr)aac_fib_complete (fibptr);aac_fib_free (fibptr); - cmd->scsi_done (cmd); +aac_scsi_done (cmd); }static int aac_synchronize (struct scsi_cmnd *scsicmd)
@@ -2688,7 +2693,7 @@ static void aac_start_stop_callback(void *context, struct fib *fibptr)aac_fib_complete (fibptr);aac_fib_free (fibptr); - scsicmd->scsi_done (scsicmd); +aac_scsi_done (scsicmd); }static int aac_start_stop (struct scsi_cmnd *scsicmd)
@@ -2702,7 +2707,7 @@ static int aac_start_stop(struct scsi_cmnd *scsicmd)if (!(aac->supplement_adapter_info.supported_options2 &AAC_OPTION_POWER_MANAGEMENT )) { scsicmd->result =DID_OK <<16 |SAM_STAT_GOOD ; - scsicmd->scsi_done (scsicmd); +aac_scsi_done (scsicmd);return 0 ; }
@@ -3237,7 +3242,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) scsi_done_ret: - scsicmd->scsi_done (scsicmd); +aac_scsi_done (scsicmd);return 0 ; }
@@ -3546,7 +3551,7 @@ static void aac_srb_callback(void *context, struct fib * fibptr) scsicmd->result |=le32_to_cpu (srbreply->scsi_status);aac_fib_complete (fibptr); - scsicmd->scsi_done (scsicmd); +aac_scsi_done (scsicmd); } static void hba_resp_task_complete(struct aac_dev *dev,
@@ -3686,7 +3691,7 @@ void aac_hba_callback(void *context, struct fib *fibptr)if (fibptr->flags &FIB_CONTEXT_FLAG_NATIVE_HBA_TMF ) scsicmd->SCp.sent_command =1 ;else - scsicmd->scsi_done (scsicmd); +aac_scsi_done (scsicmd); }/**
@@ -3706,7 +3711,7 @@ static int aac_send_srb_fib(struct scsi_cmnd* scsicmd)if (scmd_id (scsicmd) >= dev->maximum_num_physicals || scsicmd->device->lun >7 ) { scsicmd->result =DID_NO_CONNECT <<16 ; - scsicmd->scsi_done (scsicmd); +aac_scsi_done (scsicmd);return 0 ; }
@@ -3747,7 +3752,7 @@ static int aac_send_hba_fib(struct scsi_cmnd *scsicmd)if (scmd_id (scsicmd) >= dev->maximum_num_physicals || scsicmd->device->lun >AAC_MAX_LUN -1 ) { scsicmd->result =DID_NO_CONNECT <<16 ; - scsicmd->scsi_done (scsicmd); +aac_scsi_done (scsicmd);return 0 ; }
Bart Van Assche
maintainerPATCH v2 16/84 aacraid: Call scsi_done() directly
In reply to Bart Van AsscheThe aacraid driver invokes scmd->scsi_done(scmd) for two types of SCSI commands:
* SCSI commands initialized by the SCSI mid-layer.
* SCSI commands initialized by aac_probe_container().
The processing sequence for SCSI commands allocated by aac_probe_container() is as follows:
aac_probe_container()
-> _aac_probe_container(scmd, aac_probe_container_callback1)
-> scmd->SCp.ptr = aac_probe_container_callback1 -> aac_fib_send(..., _aac_probe_container1, scmd)
-> fibptr->callback = _aac_probe_container1
-> fibptr->callback_data = scmdfibptr->callback(scmd)
-> _aac_probe_container1(scmd, fibptr)
[ ... ]
-> _aac_probe_container2(scmd, fibptr)
-> Call scmd->SCp.ptr == aac_probe_container_callback1
-> scmd->device = NULL;The processing sequence for SCSI commands allocated by the SCSI mid-layer if _aac_probe_container() is called is as follows:
aac_queuecommand()
-> aac_scsi_cmd()
-> _aac_probe_container(scmd, aac_probe_container_callback2)
-> scmd->SCp.ptr = aac_probe_container_callback2
-> aac_fib_send(..., _aac_probe_container1, scmd)fibptr->callback(scmd)
-> _aac_probe_container1(scmd, fibptr)
[ ... ]
-> _aac_probe_container2(scmd, fibptr)
-> Call scmd->SCp.ptr == aac_probe_container_callback2
Preserve the existing call sequences by calling scsi_done() for commands submitted by the mid-layer or aac_probe_container_scsi_done() for commands submitted by aac_probe_container().
--- drivers/scsi/aacraid/aachba.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
drivers/scsi/aacraid/aachba.c +11 -5
@@ -223,6 +223,7 @@ static long aac_build_sghba(struct scsi_cmnd *scsicmd, int sg_max, u64 sg_address);static int aac_convert_sgraw2 (struct aac_raw_io2 *rio2,int pages,int nseg,int nseg_new); +static void aac_probe_container_scsi_done (struct scsi_cmnd *scsi_cmnd);static int aac_send_srb_fib (struct scsi_cmnd * scsicmd);static int aac_send_hba_fib (struct scsi_cmnd *scsicmd);#ifdef AAC_DETAILED_STATUS_INFO
@@ -332,7 +333,7 @@ static inline int aac_valid_context(struct scsi_cmnd *scsicmd, struct fib *fibptr) {struct scsi_device *device; -if (unlikely (!scsicmd || !scsicmd->scsi_done)) { +if (unlikely (!scsicmd)) {dprintk ((KERN_WARNING "aac_valid_context: scsi command corrupt\n" ));aac_fib_complete (fibptr);return 0 ;
@@ -519,7 +520,13 @@ int aac_get_containers(struct aac_dev *dev)static void aac_scsi_done (struct scsi_cmnd *scmd) { - scmd->scsi_done (scmd); +if (scmd->device->request_queue) { +/* SCSI command has been submitted by the SCSI mid-layer. */ +scsi_done (scmd); + }else { +/* SCSI command has been submitted by aac_probe_container(). */ +aac_probe_container_scsi_done (scmd); + } }static void get_container_name_callback (void *context,struct fib * fibptr)
@@ -809,8 +816,8 @@ static void aac_probe_container_scsi_done(struct scsi_cmnd *scsi_cmnd)int aac_probe_container (struct aac_dev *dev,int cid) { -struct scsi_cmnd *scsicmd =kmalloc (sizeof (*scsicmd),GFP_KERNEL ); -struct scsi_device *scsidev =kmalloc (sizeof (*scsidev),GFP_KERNEL ); +struct scsi_cmnd *scsicmd =kzalloc (sizeof (*scsicmd),GFP_KERNEL ); +struct scsi_device *scsidev =kzalloc (sizeof (*scsidev),GFP_KERNEL );int status;if (!scsicmd || !scsidev) {
@@ -818,7 +825,6 @@ int aac_probe_container(struct aac_dev *dev, int cid)kfree (scsidev);return -ENOMEM ; } - scsicmd->scsi_done = aac_probe_container_scsi_done; scsicmd->device = scsidev; scsidev->sdev_state =0 ;
Bart Van Assche
maintainerPATCH v2 17/84 acornscsi: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/arm/acornscsi.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/scsi/arm/acornscsi.c +1 -5
@@ -841,13 +841,10 @@ static void acornscsi_done(AS_Host *host, struct scsi_cmnd **SCpntp, } } -if (!SCpnt->scsi_done) -panic ("scsi%d.H: null scsi_done function in acornscsi_done" , host->host->host_no); -clear_bit (SCpnt->device->id *8 + (u8)(SCpnt->device->lun &0x7 ), host->busyluns); - SCpnt->scsi_done (SCpnt); +scsi_done (SCpnt); }else printk ("scsi%d: null command in acornscsi_done" , host->host->host_no);
@@ -2428,7 +2425,6 @@ static int acornscsi_queuecmd_lck(struct scsi_cmnd *SCpnt, }#endif - SCpnt->scsi_done = done; SCpnt->host_scribble =NULL ; SCpnt->result =0 ; SCpnt->SCp.phase = (int )acornscsi_datadirection (SCpnt->cmnd[0 ]);
Bart Van Assche
maintainerPATCH v2 18/84 advansys: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/advansys.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/advansys.c +1 -2
@@ -3592,7 +3592,7 @@ static void asc_scsi_done(struct scsi_cmnd *scp) {scsi_dma_unmap (scp);ASC_STATS (scp->device->host, done); - scp->scsi_done (scp); +scsi_done (scp); }static void AscSetBank (PortAddr iop_base,uchar bank)
@@ -8460,7 +8460,6 @@ advansys_queuecommand_lck(struct scsi_cmnd *scp, void (*done)(struct scsi_cmnd *int asc_res, result =0 ;ASC_STATS (shost, queuecommand); - scp->scsi_done = done; asc_res =asc_execute_scsi_cmnd (scp);
Bart Van Assche
maintainerPATCH v2 19/84 aha152x: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() and reset_done() directly. The changes in this patch are as follows:
- Remove the 'done' argument from aha152x_internal_queue().
- Change ptr->scsi_done(ptr) into aha152x_scsi_done(ptr).
- Inside aha152x_scsi_done(), check the 'resetting' flag of SCp.phase since aha152x_internal_queue() specifies the 'reset_done' function pointer if and only if the third argument has the value 'resetting'.
--- drivers/scsi/aha152x.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-)
drivers/scsi/aha152x.c +17 -10
@@ -905,13 +905,11 @@ static int setup_expected_interrupts(struct Scsi_Host *shpnt)* Queue a command and setup interrupts for a free bus. */ static int aha152x_internal_queue (struct scsi_cmnd *SCpnt, -struct completion *complete, -int phase,void (*done)(struct scsi_cmnd *)) +struct completion *complete,int phase) {struct Scsi_Host *shpnt = SCpnt->device->host;unsigned long flags; - SCpnt->scsi_done = done; SCpnt->SCp.phase = not_issued | phase; SCpnt->SCp.Status =0x1 ;/* Ilegal status by SCSI standard */ SCpnt->SCp.Message =0 ;
@@ -980,7 +978,8 @@ static int aha152x_internal_queue(struct scsi_cmnd *SCpnt,static int aha152x_queue_lck (struct scsi_cmnd *SCpnt,void (*done)(struct scsi_cmnd *)) { -return aha152x_internal_queue (SCpnt,NULL ,0 , done); +WARN_ON_ONCE (done != scsi_done); +return aha152x_internal_queue (SCpnt,NULL ,0 ); }static DEF_SCSI_QCMD (aha152x_queue)
@@ -998,6 +997,14 @@ static void reset_done(struct scsi_cmnd *SCpnt) } } +static void aha152x_scsi_done (struct scsi_cmnd *SCpnt) +{ +if (SCpnt->SCp.phase & resetting) +reset_done (SCpnt); +else +scsi_done (SCpnt); +} +/* * Abort a command *
@@ -1064,7 +1071,7 @@ static int aha152x_device_reset(struct scsi_cmnd * SCpnt) SCpnt->cmd_len =0 ; -aha152x_internal_queue (SCpnt, &done, resetting, reset_done); +aha152x_internal_queue (SCpnt, &done, resetting); timeleft =wait_for_completion_timeout (&done,100 *HZ );if (!timeleft) {
@@ -1439,12 +1446,12 @@ static void busfree_run(struct Scsi_Host *shpnt)scsi_eh_prep_cmnd (ptr, &sc->ses,NULL ,0 , ~0 );DO_UNLOCK (flags); -aha152x_internal_queue (ptr,NULL , check_condition, ptr->scsi_done); +aha152x_internal_queue (ptr,NULL , check_condition);DO_LOCK (flags); } } -if (DONE_SC &&DONE_SC ->scsi_done) { +if (DONE_SC ) {struct scsi_cmnd *ptr =DONE_SC ;DONE_SC =NULL ;
@@ -1453,13 +1460,13 @@ static void busfree_run(struct Scsi_Host *shpnt)if (!HOSTDATA (shpnt)->commands)SETPORT (PORTA ,0 );/* turn led off */ -if (ptr->scsi_done != reset_done) { +if (!(ptr->SCp.phase & resetting)) {kfree (ptr->host_scribble); ptr->host_scribble=NULL ; }DO_UNLOCK (flags); - ptr->scsi_done (ptr); +aha152x_scsi_done (ptr);DO_LOCK (flags); }
@@ -2258,7 +2265,7 @@ static void rsti_run(struct Scsi_Host *shpnt) ptr->host_scribble=NULL ;set_host_byte (ptr,DID_RESET ); - ptr->scsi_done (ptr); +aha152x_scsi_done (ptr); } ptr = next;
Bart Van Assche
maintainerPATCH v2 20/84 aha1542: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/aha1542.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/scsi/aha1542.c +4 -6
@@ -281,7 +281,6 @@ static irqreturn_t aha1542_interrupt(int irq, void *dev_id) {struct Scsi_Host *sh = dev_id;struct aha1542_hostdata *aha1542 =shost_priv (sh); -void (*my_done)(struct scsi_cmnd *) =NULL ;int errstatus, mbi, mbo, mbistatus;int number_serviced;unsigned long flags;
@@ -369,14 +368,13 @@ static irqreturn_t aha1542_interrupt(int irq, void *dev_id) tmp_cmd = aha1542->int_cmds[mbo]; -if (!tmp_cmd || !tmp_cmd->scsi_done) { +if (!tmp_cmd) {spin_unlock_irqrestore (sh->host_lock, flags);shost_printk (KERN_WARNING , sh,"Unexpected interrupt\n" );shost_printk (KERN_WARNING , sh,"tarstat=%x, hastat=%x idlun=%x ccb#=%d\n" , ccb[mbo].tarstat, ccb[mbo].hastat, ccb[mbo].idlun, mbo);return IRQ_HANDLED ; } - my_done = tmp_cmd->scsi_done;aha1542_free_cmd (tmp_cmd);/* * Fetch the sense data, and tuck it away, in the required slot. The
@@ -410,7 +408,7 @@ static irqreturn_t aha1542_interrupt(int irq, void *dev_id) aha1542->int_cmds[mbo] =NULL ;/* This effectively frees up the mailbox slot, as * far as queuecommand is concerned */ -my_done (tmp_cmd); +scsi_done (tmp_cmd); number_serviced++; }; }
@@ -431,7 +429,7 @@ static int aha1542_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *cmd)if (*cmd->cmnd ==REQUEST_SENSE ) {/* Don't do the command - we have the sense data already */ cmd->result =0 ; - cmd->scsi_done (cmd); +scsi_done (cmd);return 0 ; }#ifdef DEBUG
@@ -488,7 +486,7 @@ static int aha1542_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *cmd) aha1542->aha1542_last_mbo_used = mbo;#ifdef DEBUG -shost_printk (KERN_DEBUG , sh,"Sending command (%d %p)..." , mbo, cmd->scsi_done); +shost_printk (KERN_DEBUG , sh,"Sending command (%d)..." , mbo);#endif /* This gets trashed for some reason */
Bart Van Assche
maintainerPATCH v2 21/84 aic7xxx: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/aic7xxx/aic79xx_osm.c | 3 +-- drivers/scsi/aic7xxx/aic7xxx_osm.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/scsi/aic7xxx/aic79xx_osm.c +1 -2
@@ -581,7 +581,6 @@ ahd_linux_queue_lck(struct scsi_cmnd * cmd, void (*scsi_done) (struct scsi_cmnd ahd = *(struct ahd_softc **)cmd->device->host->hostdata; - cmd->scsi_done = scsi_done; cmd->result =CAM_REQ_INPROG <<16 ; rtn =ahd_linux_run_command (ahd, dev, cmd);
@@ -2111,7 +2110,7 @@ ahd_linux_queue_cmd_complete(struct ahd_softc *ahd, struct scsi_cmnd *cmd)ahd_cmd_set_transaction_status (cmd, new_status); - cmd->scsi_done (cmd); +scsi_done (cmd); } static void
drivers/scsi/aic7xxx/aic7xxx_osm.c +1 -2
@@ -530,7 +530,6 @@ ahc_linux_queue_lck(struct scsi_cmnd * cmd, void (*scsi_done) (struct scsi_cmndahc_lock (ahc, &flags);if (ahc->platform_data->qfrozen ==0 ) { - cmd->scsi_done = scsi_done; cmd->result =CAM_REQ_INPROG <<16 ; rtn =ahc_linux_run_command (ahc, dev, cmd); }
@@ -1986,7 +1985,7 @@ ahc_linux_queue_cmd_complete(struct ahc_softc *ahc, struct scsi_cmnd *cmd)ahc_cmd_set_transaction_status (cmd, new_status); } - cmd->scsi_done (cmd); +scsi_done (cmd); } static void
Bart Van Assche
maintainerPATCH v2 22/84 arcmsr: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/arcmsr/arcmsr_hba.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
drivers/scsi/arcmsr/arcmsr_hba.c +8 -9
@@ -1318,7 +1318,7 @@ static void arcmsr_ccb_complete(struct CommandControlBlock *ccb)spin_lock_irqsave (&acb->ccblist_lock, flags);list_add_tail (&ccb->list, &acb->ccb_free_list);spin_unlock_irqrestore (&acb->ccblist_lock, flags); - pcmd->scsi_done (pcmd); +scsi_done (pcmd); }static void arcmsr_report_sense_info (struct CommandControlBlock *ccb)
@@ -1598,7 +1598,7 @@ static void arcmsr_remove_scsi_devices(struct AdapterControlBlock *acb)if (ccb->startdone ==ARCMSR_CCB_START ) { ccb->pcmd->result =DID_NO_CONNECT <<16 ;arcmsr_pci_unmap_dma (ccb); - ccb->pcmd->scsi_done (ccb->pcmd); +scsi_done (ccb->pcmd); } }for (target =0 ; target <ARCMSR_MAX_TARGETID ; target++) {
@@ -3192,7 +3192,7 @@ static void arcmsr_handle_virtual_command(struct AdapterControlBlock *acb,if (cmd->device->lun) { cmd->result = (DID_TIME_OUT <<16 ); - cmd->scsi_done (cmd); +scsi_done (cmd);return ; } inqdata[0 ] =TYPE_PROCESSOR ;
@@ -3216,18 +3216,18 @@ static void arcmsr_handle_virtual_command(struct AdapterControlBlock *acb, sg =scsi_sglist (cmd);kunmap_atomic (buffer - sg->offset); - cmd->scsi_done (cmd); +scsi_done (cmd); }break ;case WRITE_BUFFER :case READ_BUFFER : {if (arcmsr_iop_message_xfer (acb, cmd)) cmd->result = (DID_ERROR <<16 ); - cmd->scsi_done (cmd); +scsi_done (cmd); }break ;default : - cmd->scsi_done (cmd); +scsi_done (cmd); } }
@@ -3241,10 +3241,9 @@ static int arcmsr_queue_command_lck(struct scsi_cmnd *cmd,if (acb->acb_flags &ACB_F_ADAPTER_REMOVED ) { cmd->result = (DID_NO_CONNECT <<16 ); - cmd->scsi_done (cmd); +scsi_done (cmd);return 0 ; } - cmd->scsi_done = done; cmd->host_scribble =NULL ; cmd->result =0 ;if (target ==16 ) {
@@ -3257,7 +3256,7 @@ static int arcmsr_queue_command_lck(struct scsi_cmnd *cmd,return SCSI_MLQUEUE_HOST_BUSY ;if (arcmsr_build_ccb ( acb, ccb, cmd ) ==FAILED ) { cmd->result = (DID_ERROR <<16 ) |SAM_STAT_RESERVATION_CONFLICT ; - cmd->scsi_done (cmd); +scsi_done (cmd);return 0 ; }arcmsr_post_ccb (acb, ccb);
Bart Van Assche
maintainerPATCH v2 23/84 atp870u: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/atp870u.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/scsi/atp870u.c +1 -12
@@ -512,7 +512,7 @@ static irqreturn_t atp870u_intr_handle(int irq, void *dev_id)scsi_dma_unmap (workreq);spin_lock_irqsave (dev->host->host_lock, flags); - (*workreq->scsi_done) (workreq); +scsi_done (workreq);#ifdef ED_DBGP printk ("workreq->scsi_done\n" );#endif
@@ -654,17 +654,6 @@ static int atp870u_queuecommand_lck(struct scsi_cmnd *req_p,return 0 ; } -if (done) { - req_p->scsi_done = done; - }else { -#ifdef ED_DBGP -printk ("atp870u_queuecommand: done can't be NULL\n" ); -#endif - req_p->result =0 ; -done (req_p); -return 0 ; - } -/* * Count new command */
Bart Van Assche
maintainerPATCH v2 24/84 bfa: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/bfa/bfad_im.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/scsi/bfa/bfad_im.c +3 -5
@@ -96,7 +96,7 @@ bfa_cb_ioim_done(void *drv, struct bfad_ioim_s *dio, } } - cmnd->scsi_done (cmnd); +scsi_done (cmnd); }void
@@ -124,7 +124,7 @@ bfa_cb_ioim_good_comp(void *drv, struct bfad_ioim_s *dio) } } - cmnd->scsi_done (cmnd); +scsi_done (cmnd); }void
@@ -226,7 +226,7 @@ bfad_im_abort_handler(struct scsi_cmnd *cmnd) timeout *=2 ; } - cmnd->scsi_done (cmnd); +scsi_done (cmnd);bfa_trc (bfad, hal_io->iotag); BFA_LOG(KERN_INFO, bfad, bfa_log_level, "scsi%d: complete abort 0x%p iotag 0x%x\n",
@@ -1233,8 +1233,6 @@ bfad_im_queuecommand_lck(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmndif (sg_cnt <0 )return SCSI_MLQUEUE_HOST_BUSY ; - cmnd->scsi_done = done; -spin_lock_irqsave (&bfad->bfad_lock, flags);if (!(bfad->bfad_flags &BFAD_HAL_START_DONE )) { printk(KERN_WARNING
Bart Van Assche
maintainerPATCH v2 25/84 bnx2fc: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/bnx2fc/bnx2fc_io.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/bnx2fc/bnx2fc_io.c +4 -4
@@ -205,7 +205,7 @@ static void bnx2fc_scsi_done(struct bnx2fc_cmd *io_req, int err_code) sc_cmd->allowed);scsi_set_resid (sc_cmd,scsi_bufflen (sc_cmd)); sc_cmd->SCp.ptr =NULL ; - sc_cmd->scsi_done (sc_cmd); +scsi_done (sc_cmd); }struct bnx2fc_cmd_mgr *bnx2fc_cmd_mgr_alloc (struct bnx2fc_hba *hba)
@@ -1610,7 +1610,7 @@ void bnx2fc_process_tm_compl(struct bnx2fc_cmd *io_req, } sc_cmd->SCp.ptr =NULL ; - sc_cmd->scsi_done (sc_cmd); +scsi_done (sc_cmd);kref_put (&io_req->refcount, bnx2fc_cmd_release);if (io_req->wait_for_abts_comp) {
@@ -1853,7 +1853,7 @@ int bnx2fc_queuecommand(struct Scsi_Host *host, rval =fc_remote_port_chkready (rport);if (rval) { sc_cmd->result = rval; - sc_cmd->scsi_done (sc_cmd); +scsi_done (sc_cmd);return 0 ; }
@@ -2019,7 +2019,7 @@ void bnx2fc_process_scsi_cmd_compl(struct bnx2fc_cmd *io_req,break ; } sc_cmd->SCp.ptr =NULL ; - sc_cmd->scsi_done (sc_cmd); +scsi_done (sc_cmd);kref_put (&io_req->refcount, bnx2fc_cmd_release); }
Bart Van Assche
maintainerPATCH v2 26/84 csiostor: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/csiostor/csio_scsi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/csiostor/csio_scsi.c +4 -4
@@ -1720,7 +1720,7 @@ csio_scsi_err_handler(struct csio_hw *hw, struct csio_ioreq *req) } cmnd->result = (((host_status) <<16 ) | scsi_status); - cmnd->scsi_done (cmnd); +scsi_done (cmnd);/* Wake up waiting threads */ csio_scsi_cmnd (req) =NULL ;
@@ -1748,7 +1748,7 @@ csio_scsi_cbfn(struct csio_hw *hw, struct csio_ioreq *req) } cmnd->result = (((host_status) <<16 ) | scsi_status); - cmnd->scsi_done (cmnd); +scsi_done (cmnd);csio_scsi_cmnd (req) =NULL ;CSIO_INC_STATS (csio_hw_to_scsim (hw), n_tot_success); }else {
@@ -1876,7 +1876,7 @@ csio_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmnd)return rv; err_done: - cmnd->scsi_done (cmnd); +scsi_done (cmnd);return 0 ; }
@@ -1979,7 +1979,7 @@ csio_eh_abort_handler(struct scsi_cmnd *cmnd)spin_unlock_irq (&hw->lock); cmnd->result = (DID_ERROR <<16 ); - cmnd->scsi_done (cmnd); +scsi_done (cmnd);return FAILED ; }
Bart Van Assche
maintainerPATCH v2 27/84 cxlflash: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/cxlflash/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/cxlflash/main.c +3 -3
@@ -171,7 +171,7 @@ static void cmd_complete(struct afu_cmd *cmd)dev_dbg_ratelimited (dev,"%s:scp=%p result=%08x ioasc=%08x\n" , __func__, scp, scp->result, cmd->sa.ioasc); - scp->scsi_done (scp); +scsi_done (scp); }else if (cmd->cmd_tmf) {spin_lock_irqsave (&cfg->tmf_slock, lock_flags); cfg->tmf_active = false;
@@ -205,7 +205,7 @@ static void flush_pending_cmds(struct hwq *hwq)if (cmd->scp) { scp = cmd->scp; scp->result = (DID_IMM_RETRY <<16 ); - scp->scsi_done (scp); +scsi_done (scp); }else { cmd->cmd_aborted = true;
@@ -601,7 +601,7 @@ static int cxlflash_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *scp)case STATE_FAILTERM :dev_dbg_ratelimited (dev,"%s: device has failed\n" , __func__); scp->result = (DID_NO_CONNECT <<16 ); - scp->scsi_done (scp); +scsi_done (scp); rc =0 ; goto out;default :
Bart Van Assche
maintainerPATCH v2 28/84 dc395x: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/dc395x.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/scsi/dc395x.c +3 -5
@@ -995,8 +995,6 @@ static int dc395x_queue_command_lck(struct scsi_cmnd *cmd, void (*done)(struct s goto complete; } -/* set callback and clear result in the command */ - cmd->scsi_done = done;set_host_byte (cmd,DID_OK );set_status_byte (cmd,SAM_STAT_GOOD );
@@ -3336,7 +3334,7 @@ static void srb_done(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb,dprintkl (KERN_ERR ,"srb_done: ERROR! Completed cmd with tmp_srb\n" ); } - cmd->scsi_done (cmd); +scsi_done (cmd);waiting_process_next (acb); }
@@ -3367,7 +3365,7 @@ static void doing_srb_done(struct AdapterCtlBlk *acb, u8 did_flag,if (force) {/* For new EH, we normally don't need to give commands back, * as they all complete or all time out */ - p->scsi_done (p); +scsi_done (p); } }if (!list_empty (&dcb->srb_going_list))
@@ -3394,7 +3392,7 @@ static void doing_srb_done(struct AdapterCtlBlk *acb, u8 did_flag,if (force) {/* For new EH, we normally don't need to give commands back, * as they all complete or all time out */ - cmd->scsi_done (cmd); +scsi_done (cmd); } }if (!list_empty (&dcb->srb_waiting_list))
Oliver Neukum
maintainerRe: [PATCH v2 28/84] dc395x: Call scsi_done() directly
Quoted 2 lines · Bart Van Assche
Conditional statements are faster than indirect calls. Hence call
scsi_done()directly.
Hi,
as you are doing this to multiple drivers, is there really a need to pass the
the function pointer at all?
Regards
Oliver
Bart Van Assche
maintainerRe: [PATCH v2 28/84] dc395x: Call scsi_done() directly
Quoted 6 lines · Oliver Neukum
Quoted 2 lines · Bart Van Assche
Conditional statements are faster than indirect calls. Hence call
scsi_done()directly.as you are doing this to multiple drivers, is there really a need to pass the the function pointer at all?
Hi Oliver,
Thanks for having taken a look. I think the 'done' argument of the queue_command_lck() functions is already superfluous today. The definition of the DEF_SCSI_QCMD() function is as follows (without this patch series applied):
#define DEF_SCSI_QCMD(func_name) \
int func_name(struct Scsi_Host *shost, struct scsi_cmnd *cmd) \
{ \
unsigned long irq_flags; \
int rc; \
spin_lock_irqsave(shost->host_lock, irq_flags); \
rc = func_name##_lck (cmd, cmd->scsi_done); \
spin_unlock_irqrestore(shost->host_lock, irq_flags); \
return rc; \
}In other words, the 'done' argument can be derived easily from the SCSI command pointer. Do you want me to include a patch in this series that removes the 'done' argument from the queue_command_lck() functions?
Thanks,
Bart.
Oliver Neukum
maintainerRe: [PATCH v2 28/84] dc395x: Call scsi_done() directly
Quoted 6 lines · Bart Van Assche
In other words, the 'done' argument can be derived easily from the SCSI command pointer.
Do you want me to include a patch in this series that removes the 'done' argument from
thequeue_command_lck()functions?
Yes, if we pass a pointer, we should use it. If we should not use it, we should not pass it.
Then the SCSI people can look at a patch and decide that issue.
Regards
Oliver
Bart Van Assche
maintainerRe: [PATCH v2 28/84] dc395x: Call scsi_done() directly
Quoted 11 lines · Oliver Neukum
Quoted 6 lines · Bart Van Assche
In other words, the 'done' argument can be derived easily from the SCSI command pointer.
Do you want me to include a patch in this series that removes the 'done' argument from
thequeue_command_lck()functions?Yes, if we pass a pointer, we should use it. If we should not use it, we should not pass it.
Then the SCSI people can look at a patch and decide that issue.
Hi Oliver,
I will include a patch in the next version of this series that removes the 'done' argument from the queue_command_lck() functions.
Bart.
Bart Van Assche
maintainerPATCH v2 29/84 dpt_i2o: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/dpt_i2o.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/scsi/dpt_i2o.c +4 -7
@@ -421,7 +421,6 @@ static int adpt_queue_lck(struct scsi_cmnd * cmd, void (*done) (struct scsi_cmndadpt_hba * pHba =NULL ;struct adpt_device * pDev =NULL ;/* dpt per device information */ - cmd->scsi_done = done;/* * SCSI REQUEST_SENSE commands will be executed automatically by the * Host Adapter for any errors, so they should not be executed
@@ -431,7 +430,7 @@ static int adpt_queue_lck(struct scsi_cmnd * cmd, void (*done) (struct scsi_cmndif ((cmd->cmnd[0 ] ==REQUEST_SENSE ) && (cmd->sense_buffer[0 ] !=0 )) { cmd->result = (DID_OK <<16 ); - cmd->scsi_done (cmd); +scsi_done (cmd);return 0 ; }
@@ -456,7 +455,7 @@ static int adpt_queue_lck(struct scsi_cmnd * cmd, void (*done) (struct scsi_cmnd// TODO: if any luns are at this bus, scsi id then fake a TEST_UNIT_READY and INQUIRY response // with type 7F (for all luns less than the max for this bus,id) so the lun scan will continue. cmd->result = (DID_NO_CONNECT <<16 ); - cmd->scsi_done (cmd); +scsi_done (cmd);return 0 ; } cmd->device->hostdata = pDev;
@@ -2227,7 +2226,7 @@ static s32 adpt_scsi_to_i2o(adpt_hba* pHba, struct scsi_cmnd* cmd, struct adpt_dprintk (KERN_WARNING "%s: scsi opcode 0x%x not supported.\n" , pHba->name, cmd->cmnd[0 ]); cmd->result = (DID_ERROR <<16 ); - cmd->scsi_done (cmd); +scsi_done (cmd);return 0 ; } }
@@ -2451,9 +2450,7 @@ static void adpt_i2o_scsi_complete(void __iomem *reply, struct scsi_cmnd *cmd) cmd->result |= (dev_status); -if (cmd->scsi_done !=NULL ){ - cmd->scsi_done (cmd); - } +scsi_done (cmd); }
Bart Van Assche
maintainerPATCH v2 30/84 esas2r: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/esas2r/esas2r_main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/esas2r/esas2r_main.c +4 -4
@@ -828,7 +828,7 @@ int esas2r_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)if (unlikely (test_bit (AF_DEGRADED_MODE , &a->flags))) { cmd->result =DID_NO_CONNECT <<16 ; - cmd->scsi_done (cmd); +scsi_done (cmd);return 0 ; }
@@ -988,7 +988,7 @@ int esas2r_eh_abort(struct scsi_cmnd *cmd)scsi_set_resid (cmd,0 ); - cmd->scsi_done (cmd); +scsi_done (cmd);return SUCCESS ; }
@@ -1054,7 +1054,7 @@ int esas2r_eh_abort(struct scsi_cmnd *cmd)scsi_set_resid (cmd,0 ); - cmd->scsi_done (cmd); +scsi_done (cmd);return SUCCESS ; }
@@ -1535,7 +1535,7 @@ void esas2r_complete_request_cb(struct esas2r_adapter *a,scsi_set_resid (rq->cmd,0 ); } - rq->cmd->scsi_done (rq->cmd); +scsi_done (rq->cmd);esas2r_free_request (a, rq); }
Bart Van Assche
maintainerPATCH v2 31/84 esp_scsi: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/esp_scsi.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/scsi/esp_scsi.c +4 -6
@@ -936,7 +936,7 @@ static void esp_cmd_is_done(struct esp *esp, struct esp_cmd_entry *ent, } } - cmd->scsi_done (cmd); +scsi_done (cmd);list_del (&ent->list);esp_put_ent (esp, ent);
@@ -965,8 +965,6 @@ static int esp_queuecommand_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_ ent->cmd = cmd; - cmd->scsi_done = done; - spriv =ESP_CMD_PRIV (cmd); spriv->num_sg =0 ;
@@ -2038,7 +2036,7 @@ static void esp_reset_cleanup_one(struct esp *esp, struct esp_cmd_entry *ent)if (ent->flags &ESP_CMD_FLAG_AUTOSENSE )esp_unmap_sense (esp, ent); - cmd->scsi_done (cmd); +scsi_done (cmd);list_del (&ent->list);esp_put_ent (esp, ent); }
@@ -2061,7 +2059,7 @@ static void esp_reset_cleanup(struct esp *esp)list_del (&ent->list); cmd->result =DID_RESET <<16 ; - cmd->scsi_done (cmd); +scsi_done (cmd);esp_put_ent (esp, ent); }
@@ -2535,7 +2533,7 @@ static int esp_eh_abort_handler(struct scsi_cmnd *cmd)list_del (&ent->list); cmd->result =DID_ABORT <<16 ; - cmd->scsi_done (cmd); +scsi_done (cmd);esp_put_ent (esp, ent);
Bart Van Assche
maintainerPATCH v2 32/84 fas216: Introduce struct fas216_cmd_priv
In reply to Bart Van AsscheIntroduce a structure with driver-private data per SCSI command. This data structure will be used by the next patch to store a function pointer.
--- drivers/scsi/arm/arxescsi.c | 1 + drivers/scsi/arm/cumana_2.c | 1 + drivers/scsi/arm/eesox.c | 1 + drivers/scsi/arm/fas216.h | 10 ++++++++++ drivers/scsi/arm/powertec.c | 2 +- 5 files changed, 14 insertions(+), 1 deletion(-)
drivers/scsi/arm/arxescsi.c +1 -0
@@ -243,6 +243,7 @@ static struct scsi_host_template arxescsi_template = { .eh_bus_reset_handler = fas216_eh_bus_reset, .eh_device_reset_handler = fas216_eh_device_reset, .eh_abort_handler = fas216_eh_abort, + .cmd_size = sizeof(struct fas216_cmd_priv), .can_queue = 0, .this_id = 7, .sg_tablesize = SG_ALL,
drivers/scsi/arm/cumana_2.c +1 -0
@@ -363,6 +363,7 @@ static struct scsi_host_template cumanascsi2_template = { .eh_bus_reset_handler = fas216_eh_bus_reset, .eh_device_reset_handler = fas216_eh_device_reset, .eh_abort_handler = fas216_eh_abort, + .cmd_size = sizeof(struct fas216_cmd_priv), .can_queue = 1, .this_id = 7, .sg_tablesize = SG_MAX_SEGMENTS,
drivers/scsi/arm/eesox.c +1 -0
@@ -480,6 +480,7 @@ static struct scsi_host_template eesox_template = { .eh_bus_reset_handler = fas216_eh_bus_reset, .eh_device_reset_handler = fas216_eh_device_reset, .eh_abort_handler = fas216_eh_abort, + .cmd_size = sizeof(struct fas216_cmd_priv), .can_queue = 1, .this_id = 7, .sg_tablesize = SG_MAX_SEGMENTS,
drivers/scsi/arm/fas216.h +10 -0
@@ -310,6 +310,16 @@ typedef struct {unsigned long magic_end; } FAS216_Info; +/* driver-private data per SCSI command. */ +struct fas216_cmd_priv { +void (*scsi_done)(struct scsi_cmnd *cmd); +}; + +static inline struct fas216_cmd_priv *fas216_cmd_priv (struct scsi_cmnd *cmd) +{ +return scsi_cmd_priv (cmd); +} +/* Function: int fas216_init (struct Scsi_Host *instance) * Purpose : initialise FAS/NCR/AMD SCSI structures. * Params : instance - a driver-specific filled-out structure
drivers/scsi/arm/powertec.c +1 -1
@@ -286,7 +286,7 @@ static struct scsi_host_template powertecscsi_template = { .eh_bus_reset_handler = fas216_eh_bus_reset, .eh_device_reset_handler = fas216_eh_device_reset, .eh_abort_handler = fas216_eh_abort, - + .cmd_size = sizeof(struct fas216_cmd_priv), .can_queue = 8, .this_id = 7, .sg_tablesize = SG_MAX_SEGMENTS,
Bart Van Assche
maintainerPATCH v2 33/84 fas216: Stop using scsi_cmnd.scsi_done
In reply to Bart Van AsscheStore the completion callback pointer in struct fas216_cmd_priv instead of in struct scsi_cmnd. This patch prepares for removal of the scsi_done member from struct scsi_cmnd.
--- drivers/scsi/arm/fas216.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/arm/fas216.c +4 -4
@@ -2017,7 +2017,7 @@ static void fas216_rq_sns_done(FAS216_Info *info, struct scsi_cmnd *SCpnt,* correctly by fas216_std_done. */ scsi_eh_restore_cmnd (SCpnt, &info->ses); - SCpnt->scsi_done (SCpnt); +fas216_cmd_priv (SCpnt)->scsi_done (SCpnt); }/**
@@ -2088,8 +2088,8 @@ fas216_std_done(FAS216_Info *info, struct scsi_cmnd *SCpnt, unsigned int result) } done: -if (SCpnt->scsi_done) { - SCpnt->scsi_done (SCpnt); +if (fas216_cmd_priv (SCpnt)->scsi_done) { +fas216_cmd_priv (SCpnt)->scsi_done (SCpnt);return ; }
@@ -2205,7 +2205,7 @@ static int fas216_queue_command_lck(struct scsi_cmnd *SCpnt,fas216_log_command (info,LOG_CONNECT , SCpnt,"received command (%p)" , SCpnt); - SCpnt->scsi_done = done; +fas216_cmd_priv (SCpnt)->scsi_done = done; SCpnt->host_scribble = (void *)fas216_std_done; SCpnt->result =0 ;
Bart Van Assche
maintainerPATCH v2 34/84 fdomain: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/fdomain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/fdomain.c +1 -1
@@ -206,7 +206,7 @@ static void fdomain_finish_cmd(struct fdomain *fd) {outb (0 , fd->base +REG_ICTL );fdomain_make_bus_idle (fd); - fd->cur_cmd->scsi_done (fd->cur_cmd); +scsi_done (fd->cur_cmd); fd->cur_cmd =NULL ; }
Bart Van Assche
maintainerPATCH v2 35/84 fnic: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/fnic/fnic_scsi.c | 119 +++++++++++++++------------------- 1 file changed, 54 insertions(+), 65 deletions(-)
drivers/scsi/fnic/fnic_scsi.c +54 -65
@@ -560,7 +560,6 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc, void (*done)(struct scsi_CMD_STATE (sc) =FNIC_IOREQ_CMD_PENDING ;CMD_SP (sc) = (char *)io_req;CMD_FLAGS (sc) |=FNIC_IO_INITIALIZED ; - sc->scsi_done = done;/* create copy wq desc and enqueue it */ wq = &fnic->wq_copy[0 ];
@@ -1051,8 +1050,7 @@ static void fnic_fcpio_icmnd_cmpl_handler(struct fnic *fnic, }/* Call SCSI completion function to complete the IO */ -if (sc->scsi_done) - sc->scsi_done (sc); +scsi_done (sc); }/* fnic_fcpio_itmf_cmpl_handler
@@ -1193,28 +1191,25 @@ static void fnic_fcpio_itmf_cmpl_handler(struct fnic *fnic,fnic_release_ioreq_buf (fnic, io_req, sc);mempool_free (io_req, fnic->io_req_pool); -if (sc->scsi_done) { -FNIC_TRACE (fnic_fcpio_itmf_cmpl_handler, - sc->device->host->host_no, id, - sc, -jiffies_to_msecs (jiffies - start_time), - desc, - (((u64 )hdr_status <<40 ) | - (u64 )sc->cmnd[0 ] <<32 | - (u64 )sc->cmnd[2 ] <<24 | - (u64 )sc->cmnd[3 ] <<16 | - (u64 )sc->cmnd[4 ] <<8 | sc->cmnd[5 ]), - (((u64 )CMD_FLAGS (sc) <<32 ) | -CMD_STATE (sc))); - sc->scsi_done (sc); -atomic64_dec (&fnic_stats->io_stats.active_ios); -if (atomic64_read (&fnic->io_cmpl_skip)) -atomic64_dec (&fnic->io_cmpl_skip); -else -atomic64_inc (&fnic_stats->io_stats.io_completions); - } +FNIC_TRACE (fnic_fcpio_itmf_cmpl_handler, + sc->device->host->host_no, id, + sc, +jiffies_to_msecs (jiffies - start_time), + desc, + (((u64 )hdr_status <<40 ) | + (u64 )sc->cmnd[0 ] <<32 | + (u64 )sc->cmnd[2 ] <<24 | + (u64 )sc->cmnd[3 ] <<16 | + (u64 )sc->cmnd[4 ] <<8 | sc->cmnd[5 ]), + (((u64 )CMD_FLAGS (sc) <<32 ) | +CMD_STATE (sc))); +scsi_done (sc); +atomic64_dec (&fnic_stats->io_stats.active_ios); +if (atomic64_read (&fnic->io_cmpl_skip)) +atomic64_dec (&fnic->io_cmpl_skip); +else +atomic64_inc (&fnic_stats->io_stats.io_completions); } - }else if (id &FNIC_TAG_DEV_RST ) {/* Completion of device reset */ CMD_LR_STATUS (sc) = hdr_status;
@@ -1421,23 +1416,22 @@ static bool fnic_cleanup_io_iter(struct scsi_cmnd *sc, void *data,atomic64_inc (&fnic_stats->io_stats.io_completions);/* Complete the command to SCSI */ -if (sc->scsi_done) { -if (!(CMD_FLAGS (sc) &FNIC_IO_ISSUED )) -shost_printk (KERN_ERR , fnic->lport->host, -"Calling done for IO not issued to fw: tag:0x%x sc:0x%p\n" , - tag, sc); - -FNIC_TRACE (fnic_cleanup_io, - sc->device->host->host_no, tag, sc, -jiffies_to_msecs (jiffies - start_time), -0 , ((u64 )sc->cmnd[0 ] <<32 | - (u64 )sc->cmnd[2 ] <<24 | - (u64 )sc->cmnd[3 ] <<16 | - (u64 )sc->cmnd[4 ] <<8 | sc->cmnd[5 ]), - (((u64 )CMD_FLAGS (sc) <<32 ) |CMD_STATE (sc))); - - sc->scsi_done (sc); - } +if (!(CMD_FLAGS (sc) &FNIC_IO_ISSUED )) +shost_printk (KERN_ERR , fnic->lport->host, +"Calling done for IO not issued to fw: tag:0x%x sc:0x%p\n" , + tag, sc); + +FNIC_TRACE (fnic_cleanup_io, + sc->device->host->host_no, tag, sc, +jiffies_to_msecs (jiffies - start_time), +0 , ((u64 )sc->cmnd[0 ] <<32 | + (u64 )sc->cmnd[2 ] <<24 | + (u64 )sc->cmnd[3 ] <<16 | + (u64 )sc->cmnd[4 ] <<8 | sc->cmnd[5 ]), + (((u64 )CMD_FLAGS (sc) <<32 ) |CMD_STATE (sc))); + +scsi_done (sc); +return true; }
@@ -1495,17 +1489,15 @@ void fnic_wq_copy_cleanup_handler(struct vnic_wq_copy *wq,FNIC_SCSI_DBG (KERN_DEBUG , fnic->lport->host,"wq_copy_cleanup_handler:" " DID_NO_CONNECT\n" ); -if (sc->scsi_done) { -FNIC_TRACE (fnic_wq_copy_cleanup_handler, - sc->device->host->host_no, id, sc, -jiffies_to_msecs (jiffies - start_time), -0 , ((u64 )sc->cmnd[0 ] <<32 | - (u64 )sc->cmnd[2 ] <<24 | (u64 )sc->cmnd[3 ] <<16 | - (u64 )sc->cmnd[4 ] <<8 | sc->cmnd[5 ]), - (((u64 )CMD_FLAGS (sc) <<32 ) |CMD_STATE (sc))); +FNIC_TRACE (fnic_wq_copy_cleanup_handler, + sc->device->host->host_no, id, sc, +jiffies_to_msecs (jiffies - start_time), +0 , ((u64 )sc->cmnd[0 ] <<32 | + (u64 )sc->cmnd[2 ] <<24 | (u64 )sc->cmnd[3 ] <<16 | + (u64 )sc->cmnd[4 ] <<8 | sc->cmnd[5 ]), + (((u64 )CMD_FLAGS (sc) <<32 ) |CMD_STATE (sc))); - sc->scsi_done (sc); - } +scsi_done (sc); } static inline int fnic_queue_abort_io_req(struct fnic *fnic, int tag,
@@ -1931,16 +1923,14 @@ int fnic_abort_cmd(struct scsi_cmnd *sc)fnic_release_ioreq_buf (fnic, io_req, sc);mempool_free (io_req, fnic->io_req_pool); -if (sc->scsi_done) {/* Call SCSI completion function to complete the IO */ - sc->result = (DID_ABORT <<16 ); - sc->scsi_done (sc); -atomic64_dec (&fnic_stats->io_stats.active_ios); -if (atomic64_read (&fnic->io_cmpl_skip)) -atomic64_dec (&fnic->io_cmpl_skip); -else -atomic64_inc (&fnic_stats->io_stats.io_completions); - } + sc->result =DID_ABORT <<16 ; +scsi_done (sc); +atomic64_dec (&fnic_stats->io_stats.active_ios); +if (atomic64_read (&fnic->io_cmpl_skip)) +atomic64_dec (&fnic->io_cmpl_skip); +else +atomic64_inc (&fnic_stats->io_stats.io_completions); fnic_abort_cmd_end: FNIC_TRACE(fnic_abort_cmd, sc->device->host->host_no, tag, sc,
@@ -2153,11 +2143,10 @@ static bool fnic_pending_aborts_iter(struct scsi_cmnd *sc,* Any IO is returned during reset, it needs to call scsi_done * to return the scsi_cmnd to upper layer. */ -if (sc->scsi_done) { -/* Set result to let upper SCSI layer retry */ - sc->result =DID_RESET <<16 ; - sc->scsi_done (sc); - } +/* Set result to let upper SCSI layer retry */ + sc->result =DID_RESET <<16 ; +scsi_done (sc); +return true; }
Bart Van Assche
maintainerPATCH v2 36/84 hpsa: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/hpsa.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/scsi/hpsa.c +6 -6
@@ -2482,8 +2482,8 @@ static void hpsa_cmd_free_and_done(struct ctlr_info *h, struct CommandList *c, struct scsi_cmnd *cmd) {hpsa_cmd_resolve_and_free (h ,c ); -if (cmd && cmd->scsi_done) - cmd->scsi_done (cmd); +if (cmd) +scsi_done (cmd); }static void hpsa_retry_cmd (struct ctlr_info *h,struct CommandList *c)
@@ -5671,7 +5671,7 @@ static void hpsa_command_resubmit_worker(struct work_struct *work)* if it encountered a dma mapping failure. */ cmd->result =DID_IMM_RETRY <<16 ; - cmd->scsi_done (cmd); +scsi_done (cmd); } }
@@ -5691,19 +5691,19 @@ static int hpsa_scsi_queue_command(struct Scsi_Host *sh, struct scsi_cmnd *cmd) dev = cmd->device->hostdata;if (!dev) { cmd->result =DID_NO_CONNECT <<16 ; - cmd->scsi_done (cmd); +scsi_done (cmd);return 0 ; }if (dev->removed) { cmd->result =DID_NO_CONNECT <<16 ; - cmd->scsi_done (cmd); +scsi_done (cmd);return 0 ; }if (unlikely (lockup_detected (h))) { cmd->result =DID_NO_CONNECT <<16 ; - cmd->scsi_done (cmd); +scsi_done (cmd);return 0 ; }
Bart Van Assche
maintainerPATCH v2 37/84 hptiop: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/hptiop.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/scsi/hptiop.c +2 -5
@@ -769,7 +769,7 @@ static void hptiop_finish_scsi_req(struct hptiop_hba *hba, u32 tag, skip_resid:dprintk ("scsi_done(%p)\n" , scp); - scp->scsi_done (scp); +scsi_done (scp);free_req (hba, &hba->reqs[tag]); }
@@ -1002,9 +1002,6 @@ static int hptiop_queuecommand_lck(struct scsi_cmnd *scp,int sg_count =0 ;struct hptiop_request *_req; -BUG_ON (!done); - scp->scsi_done = done; - _req =get_req (hba);if (_req ==NULL ) {dprintk ("hptiop_queuecmd : no free req\n" );
@@ -1059,7 +1056,7 @@ static int hptiop_queuecommand_lck(struct scsi_cmnd *scp, cmd_done:dprintk ("scsi_done(scp=%p)\n" , scp); - scp->scsi_done (scp); +scsi_done (scp);return 0 ; }
Bart Van Assche
maintainerPATCH v2 38/84 ibmvscsi: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/ibmvscsi/ibmvfc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/ibmvscsi/ibmvfc.c +4 -4
@@ -1046,7 +1046,7 @@ static void ibmvfc_scsi_eh_done(struct ibmvfc_event *evt)if (cmnd) {scsi_dma_unmap (cmnd); - cmnd->scsi_done (cmnd); +scsi_done (cmnd); }ibmvfc_free_event (evt);
@@ -1848,7 +1848,7 @@ static void ibmvfc_scsi_done(struct ibmvfc_event *evt) cmnd->result = (DID_ERROR <<16 );scsi_dma_unmap (cmnd); - cmnd->scsi_done (cmnd); +scsi_done (cmnd); }ibmvfc_free_event (evt);
@@ -1934,7 +1934,7 @@ static int ibmvfc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *cmnd)if (unlikely ((rc =fc_remote_port_chkready (rport))) ||unlikely ((rc =ibmvfc_host_chkready (vhost)))) { cmnd->result = rc; - cmnd->scsi_done (cmnd); +scsi_done (cmnd);return 0 ; }
@@ -1974,7 +1974,7 @@ static int ibmvfc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *cmnd) "Failed to map DMA buffer for command. rc=%d\n", rc); cmnd->result =DID_ERROR <<16 ; - cmnd->scsi_done (cmnd); +scsi_done (cmnd);return 0 ; }
Bart Van Assche
maintainerPATCH v2 39/84 imm: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/imm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/imm.c +1 -2
@@ -769,7 +769,7 @@ static void imm_interrupt(struct work_struct *work)spin_lock_irqsave (host->host_lock, flags); dev->cur_cmd =NULL ; - cmd->scsi_done (cmd); +scsi_done (cmd);spin_unlock_irqrestore (host->host_lock, flags);return ; }
@@ -922,7 +922,6 @@ static int imm_queuecommand_lck(struct scsi_cmnd *cmd, dev->failed =0 ; dev->jstart = jiffies; dev->cur_cmd = cmd; - cmd->scsi_done = done; cmd->result =DID_ERROR <<16 ;/* default return code */ cmd->SCp.phase =0 ;/* bus free */
Bart Van Assche
maintainerPATCH v2 40/84 initio: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/initio.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/scsi/initio.c +1 -3
@@ -2615,8 +2615,6 @@ static int i91u_queuecommand_lck(struct scsi_cmnd *cmd,struct initio_host *host = (struct initio_host *) cmd->device->host->hostdata;struct scsi_ctrl_blk *cmnd; - cmd->scsi_done = done; - cmnd =initio_alloc_scb (host);if (!cmnd)return SCSI_MLQUEUE_HOST_BUSY ;
@@ -2788,7 +2786,7 @@ static void i91uSCBPost(u8 * host_mem, u8 * cblk_mem) cmnd->result = cblk->tastat | (cblk->hastat <<16 );i91u_unmap_scb (host->pci_dev, cmnd); - cmnd->scsi_done (cmnd);/* Notify system DONE */ +scsi_done (cmnd);/* Notify system DONE */ initio_release_scb (host, cblk);/* Release SCB for current channel */ }
Bart Van Assche
maintainerPATCH v2 41/84 ipr: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/ipr.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/scsi/ipr.c +5 -5
@@ -866,7 +866,7 @@ static void __ipr_scsi_eh_done(struct ipr_cmnd *ipr_cmd) scsi_cmd->result |= (DID_ERROR <<16 );scsi_dma_unmap (ipr_cmd->scsi_cmd); - scsi_cmd->scsi_done (scsi_cmd); +scsi_done (scsi_cmd);if (ipr_cmd->eh_comp)complete (ipr_cmd->eh_comp);list_add_tail (&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_free_q);
@@ -6065,7 +6065,7 @@ static void __ipr_erp_done(struct ipr_cmnd *ipr_cmd) res->in_erp =0 ; }scsi_dma_unmap (ipr_cmd->scsi_cmd); - scsi_cmd->scsi_done (scsi_cmd); +scsi_done (scsi_cmd);if (ipr_cmd->eh_comp)complete (ipr_cmd->eh_comp);list_add_tail (&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_free_q);
@@ -6502,7 +6502,7 @@ static void ipr_erp_start(struct ipr_ioa_cfg *ioa_cfg, }scsi_dma_unmap (ipr_cmd->scsi_cmd); - scsi_cmd->scsi_done (scsi_cmd); +scsi_done (scsi_cmd);if (ipr_cmd->eh_comp)complete (ipr_cmd->eh_comp);list_add_tail (&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_free_q);
@@ -6531,7 +6531,7 @@ static void ipr_scsi_done(struct ipr_cmnd *ipr_cmd)scsi_dma_unmap (scsi_cmd);spin_lock_irqsave (ipr_cmd->hrrq->lock, lock_flags); - scsi_cmd->scsi_done (scsi_cmd); +scsi_done (scsi_cmd);if (ipr_cmd->eh_comp)complete (ipr_cmd->eh_comp);list_add_tail (&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_free_q);
@@ -6685,7 +6685,7 @@ static int ipr_queuecommand(struct Scsi_Host *shost,spin_lock_irqsave (hrrq->lock, hrrq_flags);memset (scsi_cmd->sense_buffer,0 ,SCSI_SENSE_BUFFERSIZE ); scsi_cmd->result = (DID_NO_CONNECT <<16 ); - scsi_cmd->scsi_done (scsi_cmd); +scsi_done (scsi_cmd);spin_unlock_irqrestore (hrrq->lock, hrrq_flags);return 0 ; }
Bart Van Assche
maintainerPATCH v2 42/84 ips: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/ips.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-)
drivers/scsi/ips.c +13 -15
@@ -936,7 +936,7 @@ static int __ips_eh_reset(struct scsi_cmnd *SC)while ((scb =ips_removeq_scb_head (&ha->scb_activelist))) { scb->scsi_cmd->result =DID_ERROR <<16 ; - scb->scsi_cmd->scsi_done (scb->scsi_cmd); +scsi_done (scb->scsi_cmd);ips_freescb (ha, scb); }
@@ -946,7 +946,7 @@ static int __ips_eh_reset(struct scsi_cmnd *SC)while ((scsi_cmd =ips_removeq_wait_head (&ha->scb_waitlist))) { scsi_cmd->result =DID_ERROR ; - scsi_cmd->scsi_done (scsi_cmd); +scsi_done (scsi_cmd); } ha->active = FALSE;
@@ -965,7 +965,7 @@ static int __ips_eh_reset(struct scsi_cmnd *SC)while ((scb =ips_removeq_scb_head (&ha->scb_activelist))) { scb->scsi_cmd->result =DID_ERROR <<16 ; - scb->scsi_cmd->scsi_done (scb->scsi_cmd); +scsi_done (scb->scsi_cmd);ips_freescb (ha, scb); }
@@ -975,7 +975,7 @@ static int __ips_eh_reset(struct scsi_cmnd *SC)while ((scsi_cmd =ips_removeq_wait_head (&ha->scb_waitlist))) { scsi_cmd->result =DID_ERROR <<16 ; - scsi_cmd->scsi_done (scsi_cmd); +scsi_done (scsi_cmd); } ha->active = FALSE;
@@ -994,7 +994,7 @@ static int __ips_eh_reset(struct scsi_cmnd *SC)while ((scb =ips_removeq_scb_head (&ha->scb_activelist))) { scb->scsi_cmd->result =DID_RESET <<16 ; - scb->scsi_cmd->scsi_done (scb->scsi_cmd); +scsi_done (scb->scsi_cmd);ips_freescb (ha, scb); }
@@ -1064,8 +1064,6 @@ static int ips_queue_lck(struct scsi_cmnd *SC, void (*done) (struct scsi_cmnd *)return (0 ); } -SC ->scsi_done = done; - DEBUG_VAR(2, "(%s%d): ips_queue: cmd 0x%X (%d %d %d)", ips_name, ha->host_num,
@@ -1099,7 +1097,7 @@ static int ips_queue_lck(struct scsi_cmnd *SC, void (*done) (struct scsi_cmnd *) ha->ioctl_reset =1 ;/* This reset request is from an IOCTL */ __ips_eh_reset (SC );SC ->result =DID_OK <<16 ; -SC ->scsi_done (SC ); +scsi_done (SC );return (0 ); }
@@ -2579,7 +2577,7 @@ ips_next(ips_ha_t * ha, int intr)case IPS_FAILURE :if (scb->scsi_cmd) { scb->scsi_cmd->result =DID_ERROR <<16 ; - scb->scsi_cmd->scsi_done (scb->scsi_cmd); +scsi_done (scb->scsi_cmd); }ips_freescb (ha, scb);
@@ -2587,7 +2585,7 @@ ips_next(ips_ha_t * ha, int intr)case IPS_SUCCESS_IMM :if (scb->scsi_cmd) { scb->scsi_cmd->result =DID_OK <<16 ; - scb->scsi_cmd->scsi_done (scb->scsi_cmd); +scsi_done (scb->scsi_cmd); }ips_freescb (ha, scb);
@@ -2712,7 +2710,7 @@ ips_next(ips_ha_t * ha, int intr)case IPS_FAILURE :if (scb->scsi_cmd) { scb->scsi_cmd->result =DID_ERROR <<16 ; - scb->scsi_cmd->scsi_done (scb->scsi_cmd); +scsi_done (scb->scsi_cmd); }if (scb->bus)
@@ -2723,7 +2721,7 @@ ips_next(ips_ha_t * ha, int intr)break ;case IPS_SUCCESS_IMM :if (scb->scsi_cmd) - scb->scsi_cmd->scsi_done (scb->scsi_cmd); +scsi_done (scb->scsi_cmd);if (scb->bus) ha->dcdb_active[scb->bus - 1] &=
@@ -3206,7 +3204,7 @@ ips_done(ips_ha_t * ha, ips_scb_t * scb)case IPS_FAILURE :if (scb->scsi_cmd) { scb->scsi_cmd->result =DID_ERROR <<16 ; - scb->scsi_cmd->scsi_done (scb->scsi_cmd); +scsi_done (scb->scsi_cmd); }ips_freescb (ha, scb);
@@ -3214,7 +3212,7 @@ ips_done(ips_ha_t * ha, ips_scb_t * scb)case IPS_SUCCESS_IMM :if (scb->scsi_cmd) { scb->scsi_cmd->result =DID_ERROR <<16 ; - scb->scsi_cmd->scsi_done (scb->scsi_cmd); +scsi_done (scb->scsi_cmd); }ips_freescb (ha, scb);
@@ -3231,7 +3229,7 @@ ips_done(ips_ha_t * ha, ips_scb_t * scb) ha->dcdb_active[scb->bus -1 ] &= ~(1 << scb->target_id); } - scb->scsi_cmd->scsi_done (scb->scsi_cmd); +scsi_done (scb->scsi_cmd);ips_freescb (ha, scb); }
Bart Van Assche
maintainerPATCH v2 43/84 libfc: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/libfc/fc_fcp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/libfc/fc_fcp.c +3 -3
@@ -1870,7 +1870,7 @@ int fc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *sc_cmd) rval =fc_remote_port_chkready (rport);if (rval) { sc_cmd->result = rval; - sc_cmd->scsi_done (sc_cmd); +scsi_done (sc_cmd);return 0 ; }
@@ -1880,7 +1880,7 @@ int fc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *sc_cmd)* online */ sc_cmd->result =DID_IMM_RETRY <<16 ; - sc_cmd->scsi_done (sc_cmd); +scsi_done (sc_cmd); goto out; }
@@ -2087,7 +2087,7 @@ static void fc_io_compl(struct fc_fcp_pkt *fsp)list_del (&fsp->list); sc_cmd->SCp.ptr =NULL ;spin_unlock_irqrestore (&si->scsi_queue_lock, flags); - sc_cmd->scsi_done (sc_cmd); +scsi_done (sc_cmd);/* release ref from initial allocation in queue command */ fc_fcp_pkt_release (fsp);
Bart Van Assche
maintainerPATCH v2 44/84 libiscsi: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/libiscsi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/libiscsi.c +2 -2
@@ -468,7 +468,7 @@ static void iscsi_free_task(struct iscsi_task *task)* it will decide how to return sc to scsi-ml. */ if (oldstate !=ISCSI_TASK_REQUEUE_SCSIQ ) - sc->scsi_done (sc); +scsi_done (sc); } }
@@ -1807,7 +1807,7 @@ int iscsi_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc)ISCSI_DBG_SESSION (session,"iscsi: cmd 0x%x is not queued (%d)\n" , sc->cmnd[0 ], reason);scsi_set_resid (sc,scsi_bufflen (sc)); - sc->scsi_done (sc); +scsi_done (sc);return 0 ; }EXPORT_SYMBOL_GPL (iscsi_queuecommand);
Re: [PATCH v2 44/84] libiscsi: Call scsi_done() directly
Quoted 24 lines · Bart Van Assche
Conditional statements are faster than indirect calls. Hence call
scsi_done()directly.Reviewed-by John Garry <[email protected]>Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/libiscsi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/scsi/libiscsi.c +1
-1@@ -468,7 +468,7 @@ static void iscsi_free_task(struct iscsi_task *task)* it will decide how to return sc to scsi-ml. */ if (oldstate !=ISCSI_TASK_REQUEUE_SCSIQ ) - sc->scsi_done (sc); +scsi_done (sc); } }
drivers/scsi/libiscsi.c int iscsi_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc) · line 1813
Quoted 8 lines
drivers/scsi/libiscsi.c +1
-1@@ -1807,7 +1807,7 @@ int iscsi_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc)ISCSI_DBG_SESSION (session,"iscsi: cmd 0x%x is not queued (%d)\n" , sc->cmnd[0 ], reason);scsi_set_resid (sc,scsi_bufflen (sc)); - sc->scsi_done (sc); +scsi_done (sc);return 0 ; }EXPORT_SYMBOL_GPL (iscsi_queuecommand);
Bart Van Assche
maintainerPATCH v2 45/84 libsas: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/libsas/sas_scsi_host.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/libsas/sas_scsi_host.c +2 -2
@@ -125,7 +125,7 @@ static void sas_scsi_task_done(struct sas_task *task) }sas_end_task (sc, task); - sc->scsi_done (sc); +scsi_done (sc); } static struct sas_task *sas_create_task(struct scsi_cmnd *cmd,
@@ -198,7 +198,7 @@ int sas_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)else cmd->result =DID_ERROR <<16 ; out_done: - cmd->scsi_done (cmd); +scsi_done (cmd);return 0 ; }EXPORT_SYMBOL_GPL (sas_queuecommand);
Re: [PATCH v2 45/84] libsas: Call scsi_done() directly
Quoted 5 lines · Bart Van Assche
Conditional statements are faster than indirect calls. Hence call
scsi_done()directly.Reviewed-by Lee Duncan <[email protected]>Signed-off-by Bart Van Assche <[email protected]>
Hi Bart,
Can you double-check these tags, as I know I provided a RB tag, but I'm not sure about Lee?
Thanks
Quoted 28 lines
--- drivers/scsi/libsas/sas_scsi_host.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/scsi/libsas/sas_scsi_host.c +2
-2@@ -125,7 +125,7 @@ static void sas_scsi_task_done(struct sas_task *task) }sas_end_task (sc, task); - sc->scsi_done (sc); +scsi_done (sc); } static struct sas_task *sas_create_task(struct scsi_cmnd *cmd,@@ -198,7 +198,7 @@ int sas_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)else cmd->result =DID_ERROR <<16 ; out_done: - cmd->scsi_done (cmd); +scsi_done (cmd);return 0 ; }EXPORT_SYMBOL_GPL (sas_queuecommand);.
Bart Van Assche
maintainerRe: [PATCH v2 45/84] libsas: Call scsi_done() directly
Quoted 8 lines · John Garry
Quoted 5 lines · Bart Van Assche
Conditional statements are faster than indirect calls. Hence call
scsi_done()directly.Reviewed-by Lee Duncan <[email protected]>Signed-off-by Bart Van Assche <[email protected]>Can you double-check these tags, as I know I provided a RB tag, but I'm not sure about Lee?
Right, this Reviewed-by tag should have been applied to the previous patch in this series. I will review all Reviewed-by tags.
Thanks,
Bart.
Bart Van Assche
maintainerPATCH v2 46/84 lpfc: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/lpfc/lpfc_scsi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/lpfc/lpfc_scsi.c +4 -4
@@ -564,7 +564,7 @@ lpfc_sli4_io_xri_aborted(struct lpfc_hba *phba,* scsi_done upcall. */ if (cmd) - cmd->scsi_done (cmd); +scsi_done (cmd);/* * We expect there is an abort thread waiting
@@ -4502,7 +4502,7 @@ lpfc_fcp_io_cmd_wqe_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pwqeIn, goto out;/* The sdev is not guaranteed to be valid post scsi_done upcall. */ - cmd->scsi_done (cmd); +scsi_done (cmd);/* * If there is an abort thread waiting for command completion
@@ -4771,7 +4771,7 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,#endif /* The sdev is not guaranteed to be valid post scsi_done upcall. */ - cmd->scsi_done (cmd); +scsi_done (cmd);/* * If there is an abort thread waiting for command completion
@@ -5843,7 +5843,7 @@ lpfc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *cmnd) shost); out_fail_command: - cmnd->scsi_done (cmnd); +scsi_done (cmnd);return 0 ; }
Bart Van Assche
maintainerPATCH v2 47/84 mac53c94: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/mac53c94.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/mac53c94.c +1 -2
@@ -83,7 +83,6 @@ static int mac53c94_queue_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cm }#endif - cmd->scsi_done = done; cmd->host_scribble =NULL ; state = (struct fsc_state *) cmd->device->host->hostdata;
@@ -348,7 +347,7 @@ static void cmd_done(struct fsc_state *state, int result) cmd = state->current_req;if (cmd) { cmd->result = result; - (*cmd->scsi_done)(cmd); +scsi_done (cmd); state->current_req =NULL ; } state->phase = idle;
Bart Van Assche
maintainerPATCH v2 48/84 megaraid: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/megaraid/megaraid_mbox.c | 9 ++++----- drivers/scsi/megaraid/megaraid_sas_base.c | 16 ++++++++-------- drivers/scsi/megaraid/megaraid_sas_fusion.c | 6 +++--- 3 files changed, 15 insertions(+), 16 deletions(-)
drivers/scsi/megaraid/megaraid_mbox.c +4 -5
@@ -1440,7 +1440,6 @@ megaraid_queue_command_lck(struct scsi_cmnd *scp, void (*done)(struct scsi_cmndint if_busy; adapter =SCP2ADAPTER (scp); - scp->scsi_done = done; scp->result =0 ;/*
@@ -2358,7 +2357,7 @@ megaraid_mbox_dpc(unsigned long devp)megaraid_dealloc_scb (adapter, scb);// send the scsi packet back to kernel - scp->scsi_done (scp); +scsi_done (scp); }return ;
@@ -2416,7 +2415,7 @@ megaraid_abort_handler(struct scsi_cmnd *scp) scb->sno, scb->dev_channel, scb->dev_target)); scp->result = (DID_ABORT <<16 ); - scp->scsi_done (scp); +scsi_done (scp);megaraid_dealloc_scb (adapter, scb);
@@ -2446,7 +2445,7 @@ megaraid_abort_handler(struct scsi_cmnd *scp) scb->dev_channel, scb->dev_target)); scp->result = (DID_ABORT <<16 ); - scp->scsi_done (scp); +scsi_done (scp);megaraid_dealloc_scb (adapter, scb);
@@ -2566,7 +2565,7 @@ megaraid_reset_handler(struct scsi_cmnd *scp) } scb->scp->result = (DID_RESET <<16 ); - scb->scp->scsi_done (scb->scp); +scsi_done (scb->scp);megaraid_dealloc_scb (adapter, scb); }
drivers/scsi/megaraid/megaraid_sas_base.c +8 -8
@@ -1794,7 +1794,7 @@ megasas_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scmd)if (instance->unload ==1 ) { scmd->result =DID_NO_CONNECT <<16 ; - scmd->scsi_done (scmd); +scsi_done (scmd);return 0 ; }
@@ -1809,7 +1809,7 @@ megasas_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scmd)return SCSI_MLQUEUE_HOST_BUSY ; }else { scmd->result =DID_NO_CONNECT <<16 ; - scmd->scsi_done (scmd); +scsi_done (scmd);return 0 ; } }
@@ -1818,7 +1818,7 @@ megasas_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scmd)if (!mr_device_priv_data || (atomic_read (&instance->adprecovery) ==MEGASAS_HW_CRITICAL_ERROR )) { scmd->result =DID_NO_CONNECT <<16 ; - scmd->scsi_done (scmd); +scsi_done (scmd);return 0 ; }
@@ -1826,7 +1826,7 @@ megasas_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scmd) ld_tgt_id =MEGASAS_TARGET_ID (scmd->device);if (instance->ld_tgtid_status[ld_tgt_id] ==LD_TARGET_ID_DELETED ) { scmd->result =DID_NO_CONNECT <<16 ; - scmd->scsi_done (scmd); +scsi_done (scmd);return 0 ; } }
@@ -1857,7 +1857,7 @@ megasas_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scmd)return instance->instancet->build_and_issue_cmd (instance, scmd); out_done: - scmd->scsi_done (scmd); +scsi_done (scmd);return 0 ; }
@@ -2783,7 +2783,7 @@ static int megasas_wait_for_outstanding(struct megasas_instance *instance) reset_index, reset_cmd, reset_cmd->scmd->cmnd[0]); - reset_cmd->scmd->scsi_done (reset_cmd->scmd); +scsi_done (reset_cmd->scmd);megasas_return_cmd (instance, reset_cmd); }else if (reset_cmd->sync_cmd) { dev_notice(&instance->pdev->dev, "%p synch cmds"
@@ -3640,7 +3640,7 @@ megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd,atomic_dec (&instance->fw_outstanding);scsi_dma_unmap (cmd->scmd); - cmd->scmd->scsi_done (cmd->scmd); +scsi_done (cmd->scmd);megasas_return_cmd (instance, cmd);break ;
@@ -3686,7 +3686,7 @@ megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd,atomic_dec (&instance->fw_outstanding);scsi_dma_unmap (cmd->scmd); - cmd->scmd->scsi_done (cmd->scmd); +scsi_done (cmd->scmd);megasas_return_cmd (instance, cmd);break ;
drivers/scsi/megaraid/megaraid_sas_fusion.c +3 -3
@@ -3493,7 +3493,7 @@ megasas_complete_r1_command(struct megasas_instance *instance,megasas_return_cmd_fusion (instance, cmd);scsi_dma_unmap (scmd_local);megasas_sdev_busy_dec (instance, scmd_local); - scmd_local->scsi_done (scmd_local); +scsi_done (scmd_local); } }
@@ -3597,7 +3597,7 @@ complete_cmd_fusion(struct megasas_instance *instance, u32 MSIxIndex,megasas_return_cmd_fusion (instance, cmd_fusion);scsi_dma_unmap (scmd_local);megasas_sdev_busy_dec (instance, scmd_local); - scmd_local->scsi_done (scmd_local); +scsi_done (scmd_local); }else /* Optimal VD - R1 FP command completion. */ megasas_complete_r1_command (instance, cmd_fusion);break ;
@@ -4977,7 +4977,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason)atomic_dec (&instance->ldio_outstanding);megasas_return_cmd_fusion (instance, cmd_fusion);scsi_dma_unmap (scmd_local); - scmd_local->scsi_done (scmd_local); +scsi_done (scmd_local); } }
Bart Van Assche
maintainerPATCH v2 49/84 megaraid: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/megaraid.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-)
drivers/scsi/megaraid.c +9 -12
@@ -380,9 +380,6 @@ megaraid_queue_lck(struct scsi_cmnd *scmd, void (*done)(struct scsi_cmnd *)) adapter = (adapter_t *)scmd->device->host->hostdata; - scmd->scsi_done = done; - -/* * Allocate and build a SCB request * busy flag will be set if mega_build_cmd() command could not
@@ -586,7 +583,7 @@ mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy)/* have just LUN 0 for each target on virtual channels */ if (cmd->device->lun) { cmd->result = (DID_BAD_TARGET <<16 ); - cmd->scsi_done (cmd); +scsi_done (cmd);return NULL ; }
@@ -605,7 +602,7 @@ mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy)if (ldrv_num > max_ldrv_num ) { cmd->result = (DID_BAD_TARGET <<16 ); - cmd->scsi_done (cmd); +scsi_done (cmd);return NULL ; }
@@ -617,7 +614,7 @@ mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy)* devices */ cmd->result = (DID_BAD_TARGET <<16 ); - cmd->scsi_done (cmd); +scsi_done (cmd);return NULL ; } }
@@ -637,7 +634,7 @@ mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy)*/ if ( !adapter->has_cluster ) { cmd->result = (DID_OK <<16 ); - cmd->scsi_done (cmd); +scsi_done (cmd);return NULL ; }
@@ -655,7 +652,7 @@ mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy)return scb;#else cmd->result = (DID_OK <<16 ); - cmd->scsi_done (cmd); +scsi_done (cmd);return NULL ;#endif
@@ -670,7 +667,7 @@ mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy)kunmap_atomic (buf - sg->offset); cmd->result = (DID_OK <<16 ); - cmd->scsi_done (cmd); +scsi_done (cmd);return NULL ; }
@@ -866,7 +863,7 @@ mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy)if ( ! adapter->has_cluster ) { cmd->result = (DID_BAD_TARGET <<16 ); - cmd->scsi_done (cmd); +scsi_done (cmd);return NULL ; }
@@ -889,7 +886,7 @@ mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy)default : cmd->result = (DID_BAD_TARGET <<16 ); - cmd->scsi_done (cmd); +scsi_done (cmd);return NULL ; } }
@@ -1654,7 +1651,7 @@ mega_rundoneq (adapter_t *adapter)struct scsi_pointer * spos = (struct scsi_pointer *)pos; cmd = list_entry(spos, struct scsi_cmnd, SCp); - cmd->scsi_done (cmd); +scsi_done (cmd); }INIT_LIST_HEAD (&adapter->completed_list);
Bart Van Assche
maintainerPATCH v2 50/84 mesh: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/mesh.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-)
drivers/scsi/mesh.c +3 -13
@@ -342,15 +342,6 @@ static inline void mesh_flush_io(volatile struct mesh_regs __iomem *mr) } -/* -* Complete a SCSI command -*/ -static void mesh_completed (struct mesh_state *ms,struct scsi_cmnd *cmd) -{ - (*cmd->scsi_done)(cmd); -} - -/* Called with meshinterrupt disabled, initialize the chipset * and eventually do the initial bus reset. The lock must not be * held since we can schedule.
@@ -613,7 +604,7 @@ static void mesh_done(struct mesh_state *ms, int start_next)#endif } cmd->SCp.this_residual -= ms->data_ptr; -mesh_completed (ms, cmd); +scsi_done (cmd); }if (start_next) {out_8 (&ms->mesh->sequence,SEQ_ENBRESEL );
@@ -996,7 +987,7 @@ static void handle_reset(struct mesh_state *ms)if ((cmd = tp->current_req) !=NULL ) {set_host_byte (cmd,DID_RESET ); tp->current_req =NULL ; -mesh_completed (ms, cmd); +scsi_done (cmd); } ms->tgts[tgt].sdtr_state = do_sdtr; ms->tgts[tgt].sync_params =ASYNC_PARAMS ;
@@ -1005,7 +996,7 @@ static void handle_reset(struct mesh_state *ms)while ((cmd = ms->request_q) !=NULL ) { ms->request_q = (struct scsi_cmnd *) cmd->host_scribble;set_host_byte (cmd,DID_RESET ); -mesh_completed (ms, cmd); +scsi_done (cmd); } ms->phase = idle; ms->msgphase = msg_none;
@@ -1634,7 +1625,6 @@ static int mesh_queue_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd * {struct mesh_state *ms; - cmd->scsi_done = done; cmd->host_scribble =NULL ; ms = (struct mesh_state *) cmd->device->host->hostdata;
Bart Van Assche
maintainerPATCH v2 51/84 mpi3mr: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/mpi3mr/mpi3mr_os.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)
drivers/scsi/mpi3mr/mpi3mr_os.c +13 -13
@@ -409,7 +409,7 @@ static bool mpi3mr_flush_scmd(struct request *rq,scsi_dma_unmap (scmd); scmd->result =DID_RESET <<16 ;scsi_print_command (scmd); - scmd->scsi_done (scmd); +scsi_done (scmd); mrioc->flush_io_count++; }
@@ -2312,7 +2312,7 @@ void mpi3mr_process_op_reply_desc(struct mpi3mr_ioc *mrioc, }mpi3mr_clear_scmd_priv (mrioc, scmd);scsi_dma_unmap (scmd); - scmd->scsi_done (scmd); +scsi_done (scmd); out:if (sense_buf) mpi3mr_repost_sense_buf(mrioc,
@@ -3322,7 +3322,7 @@ static bool mpi3mr_check_return_unmap(struct mpi3mr_ioc *mrioc, __func__);scsi_print_command (scmd); scmd->result =DID_OK <<16 ; - scmd->scsi_done (scmd); +scsi_done (scmd);return true; }
@@ -3334,7 +3334,7 @@ static bool mpi3mr_check_return_unmap(struct mpi3mr_ioc *mrioc, scmd->result =SAM_STAT_CHECK_CONDITION ;scsi_build_sense_buffer (0 , scmd->sense_buffer,ILLEGAL_REQUEST ,0x1A ,0 ); - scmd->scsi_done (scmd); +scsi_done (scmd);return true; }if (param_len !=scsi_bufflen (scmd)) {
@@ -3345,7 +3345,7 @@ static bool mpi3mr_check_return_unmap(struct mpi3mr_ioc *mrioc, scmd->result =SAM_STAT_CHECK_CONDITION ;scsi_build_sense_buffer (0 , scmd->sense_buffer,ILLEGAL_REQUEST ,0x1A ,0 ); - scmd->scsi_done (scmd); +scsi_done (scmd);return true; } buf =kzalloc (scsi_bufflen (scmd),GFP_ATOMIC );
@@ -3354,7 +3354,7 @@ static bool mpi3mr_check_return_unmap(struct mpi3mr_ioc *mrioc, scmd->result =SAM_STAT_CHECK_CONDITION ;scsi_build_sense_buffer (0 , scmd->sense_buffer,ILLEGAL_REQUEST ,0x55 ,0x03 ); - scmd->scsi_done (scmd); +scsi_done (scmd);return true; }scsi_sg_copy_to_buffer (scmd, buf,scsi_bufflen (scmd));
@@ -3368,7 +3368,7 @@ static bool mpi3mr_check_return_unmap(struct mpi3mr_ioc *mrioc, scmd->result =SAM_STAT_CHECK_CONDITION ;scsi_build_sense_buffer (0 , scmd->sense_buffer,ILLEGAL_REQUEST ,0x26 ,0 ); - scmd->scsi_done (scmd); +scsi_done (scmd);kfree (buf);return true; }
@@ -3438,14 +3438,14 @@ static int mpi3mr_qcmd(struct Scsi_Host *shost, sdev_priv_data = scmd->device->hostdata;if (!sdev_priv_data || !sdev_priv_data->tgt_priv_data) { scmd->result =DID_NO_CONNECT <<16 ; - scmd->scsi_done (scmd); +scsi_done (scmd); goto out; }if (mrioc->stop_drv_processing && !(mpi3mr_allow_scmd_to_fw (scmd))) { scmd->result =DID_NO_CONNECT <<16 ; - scmd->scsi_done (scmd); +scsi_done (scmd); goto out; }
@@ -3459,19 +3459,19 @@ static int mpi3mr_qcmd(struct Scsi_Host *shost, dev_handle = stgt_priv_data->dev_handle;if (dev_handle ==MPI3MR_INVALID_DEV_HANDLE ) { scmd->result =DID_NO_CONNECT <<16 ; - scmd->scsi_done (scmd); +scsi_done (scmd); goto out; }if (stgt_priv_data->dev_removed) { scmd->result =DID_NO_CONNECT <<16 ; - scmd->scsi_done (scmd); +scsi_done (scmd); goto out; }if (atomic_read (&stgt_priv_data->block_io)) {if (mrioc->stop_drv_processing) { scmd->result =DID_NO_CONNECT <<16 ; - scmd->scsi_done (scmd); +scsi_done (scmd); goto out; } retval =SCSI_MLQUEUE_DEVICE_BUSY ;
@@ -3486,7 +3486,7 @@ static int mpi3mr_qcmd(struct Scsi_Host *shost, host_tag =mpi3mr_host_tag_for_scmd (mrioc, scmd);if (host_tag ==MPI3MR_HOSTTAG_INVALID ) { scmd->result =DID_ERROR <<16 ; - scmd->scsi_done (scmd); +scsi_done (scmd); goto out; }
Bart Van Assche
maintainerPATCH v2 52/84 mpt3sas: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/scsi/mpt3sas/mpt3sas_scsih.c +9 -9
@@ -3314,7 +3314,7 @@ scsih_abort(struct scsi_cmnd *scmd)sdev_printk (KERN_INFO , scmd->device,"device been deleted! scmd(0x%p)\n" , scmd); scmd->result =DID_NO_CONNECT <<16 ; - scmd->scsi_done (scmd); +scsi_done (scmd); r =SUCCESS ; goto out; }
@@ -3390,7 +3390,7 @@ scsih_dev_reset(struct scsi_cmnd *scmd)sdev_printk (KERN_INFO , scmd->device,"device been deleted! scmd(0x%p)\n" , scmd); scmd->result =DID_NO_CONNECT <<16 ; - scmd->scsi_done (scmd); +scsi_done (scmd); r =SUCCESS ; goto out; }
@@ -3470,7 +3470,7 @@ scsih_target_reset(struct scsi_cmnd *scmd)starget_printk (KERN_INFO , starget,"target been deleted! scmd(0x%p)\n" , scmd); scmd->result =DID_NO_CONNECT <<16 ; - scmd->scsi_done (scmd); +scsi_done (scmd); r =SUCCESS ; goto out; }
@@ -5030,7 +5030,7 @@ _scsih_flush_running_cmds(struct MPT3SAS_ADAPTER *ioc) scmd->result =DID_NO_CONNECT <<16 ; else scmd->result = DID_RESET << 16; - scmd->scsi_done (scmd); +scsi_done (scmd); }dtmprintk (ioc,ioc_info (ioc,"completing %d cmds\n" , count)); }
@@ -5139,13 +5139,13 @@ scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *scmd) sas_device_priv_data = scmd->device->hostdata;if (!sas_device_priv_data || !sas_device_priv_data->sas_target) { scmd->result =DID_NO_CONNECT <<16 ; - scmd->scsi_done (scmd); +scsi_done (scmd);return 0 ; }if (!(_scsih_allow_scmd_to_device (ioc, scmd))) { scmd->result =DID_NO_CONNECT <<16 ; - scmd->scsi_done (scmd); +scsi_done (scmd);return 0 ; }
@@ -5155,7 +5155,7 @@ scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *scmd) handle = sas_target_priv_data->handle;if (handle ==MPT3SAS_INVALID_DEVICE_HANDLE ) { scmd->result =DID_NO_CONNECT <<16 ; - scmd->scsi_done (scmd); +scsi_done (scmd);return 0 ; }
@@ -5166,7 +5166,7 @@ scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *scmd) }else if (sas_target_priv_data->deleted) {/* device has been deleted */ scmd->result =DID_NO_CONNECT <<16 ; - scmd->scsi_done (scmd); +scsi_done (scmd);return 0 ; }else if (sas_target_priv_data->tm_busy || sas_device_priv_data->block) {
@@ -5909,7 +5909,7 @@ _scsih_io_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply)scsi_dma_unmap (scmd);mpt3sas_base_free_smid (ioc, smid); - scmd->scsi_done (scmd); +scsi_done (scmd);return 0 ; }
Bart Van Assche
maintainerPATCH v2 53/84 mvumi: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/mvumi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/mvumi.c +2 -2
@@ -1328,7 +1328,7 @@ static void mvumi_complete_cmd(struct mvumi_hba *mhba, struct mvumi_cmd *cmd,dma_unmap_sg (&mhba->pdev->dev,scsi_sglist (scmd),scsi_sg_count (scmd), scmd->sc_data_direction); - cmd->scmd->scsi_done (scmd); +scsi_done (scmd);mvumi_return_cmd (mhba, cmd); }
@@ -2104,7 +2104,7 @@ static int mvumi_queue_command(struct Scsi_Host *shost, out_return_cmd:mvumi_return_cmd (mhba, cmd); - scmd->scsi_done (scmd); +scsi_done (scmd);spin_unlock_irqrestore (shost->host_lock, irq_flags);return 0 ; }
Bart Van Assche
maintainerPATCH v2 54/84 myrb: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/myrb.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-)
drivers/scsi/myrb.c +16 -16
@@ -1282,7 +1282,7 @@ static int myrb_pthru_queuecommand(struct Scsi_Host *shost,if (nsge >1 ) {dma_pool_free (cb->dcdb_pool, dcdb, dcdb_addr); scmd->result = (DID_ERROR <<16 ); - scmd->scsi_done (scmd); +scsi_done (scmd);return 0 ; }
@@ -1436,13 +1436,13 @@ static int myrb_ldev_queuecommand(struct Scsi_Host *shost,dev_dbg (&shost->shost_gendev,"ldev %u in state %x, skip\n" , sdev->id, ldev_info ? ldev_info->state :0xff ); scmd->result = (DID_BAD_TARGET <<16 ); - scmd->scsi_done (scmd); +scsi_done (scmd);return 0 ; }switch (scmd->cmnd[0 ]) {case TEST_UNIT_READY : scmd->result = (DID_OK <<16 ); - scmd->scsi_done (scmd); +scsi_done (scmd);return 0 ;case INQUIRY :if (scmd->cmnd[1 ] &1 ) {
@@ -1452,11 +1452,11 @@ static int myrb_ldev_queuecommand(struct Scsi_Host *shost,myrb_inquiry (cb, scmd); scmd->result = (DID_OK <<16 ); } - scmd->scsi_done (scmd); +scsi_done (scmd);return 0 ;case SYNCHRONIZE_CACHE : scmd->result = (DID_OK <<16 ); - scmd->scsi_done (scmd); +scsi_done (scmd);return 0 ;case MODE_SENSE : if ((scmd->cmnd[2] & 0x3F) != 0x3F &&
@@ -1467,25 +1467,25 @@ static int myrb_ldev_queuecommand(struct Scsi_Host *shost,myrb_mode_sense (cb, scmd, ldev_info); scmd->result = (DID_OK <<16 ); } - scmd->scsi_done (scmd); +scsi_done (scmd);return 0 ;case READ_CAPACITY :if ((scmd->cmnd[1 ] &1 ) || (scmd->cmnd[8 ] &1 )) {/* Illegal request, invalid field in CDB */ scsi_build_sense (scmd,0 ,ILLEGAL_REQUEST ,0x24 ,0 ); - scmd->scsi_done (scmd); +scsi_done (scmd);return 0 ; } lba =get_unaligned_be32 (&scmd->cmnd[2 ]);if (lba) {/* Illegal request, invalid field in CDB */ scsi_build_sense (scmd,0 ,ILLEGAL_REQUEST ,0x24 ,0 ); - scmd->scsi_done (scmd); +scsi_done (scmd);return 0 ; }myrb_read_capacity (cb, scmd, ldev_info); - scmd->scsi_done (scmd); +scsi_done (scmd);return 0 ;case REQUEST_SENSE :myrb_request_sense (cb, scmd);
@@ -1499,13 +1499,13 @@ static int myrb_ldev_queuecommand(struct Scsi_Host *shost,/* Assume good status */ scmd->result = (DID_OK <<16 ); } - scmd->scsi_done (scmd); +scsi_done (scmd);return 0 ;case READ_6 :if (ldev_info->state ==MYRB_DEVICE_WO ) {/* Data protect, attempt to read invalid data */ scsi_build_sense (scmd,0 ,DATA_PROTECT ,0x21 ,0x06 ); - scmd->scsi_done (scmd); +scsi_done (scmd);return 0 ; } fallthrough;
@@ -1519,7 +1519,7 @@ static int myrb_ldev_queuecommand(struct Scsi_Host *shost,if (ldev_info->state ==MYRB_DEVICE_WO ) {/* Data protect, attempt to read invalid data */ scsi_build_sense (scmd,0 ,DATA_PROTECT ,0x21 ,0x06 ); - scmd->scsi_done (scmd); +scsi_done (scmd);return 0 ; } fallthrough;
@@ -1533,7 +1533,7 @@ static int myrb_ldev_queuecommand(struct Scsi_Host *shost,if (ldev_info->state ==MYRB_DEVICE_WO ) {/* Data protect, attempt to read invalid data */ scsi_build_sense (scmd,0 ,DATA_PROTECT ,0x21 ,0x06 ); - scmd->scsi_done (scmd); +scsi_done (scmd);return 0 ; } fallthrough;
@@ -1546,7 +1546,7 @@ static int myrb_ldev_queuecommand(struct Scsi_Host *shost,default :/* Illegal request, invalid opcode */ scsi_build_sense (scmd,0 ,ILLEGAL_REQUEST ,0x20 ,0 ); - scmd->scsi_done (scmd); +scsi_done (scmd);return 0 ; }
@@ -1610,7 +1610,7 @@ static int myrb_queuecommand(struct Scsi_Host *shost,if (sdev->channel >myrb_logical_channel (shost)) { scmd->result = (DID_BAD_TARGET <<16 ); - scmd->scsi_done (scmd); +scsi_done (scmd);return 0 ; }if (sdev->channel ==myrb_logical_channel (shost))
@@ -2361,7 +2361,7 @@ static void myrb_handle_scsi(struct myrb_hba *cb, struct myrb_cmdblk *cmd_blk, scmd->result = (DID_ERROR <<16 );break ; } - scmd->scsi_done (scmd); +scsi_done (scmd); }static void myrb_handle_cmdblk (struct myrb_hba *cb,struct myrb_cmdblk *cmd_blk)
Bart Van Assche
maintainerPATCH v2 55/84 myrs: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/myrs.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/scsi/myrs.c +5 -5
@@ -1595,14 +1595,14 @@ static int myrs_queuecommand(struct Scsi_Host *shost,if (!scmd->device->hostdata) { scmd->result = (DID_NO_CONNECT <<16 ); - scmd->scsi_done (scmd); +scsi_done (scmd);return 0 ; }switch (scmd->cmnd[0 ]) {case REPORT_LUNS :scsi_build_sense (scmd,0 ,ILLEGAL_REQUEST ,0x20 ,0x0 ); - scmd->scsi_done (scmd); +scsi_done (scmd);return 0 ;case MODE_SENSE :if (scmd->device->channel >= cs->ctlr_info->physchan_present) {
@@ -1616,7 +1616,7 @@ static int myrs_queuecommand(struct Scsi_Host *shost,myrs_mode_sense (cs, scmd, ldev_info); scmd->result = (DID_OK <<16 ); } - scmd->scsi_done (scmd); +scsi_done (scmd);return 0 ; }break ;
@@ -1756,7 +1756,7 @@ static int myrs_queuecommand(struct Scsi_Host *shost,if (WARN_ON (!hw_sgl)) {scsi_dma_unmap (scmd); scmd->result = (DID_ERROR <<16 ); - scmd->scsi_done (scmd); +scsi_done (scmd);return 0 ; } hw_sgl->sge_addr = (u64 )sg_dma_address (sgl);
@@ -2083,7 +2083,7 @@ static void myrs_handle_scsi(struct myrs_hba *cs, struct myrs_cmdblk *cmd_blk, scmd->result = (DID_BAD_TARGET <<16 ); else scmd->result = (DID_OK << 16) | status; - scmd->scsi_done (scmd); +scsi_done (scmd); }static void myrs_handle_cmdblk (struct myrs_hba *cs,struct myrs_cmdblk *cmd_blk)
Bart Van Assche
maintainerPATCH v2 56/84 ncr53c8xx: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/ncr53c8xx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/ncr53c8xx.c +1 -2
@@ -4006,7 +4006,7 @@ static inline void ncr_flush_done_cmds(struct scsi_cmnd *lcmd)while (lcmd) { cmd = lcmd; lcmd = (struct scsi_cmnd *) cmd->host_scribble; - cmd->scsi_done (cmd); +scsi_done (cmd); } }
@@ -7865,7 +7865,6 @@ static int ncr53c8xx_queue_command_lck (struct scsi_cmnd *cmd, void (*done)(struprintk ("ncr53c8xx_queue_command\n" );#endif - cmd->scsi_done = done; cmd->host_scribble =NULL ; cmd->__data_mapped =0 ; cmd->__data_mapping =0 ;
Bart Van Assche
maintainerPATCH v2 57/84 nsp32: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/nsp32.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/nsp32.c +1 -2
@@ -945,7 +945,6 @@ static int nsp32_queuecommand_lck(struct scsi_cmnd *SCpnt,show_command (SCpnt); - SCpnt->scsi_done = done; data->CurrentSC = SCpnt; SCpnt->SCp.Status =SAM_STAT_CHECK_CONDITION ;scsi_set_resid (SCpnt,scsi_bufflen (SCpnt));
@@ -1546,7 +1545,7 @@ static void nsp32_scsi_done(struct scsi_cmnd *SCpnt)/* * call scsi_done */ - (*SCpnt->scsi_done)(SCpnt); +scsi_done (SCpnt);/* * reset parameters
Masanori Goto
maintainerRe: [PATCH v2 57/84] nsp32: Call scsi_done() directly
Indeed this is a no-op change, but in a different thread, one interesting question raised was to remove scsi_done* in the argument of queuecommand_lck, so that the change is much cleaner and generic. Could you conduct a research on whether it's removal or not? I'd like to hear from the overall SCSI maintainer perspective too. Also, I'm curious why the IOPS was improved - what kind of device drives did you use? Specifically, nsp32 was designed for PCI based devices so it cannot handle millions of QPS - so this change has unlikely an impact to the performance gain. This comes back to the first scsi_done question on whether this overall framework should be changed or not.
Bart Van Assche
maintainerRe: [PATCH v2 57/84] nsp32: Call scsi_done() directly
Quoted 11 lines · Masanori Goto
Indeed this is a no-op change, but in a different thread, one interesting question raised was to remove scsi_done* in the argument of
queuecommand_lck, so that the change is much cleaner and generic. Could you conduct a research on whether it's removal or not? I'd like to hear from the overall SCSI maintainer perspective too. Also, I'm curious why the IOPS was improved - what kind of device drives did you use? Specifically, nsp32 was designed for PCI based devices so it cannot handle millions of QPS - so this change has unlikely an impact to the performance gain. This comes back to the firstscsi_donequestion on whether this overall framework should be changed or not.
Hi Masanori,
I will include a patch in the next version of this series that removes the 'done' argument from those SCSI LLDs that use DEF_SCSI_QCMD().
The script that I used to measure the performance difference is available
here: https://lore.kernel.org/linux-scsi/[email protected]/T/#m7ab39cf1c14016b833c935f897eb406e0011dafe
I do not expect this patch series to affect the performance of the nsp32 driver. All SCSI LLDs have to be modified because patch 84/84 removes the scsi_done member from struct scsi_cmnd.
Thanks,
Bart.
Bart Van Assche
maintainerPATCH v2 58/84 pcmcia: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/pcmcia/nsp_cs.c | 4 +--- drivers/scsi/pcmcia/sym53c500_cs.c | 3 +-- 2 files changed, 2 insertions(+), 5 deletions(-)
drivers/scsi/pcmcia/nsp_cs.c +1 -3
@@ -178,7 +178,7 @@ static void nsp_scsi_done(struct scsi_cmnd *SCpnt) data->CurrentSC =NULL ; - SCpnt->scsi_done (SCpnt); +scsi_done (SCpnt); } static int nsp_queuecommand_lck(struct scsi_cmnd *SCpnt,
@@ -197,8 +197,6 @@ static int nsp_queuecommand_lck(struct scsi_cmnd *SCpnt, scsi_bufflen(SCpnt), scsi_sg_count(SCpnt));//nsp_dbg(NSP_DEBUG_QUEUECOMMAND, "before CurrentSC=0x%p", data->CurrentSC); - SCpnt->scsi_done = done; -if (data->CurrentSC !=NULL ) {nsp_msg (KERN_DEBUG ,"CurrentSC!=NULL this can't be happen" ); SCpnt->result =DID_BAD_TARGET <<16 ;
drivers/scsi/pcmcia/sym53c500_cs.c +1 -2
@@ -492,7 +492,7 @@ SYM53C500_intr(int irq, void *dev_id) idle_out: curSC->SCp.phase = idle; - curSC->scsi_done (curSC); +scsi_done (curSC); goto out; }
@@ -556,7 +556,6 @@ SYM53C500_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))VDEB (printk ("\n" )); data->current_SC = SCpnt; - data->current_SC->scsi_done = done; data->current_SC->SCp.phase = command_ph; data->current_SC->SCp.Status =0 ; data->current_SC->SCp.Message =0 ;
Bart Van Assche
maintainerPATCH v2 59/84 pmcraid: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/pmcraid.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/scsi/pmcraid.c +5 -6
@@ -837,7 +837,7 @@ static void pmcraid_erp_done(struct pmcraid_cmd *cmd)scsi_dma_unmap (scsi_cmd);pmcraid_return_cmd (cmd); - scsi_cmd->scsi_done (scsi_cmd); +scsi_done (scsi_cmd); }/**
@@ -2017,7 +2017,7 @@ static void pmcraid_fail_outstanding_cmds(struct pmcraid_instance *pinstance)le32_to_cpu (resp) >>2 , cmd->ioa_cb->ioarcb.cdb[0 ], scsi_cmd->result); - scsi_cmd->scsi_done (scsi_cmd); +scsi_done (scsi_cmd); }else if (cmd->cmd_done == pmcraid_internal_done || cmd->cmd_done == pmcraid_erp_done) { cmd->cmd_done (cmd);
@@ -2814,7 +2814,7 @@ static int _pmcraid_io_done(struct pmcraid_cmd *cmd, int reslen, int ioasc)if (rc ==0 ) {scsi_dma_unmap (scsi_cmd); - scsi_cmd->scsi_done (scsi_cmd); +scsi_done (scsi_cmd); }return rc;
@@ -3328,7 +3328,6 @@ static int pmcraid_queuecommand_lck( pinstance = (struct pmcraid_instance *)scsi_cmd->device->host->hostdata; fw_version =be16_to_cpu (pinstance->inq_data->fw_version); - scsi_cmd->scsi_done = done; res = scsi_cmd->device->hostdata; scsi_cmd->result = (DID_OK <<16 );
@@ -3338,7 +3337,7 @@ static int pmcraid_queuecommand_lck(if (pinstance->ioa_state ==IOA_STATE_DEAD ) {pmcraid_info ("IOA is dead, but queuecommand is scheduled\n" ); scsi_cmd->result = (DID_NO_CONNECT <<16 ); - scsi_cmd->scsi_done (scsi_cmd); +scsi_done (scsi_cmd);return 0 ; }
@@ -3351,7 +3350,7 @@ static int pmcraid_queuecommand_lck(*/ if (scsi_cmd->cmnd[0 ] ==SYNCHRONIZE_CACHE ) {pmcraid_info ("SYNC_CACHE(0x35), completing in driver itself\n" ); - scsi_cmd->scsi_done (scsi_cmd); +scsi_done (scsi_cmd);return 0 ; }
Bart Van Assche
maintainerPATCH v2 60/84 ppa: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/ppa.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/ppa.c +1 -2
@@ -665,7 +665,7 @@ static void ppa_interrupt(struct work_struct *work) dev->cur_cmd =NULL ; - cmd->scsi_done (cmd); +scsi_done (cmd); }static int ppa_engine (ppa_struct *dev,struct scsi_cmnd *cmd)
@@ -798,7 +798,6 @@ static int ppa_queuecommand_lck(struct scsi_cmnd *cmd, dev->failed =0 ; dev->jstart = jiffies; dev->cur_cmd = cmd; - cmd->scsi_done = done; cmd->result =DID_ERROR <<16 ;/* default return code */ cmd->SCp.phase =0 ;/* bus free */
Bart Van Assche
maintainerPATCH v2 61/84 ps3rom: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/ps3rom.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/scsi/ps3rom.c +2 -3
@@ -209,7 +209,6 @@ static int ps3rom_queuecommand_lck(struct scsi_cmnd *cmd,int res; priv->curr_cmd = cmd; - cmd->scsi_done = done; opcode = cmd->cmnd[0 ];/*
@@ -237,7 +236,7 @@ static int ps3rom_queuecommand_lck(struct scsi_cmnd *cmd,scsi_build_sense (cmd,0 ,ILLEGAL_REQUEST ,0 ,0 ); cmd->result = res; priv->curr_cmd =NULL ; - cmd->scsi_done (cmd); +scsi_done (cmd); }return 0 ;
@@ -321,7 +320,7 @@ static irqreturn_t ps3rom_interrupt(int irq, void *data) done: priv->curr_cmd =NULL ; - cmd->scsi_done (cmd); +scsi_done (cmd);return IRQ_HANDLED ; }
Bart Van Assche
maintainerPATCH v2 62/84 qedf: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/qedf/qedf_io.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-)
drivers/scsi/qedf/qedf_io.c +6 -13
@@ -947,7 +947,7 @@ qedf_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc_cmd)"Number of SG elements %d exceeds what hardware limitation of %d.\n" , num_sgs, QEDF_MAX_BDS_PER_CMD); sc_cmd->result =DID_ERROR ; - sc_cmd->scsi_done (sc_cmd); +scsi_done (sc_cmd);return 0 ; }
@@ -957,7 +957,7 @@ qedf_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc_cmd)"Returning DNC as unloading or stop io, flags 0x%lx.\n" , qedf->flags); sc_cmd->result =DID_NO_CONNECT <<16 ; - sc_cmd->scsi_done (sc_cmd); +scsi_done (sc_cmd);return 0 ; }
@@ -966,7 +966,7 @@ qedf_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc_cmd)"Completing sc_cmd=%p DID_NO_CONNECT as MSI-X is not enabled.\n" , sc_cmd); sc_cmd->result =DID_NO_CONNECT <<16 ; - sc_cmd->scsi_done (sc_cmd); +scsi_done (sc_cmd);return 0 ; }
@@ -976,7 +976,7 @@ qedf_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc_cmd)"fc_remote_port_chkready failed=0x%x for port_id=0x%06x.\n" , rval, rport->port_id); sc_cmd->result = rval; - sc_cmd->scsi_done (sc_cmd); +scsi_done (sc_cmd);return 0 ; }
@@ -1313,7 +1313,7 @@ void qedf_scsi_completion(struct qedf_ctx *qedf, struct fcoe_cqe *cqe, io_req->sc_cmd =NULL ; sc_cmd->SCp.ptr =NULL ; - sc_cmd->scsi_done (sc_cmd); +scsi_done (sc_cmd);kref_put (&io_req->refcount, qedf_release_cmd); }
@@ -1386,13 +1386,6 @@ void qedf_scsi_done(struct qedf_ctx *qedf, struct qedf_ioreq *io_req, goto bad_scsi_ptr; } -if (!sc_cmd->scsi_done) { -QEDF_ERR (&qedf->dbg_ctx, -"sc_cmd->scsi_done for sc_cmd %p is NULL.\n" , - sc_cmd); - goto bad_scsi_ptr; - } -qedf_unmap_sg_list (qedf, io_req); sc_cmd->result = result <<16 ;
@@ -1417,7 +1410,7 @@ void qedf_scsi_done(struct qedf_ctx *qedf, struct qedf_ioreq *io_req, io_req->sc_cmd =NULL ; sc_cmd->SCp.ptr =NULL ; - sc_cmd->scsi_done (sc_cmd); +scsi_done (sc_cmd);kref_put (&io_req->refcount, qedf_release_cmd);return ;
Bart Van Assche
maintainerPATCH v2 63/84 qla1280: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/qla1280.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/scsi/qla1280.c +2 -3
@@ -697,7 +697,6 @@ qla1280_queuecommand_lck(struct scsi_cmnd *cmd, void (*fn)(struct scsi_cmnd *))struct srb *sp = (struct srb *)CMD_SP (cmd);int status; - cmd->scsi_done = fn; sp->cmd = cmd; sp->flags =0 ; sp->wait =NULL ;
@@ -755,7 +754,7 @@ _qla1280_wait_for_single_command(struct scsi_qla_host *ha, struct srb *sp, sp->wait =NULL ;if (CMD_HANDLE (cmd) ==COMPLETED_HANDLE ) { status =SUCCESS ; - (*cmd->scsi_done)(cmd); +scsi_done (cmd); }return status; }
@@ -1277,7 +1276,7 @@ qla1280_done(struct scsi_qla_host *ha) ha->actthreads--;if (sp->wait ==NULL ) - (*(cmd)->scsi_done)(cmd); +scsi_done (cmd);else complete (sp->wait); }
Bart Van Assche
maintainerPATCH v2 64/84 qla2xxx: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/qla2xxx/qla_os.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/qla2xxx/qla_os.c +4 -4
@@ -737,7 +737,7 @@ void qla2x00_sp_compl(srb_t *sp, int res) sp->free (sp); cmd->result = res;CMD_SP (cmd) =NULL ; - cmd->scsi_done (cmd); +scsi_done (cmd);if (comp)complete (comp); }
@@ -828,7 +828,7 @@ void qla2xxx_qpair_sp_compl(srb_t *sp, int res) sp->free (sp); cmd->result = res;CMD_SP (cmd) =NULL ; - cmd->scsi_done (cmd); +scsi_done (cmd);if (comp)complete (comp); }
@@ -950,7 +950,7 @@ qla2xxx_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)return SCSI_MLQUEUE_TARGET_BUSY ; qc24_fail_command: - cmd->scsi_done (cmd); +scsi_done (cmd);return 0 ; }
@@ -1038,7 +1038,7 @@ qla2xxx_mqueuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd,return SCSI_MLQUEUE_TARGET_BUSY ; qc24_fail_command: - cmd->scsi_done (cmd); +scsi_done (cmd);return 0 ; }
Bart Van Assche
maintainerPATCH v2 65/84 qla4xxx: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/qla4xxx/ql4_os.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/qla4xxx/ql4_os.c +2 -2
@@ -4080,7 +4080,7 @@ void qla4xxx_srb_compl(struct kref *ref)mempool_free (srb, ha->srb_mempool); - cmd->scsi_done (cmd); +scsi_done (cmd); }/**
@@ -4154,7 +4154,7 @@ static int qla4xxx_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)return SCSI_MLQUEUE_HOST_BUSY ; qc_fail_command: - cmd->scsi_done (cmd); +scsi_done (cmd);return 0 ; }
Bart Van Assche
maintainerPATCH v2 66/84 qlogicfas408: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/qlogicfas408.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/qlogicfas408.c +1 -2
@@ -442,7 +442,7 @@ static void ql_ihandl(void *dev_id)* If result is CHECK CONDITION done calls qcommand to request * sense */ - (icmd->scsi_done) (icmd); +scsi_done (icmd); }irqreturn_t qlogicfas408_ihandl (int irq,void *dev_id)
@@ -473,7 +473,6 @@ static int qlogicfas408_queuecommand_lck(struct scsi_cmnd *cmd,return 0 ; } - cmd->scsi_done = done;/* wait for the last command's interrupt to finish */ while (priv->qlcmd !=NULL ) {barrier ();
Bart Van Assche
maintainerPATCH v2 67/84 qlogicpti: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/qlogicpti.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/scsi/qlogicpti.c +1 -3
@@ -1021,8 +1021,6 @@ static int qlogicpti_queuecommand_lck(struct scsi_cmnd *Cmnd, void (*done)(strucu_int out_ptr;int in_ptr; - Cmnd->scsi_done = done; - in_ptr = qpti->req_in_ptr; cmd = (struct Command_Entry *) &qpti->req_cpu[in_ptr]; out_ptr =sbus_readw (qpti->qregs +MBOX4 );
@@ -1214,7 +1212,7 @@ static irqreturn_t qpti_intr(int irq, void *dev_id)struct scsi_cmnd *next; next = (struct scsi_cmnd *) dq->host_scribble; - dq->scsi_done (dq); +scsi_done (dq); dq = next; }while (dq !=NULL ); }
Bart Van Assche
maintainerPATCH v2 68/84 scsi_debug: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/scsi_debug.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/scsi_debug.c +4 -4
@@ -4809,7 +4809,7 @@ static void sdebug_q_cmd_complete(struct sdebug_defer *sd_dp)pr_info ("bypassing scsi_done() due to aborted cmd\n" );return ; } - scp->scsi_done (scp);/* callback to mid level */ +scsi_done (scp);/* callback to mid level */ }/* When high resolution timer goes off this function is called. */
@@ -5524,7 +5524,7 @@ static int schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip,if (new_sd_dp)kfree (sd_dp);/* call scsi_done() from this thread */ - cmnd->scsi_done (cmnd); +scsi_done (cmnd);return 0 ; }/* otherwise reduce kt by elapsed time */
@@ -5604,7 +5604,7 @@ static int schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip, cmnd->result &= ~SDEG_RES_IMMED_MASK ;if (cmnd->result ==0 && scsi_result !=0 ) cmnd->result = scsi_result; - cmnd->scsi_done (cmnd); +scsi_done (cmnd);return 0 ; }
@@ -7363,7 +7363,7 @@ static int sdebug_blk_mq_poll(struct Scsi_Host *shost, unsigned int queue_num) } sd_dp->defer_t =SDEB_DEFER_NONE ;spin_unlock_irqrestore (&sqp->qc_lock, iflags); - scp->scsi_done (scp);/* callback to mid level */ +scsi_done (scp);/* callback to mid level */ spin_lock_irqsave (&sqp->qc_lock, iflags); num_entries++; }
Bart Van Assche
maintainerPATCH v2 69/84 smartpqi: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/smartpqi/smartpqi_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/smartpqi/smartpqi_init.c +1 -1
@@ -194,7 +194,7 @@ static char *pqi_raid_level_to_string(u8 raid_level)static inline void pqi_scsi_done (struct scsi_cmnd *scmd) {pqi_prep_for_scsi_done (scmd); - scmd->scsi_done (scmd); +scsi_done (scmd); }static inline void pqi_disable_write_same (struct scsi_device *sdev)
Bart Van Assche
maintainerPATCH v2 70/84 snic: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/snic/snic_scsi.c | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-)
drivers/scsi/snic/snic_scsi.c +14 -19
@@ -342,7 +342,7 @@ snic_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *sc)SNIC_HOST_ERR (shost,"Tgt %p id %d Not Ready.\n" , tgt, tgt->id);atomic64_inc (&snic->s_stats.misc.tgt_not_rdy); sc->result = ret; - sc->scsi_done (sc); +scsi_done (sc);return 0 ; }
@@ -676,8 +676,7 @@ snic_icmnd_cmpl_handler(struct snic *snic, struct snic_fw_req *fwreq) SNIC_TRC_CMD(sc), SNIC_TRC_CMD_STATE_FLAGS(sc)); -if (sc->scsi_done) - sc->scsi_done (sc); +scsi_done (sc);snic_stats_update_io_cmpl (&snic->s_stats); }/* end of snic_icmnd_cmpl_handler */
@@ -855,14 +854,12 @@ snic_process_itmf_cmpl(struct snic *snic,snic_release_req_buf (snic, rqi, sc); -if (sc->scsi_done) { -SNIC_TRC (snic->shost->host_no, cmnd_id, (ulong ) sc, -jiffies_to_msecs (jiffies - start_time), - (ulong ) fwreq,SNIC_TRC_CMD (sc), -SNIC_TRC_CMD_STATE_FLAGS (sc)); +SNIC_TRC (snic->shost->host_no, cmnd_id, (ulong ) sc, +jiffies_to_msecs (jiffies - start_time), + (ulong ) fwreq,SNIC_TRC_CMD (sc), +SNIC_TRC_CMD_STATE_FLAGS (sc)); - sc->scsi_done (sc); - } +scsi_done (sc);break ;
@@ -1475,7 +1472,7 @@ snic_abort_finish(struct snic *snic, struct scsi_cmnd *sc)* Call scsi_done to complete the IO. */ sc->result = (DID_ERROR <<16 ); - sc->scsi_done (sc); +scsi_done (sc);break ;default :
@@ -1855,7 +1852,7 @@ snic_dr_clean_single_req(struct snic *snic,snic_release_req_buf (snic, rqi, sc); sc->result = (DID_ERROR <<16 ); - sc->scsi_done (sc); +scsi_done (sc); ret =0 ;
@@ -2500,14 +2497,12 @@ snic_scsi_cleanup(struct snic *snic, int ex_tag)/* Update IO stats */ snic_stats_update_io_cmpl (&snic->s_stats); -if (sc->scsi_done) { -SNIC_TRC (snic->shost->host_no, tag, (ulong ) sc, -jiffies_to_msecs (jiffies - st_time),0 , -SNIC_TRC_CMD (sc), -SNIC_TRC_CMD_STATE_FLAGS (sc)); +SNIC_TRC (snic->shost->host_no, tag, (ulong ) sc, +jiffies_to_msecs (jiffies - st_time),0 , +SNIC_TRC_CMD (sc), +SNIC_TRC_CMD_STATE_FLAGS (sc)); - sc->scsi_done (sc); - } +scsi_done (sc); } }/* end of snic_scsi_cleanup */
Bart Van Assche
maintainerPATCH v2 71/84 stex: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/stex.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/scsi/stex.c +2 -4
@@ -574,7 +574,7 @@ static void return_abnormal_state(struct st_hba *hba, int status)if (ccb->cmd) {scsi_dma_unmap (ccb->cmd); ccb->cmd->result = status <<16 ; - ccb->cmd->scsi_done (ccb->cmd); +scsi_done (ccb->cmd); ccb->cmd =NULL ; } }
@@ -688,8 +688,6 @@ stex_queuecommand_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))break ; } - cmd->scsi_done = done; - tag =scsi_cmd_to_rq (cmd)->tag;if (unlikely (tag >= host->can_queue))
@@ -764,7 +762,7 @@ static void stex_scsi_done(struct st_ccb *ccb) } cmd->result = result; - cmd->scsi_done (cmd); +scsi_done (cmd); } static void stex_copy_data(struct st_ccb *ccb,
Bart Van Assche
maintainerPATCH v2 72/84 storvsc_drv: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/storvsc_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/storvsc_drv.c +2 -2
@@ -1154,7 +1154,7 @@ static void storvsc_command_completion(struct storvsc_cmd_request *cmd_request,scsi_set_resid (scmnd, cmd_request->payload->range.len - data_transfer_length); - scmnd->scsi_done (scmnd); +scsi_done (scmnd);if (payload_sz >sizeof (struct vmbus_channel_packet_multipage_buffer ))
@@ -1753,7 +1753,7 @@ static int storvsc_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *scmnd)* future versions of the host. */ if (!storvsc_scsi_cmd_ok (scmnd)) { - scmnd->scsi_done (scmnd); +scsi_done (scmnd);return 0 ; } }
RE: [PATCH v2 72/84] storvsc_drv: Call scsi_done() directly
Quoted 44 lines
-----Original Message-----
From: Bart Van Assche <[email protected]>
Sent: Wednesday, September 29, 2021 6:06 PM
To: Martin K . Petersen <[email protected]>
Cc: [email protected]; Bart Van Assche <[email protected]>; KY Srinivasan <[email protected]>; Haiyang Zhang <[email protected]>; Stephen Hemminger <[email protected]>; Wei Liu <[email protected]>; Dexuan Cui <[email protected]>; James E.J. Bottomley <[email protected]>
Subject: [PATCH v2 72/84]storvsc_drv: Callscsi_done()directlyConditional statements are faster than indirect calls. Hence call
scsi_done()directly.Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/storvsc_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/scsi/storvsc_drv.c +1
-1@@ -1154,7 +1154,7 @@ static void storvsc_command_completion(struct storvsc_cmd_request *cmd_request,scsi_set_resid (scmnd, cmd_request->payload->range.len - data_transfer_length); - scmnd->scsi_done (scmnd); +scsi_done (scmnd); if (payload_sz >drivers/scsi/storvsc_drv.c +1
-1sizeof(struct vmbus_channel_packet_multipage_buffer))@@ -1753,7 +1753,7 @@ static int storvsc_queuecommand(struct Scsi_Host*host, struct scsi_cmnd *scmnd) * future versions of the host. */ if (!storvsc_scsi_cmd_ok (scmnd)) { - scmnd->scsi_done (scmnd); +scsi_done (scmnd);return 0 ; }
Quoted 1 line
}
Thanks.
Wei Liu
maintainerRe: [PATCH v2 72/84] storvsc_drv: Call scsi_done() directly
Quoted 4 lines · Haiyang Zhang
Quoted 4 lines
-----Original Message-----
From: Bart Van Assche <[email protected]>
[...]
Quoted 3 lines
Thanks.
Reviewed-by Haiyang Zhang <[email protected]>
Bart, Martin and Haiyang,
Seeing this patch is part of a large patch series, I am expecting whoever funnels the whole series applies this patch together with other patches. Let me know if I should do anything else.
Wei.
Bart Van Assche
maintainerRe: [PATCH v2 72/84] storvsc_drv: Call scsi_done() directly
Quoted 3 lines · Wei Liu
Seeing this patch is part of a large patch series, I am expecting whoever funnels the whole series applies this patch together with other patches. Let me know if I should do anything else.
Hi Wei,
This patch series has been sent to Martin Petersen, the SCSI maintainer. I hope that Martin will merge this series in its entirety.
Thanks,
Bart.
Bart Van Assche
maintainerPATCH v2 73/84 sym53c8xx_2: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/sym53c8xx_2/sym_glue.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/sym53c8xx_2/sym_glue.c +1 -2
@@ -133,7 +133,7 @@ void sym_xpt_done(struct sym_hcb *np, struct scsi_cmnd *cmd)complete (ucmd->eh_done);scsi_dma_unmap (cmd); - cmd->scsi_done (cmd); +scsi_done (cmd); }/*
@@ -493,7 +493,6 @@ static int sym53c8xx_queue_command_lck(struct scsi_cmnd *cmd,struct sym_ucmd *ucp =SYM_UCMD_PTR (cmd);int sts =0 ; - cmd->scsi_done = done;memset (ucp,0 ,sizeof (*ucp));/*
Bart Van Assche
maintainerPATCH v2 74/84 ufs: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/ufs/ufshcd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/ufs/ufshcd.c +3 -3
@@ -2702,7 +2702,7 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)if (hba->pm_op_in_progress) { hba->force_reset = true;set_host_byte (cmd,DID_BAD_TARGET ); - cmd->scsi_done (cmd); +scsi_done (cmd); goto out; } fallthrough;
@@ -2711,7 +2711,7 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) goto out;case UFSHCD_STATE_ERROR :set_host_byte (cmd,DID_ERROR ); - cmd->scsi_done (cmd); +scsi_done (cmd); goto out; }
@@ -5294,7 +5294,7 @@ static void __ufshcd_transfer_req_compl(struct ufs_hba *hba,/* Mark completed command as NULL in LRB */ lrbp->cmd =NULL ;/* Do not touch lrbp after scsi done */ - cmd->scsi_done (cmd); +scsi_done (cmd);ufshcd_release (hba); update_scaling = true; } else if (lrbp->command_type == UTP_CMD_TYPE_DEV_MANAGE ||
Re: [PATCH v2 74/84] ufs: Call scsi_done() directly
Quoted 7 lines · Bart Van Assche
Conditional statements are faster than indirect calls. Hence call
scsi_done()directly.Signed-off-by Bart Van Assche <[email protected]>
Bart Van Assche
maintainerPATCH v2 75/84 virtio_scsi: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly. Additionally, update a comment that refers to the REQ_ATOM_COMPLETE flag since that flag has been removed a long time ago.
--- drivers/scsi/virtio_scsi.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/scsi/virtio_scsi.c +3 -4
@@ -163,7 +163,7 @@ static void virtscsi_complete_cmd(struct virtio_scsi *vscsi, void *buf) VIRTIO_SCSI_SENSE_SIZE)); } - sc->scsi_done (sc); +scsi_done (sc); } static void virtscsi_vq_done(struct virtio_scsi *vscsi,
@@ -619,9 +619,8 @@ static int virtscsi_tmf(struct virtio_scsi *vscsi, struct virtio_scsi_cmd *cmd)* we're using independent interrupts (e.g. MSI). Poll the * virtqueues once. * -* In the abort case, sc->scsi_done will do nothing, because -* the block layer must have detected a timeout and as a result -* REQ_ATOM_COMPLETE has been set. +* In the abort case, scsi_done() will do nothing, because the +* command timed out and hence SCMD_STATE_COMPLETE has been set. */ virtscsi_poll_requests (vscsi);
Bart Van Assche
maintainerPATCH v2 76/84 vmw_pvscsi: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/vmw_pvscsi.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/scsi/vmw_pvscsi.c +3 -4
@@ -643,7 +643,7 @@ static void pvscsi_complete_request(struct pvscsi_adapter *adapter,"cmd=%p %x ctx=%p result=0x%x status=0x%x,%x\n" , cmd, cmd->cmnd[0], ctx, cmd->result, btstat, sdstat); - cmd->scsi_done (cmd); +scsi_done (cmd); }/*
@@ -786,7 +786,6 @@ static int pvscsi_queue_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmndreturn SCSI_MLQUEUE_HOST_BUSY ; } - cmd->scsi_done = done; op = cmd->cmnd[0 ]; dev_dbg(&cmd->device->sdev_gendev,
@@ -860,7 +859,7 @@ static int pvscsi_abort(struct scsi_cmnd *cmd)* Successfully aborted the command. */ cmd->result = (DID_ABORT <<16 ); - cmd->scsi_done (cmd); +scsi_done (cmd); out:spin_unlock_irqrestore (&adapter->hw_lock, flags);
@@ -887,7 +886,7 @@ static void pvscsi_reset_all(struct pvscsi_adapter *adapter)pvscsi_patch_sense (cmd);pvscsi_release_context (adapter, ctx); cmd->result = (DID_RESET <<16 ); - cmd->scsi_done (cmd); +scsi_done (cmd); } } }
Bart Van Assche
maintainerPATCH v2 77/84 wd33c93: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/wd33c93.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/scsi/wd33c93.c +6 -8
@@ -376,11 +376,9 @@ wd33c93_queuecommand_lck(struct scsi_cmnd *cmd,/* Set up a few fields in the scsi_cmnd structure for our own use: * - host_scribble is the pointer to the next cmd in the input queue -* - scsi_done points to the routine we call when a cmd is finished * - result is what you'd expect */ cmd->host_scribble =NULL ; - cmd->scsi_done = done; cmd->result =0 ;/* We use the Scsi_Pointer structure that's included with each command
@@ -856,7 +854,7 @@ wd33c93_intr(struct Scsi_Host *instance) cmd->result =DID_NO_CONNECT <<16 ; hostdata->busy[cmd->device->id] &= ~(1 << (cmd->device->lun &0xff )); hostdata->state =S_UNCONNECTED ; - cmd->scsi_done (cmd); +scsi_done (cmd);/* From esp.c: * There is a window of time within the scsi_done() path
@@ -1183,7 +1181,7 @@ wd33c93_intr(struct Scsi_Host *instance)scsi_msg_to_host_byte (cmd, cmd->SCp.Message);set_status_byte (cmd, cmd->SCp.Status); } - cmd->scsi_done (cmd); +scsi_done (cmd);/* We are no longer connected to a target - check to see if * there are commands waiting to be executed.
@@ -1270,7 +1268,7 @@ wd33c93_intr(struct Scsi_Host *instance)scsi_msg_to_host_byte (cmd, cmd->SCp.Message);set_status_byte (cmd, cmd->SCp.Status); } - cmd->scsi_done (cmd); +scsi_done (cmd);/* We are no longer connected to a target - check to see if * there are commands waiting to be executed.
@@ -1306,7 +1304,7 @@ wd33c93_intr(struct Scsi_Host *instance)scsi_msg_to_host_byte (cmd, cmd->SCp.Message);set_status_byte (cmd, cmd->SCp.Status); } - cmd->scsi_done (cmd); +scsi_done (cmd);break ;case S_PRE_TMP_DISC :case S_RUNNING_LEVEL2 :
@@ -1636,7 +1634,7 @@ wd33c93_abort(struct scsi_cmnd * cmd) ("scsi%d: Abort - removing command from input_Q. " , instance->host_no);enable_irq (cmd->device->host->irq); - cmd->scsi_done (cmd); +scsi_done (cmd);return SUCCESS ; } prev = tmp;
@@ -1711,7 +1709,7 @@ wd33c93_abort(struct scsi_cmnd * cmd)wd33c93_execute (instance);enable_irq (cmd->device->host->irq); - cmd->scsi_done (cmd); +scsi_done (cmd);return SUCCESS ; }
Bart Van Assche
maintainerPATCH v2 78/84 wd719x: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/wd719x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/wd719x.c +2 -2
@@ -200,7 +200,7 @@ static void wd719x_finish_cmd(struct wd719x_scb *scb, int result) SCSI_SENSE_BUFFERSIZE, DMA_FROM_DEVICE); cmd->result = result <<16 ; - cmd->scsi_done (cmd); +scsi_done (cmd); }/* Build a SCB and send it to the card */
@@ -295,7 +295,7 @@ static int wd719x_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *cmd) DMA_BIDIRECTIONAL); out_error: cmd->result =DID_ERROR <<16 ; - cmd->scsi_done (cmd); +scsi_done (cmd);return 0 ; }
Bart Van Assche
maintainerPATCH v2 79/84 xen-scsifront: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/scsi/xen-scsifront.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/xen-scsifront.c +2 -2
@@ -276,7 +276,7 @@ static void scsifront_cdb_cmd_done(struct vscsifrnt_info *info,if (sense_len)memcpy (sc->sense_buffer, ring_rsp->sense_buffer, sense_len); - sc->scsi_done (sc); +scsi_done (sc); } static void scsifront_sync_cmd_done(struct vscsifrnt_info *info,
@@ -558,7 +558,7 @@ static int scsifront_queuecommand(struct Scsi_Host *shost,if (err == -ENOMEM )return SCSI_MLQUEUE_HOST_BUSY ; sc->result =DID_ERROR <<16 ; - sc->scsi_done (sc); +scsi_done (sc);return 0 ; }
Bart Van Assche
maintainerPATCH v2 80/84 staging: rts5208: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/staging/rts5208/rtsx.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/staging/rts5208/rtsx.c +2 -3
@@ -140,7 +140,6 @@ static int queuecommand_lck(struct scsi_cmnd *srb, }/* enqueue the command and wake up the control thread */ - srb->scsi_done = done; chip->srb = srb;complete (&dev->cmnd_ready);
@@ -423,7 +422,7 @@ static int rtsx_control_thread(void *__dev)/* indicate that the command is done */ else if (chip->srb->result != DID_ABORT << 16) { - chip->srb->scsi_done (chip->srb); +scsi_done (chip->srb); } else { skip_for_abort:dev_err (&dev->pci->dev,"scsi command aborted\n" );
@@ -635,7 +634,7 @@ static void quiesce_and_remove_host(struct rtsx_dev *dev)if (chip->srb) { chip->srb->result =DID_NO_CONNECT <<16 ;scsi_lock (host); - chip->srb->scsi_done (dev->chip->srb); +scsi_done (dev->chip->srb); chip->srb =NULL ;scsi_unlock (host); }
Bart Van Assche
maintainerPATCH v2 81/84 staging: unisys: visorhba: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/staging/unisys/visorhba/visorhba_main.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/staging/unisys/visorhba/visorhba_main.c +6 -8
@@ -327,7 +327,7 @@ static int visorhba_abort_handler(struct scsi_cmnd *scsicmd) rtn =forward_taskmgmt_command (TASK_MGMT_ABORT_TASK , scsidev);if (rtn ==SUCCESS ) { scsicmd->result =DID_ABORT <<16 ; - scsicmd->scsi_done (scsicmd); +scsi_done (scsicmd); }return rtn; }
@@ -354,7 +354,7 @@ static int visorhba_device_reset_handler(struct scsi_cmnd *scsicmd) rtn =forward_taskmgmt_command (TASK_MGMT_LUN_RESET , scsidev);if (rtn ==SUCCESS ) { scsicmd->result =DID_RESET <<16 ; - scsicmd->scsi_done (scsicmd); +scsi_done (scsicmd); }return rtn; }
@@ -383,7 +383,7 @@ static int visorhba_bus_reset_handler(struct scsi_cmnd *scsicmd) rtn =forward_taskmgmt_command (TASK_MGMT_BUS_RESET , scsidev);if (rtn ==SUCCESS ) { scsicmd->result =DID_RESET <<16 ; - scsicmd->scsi_done (scsicmd); +scsi_done (scsicmd); }return rtn; }
@@ -476,8 +476,7 @@ static int visorhba_queue_command_lck(struct scsi_cmnd *scsicmd,*/ cmdrsp->scsi.handle = insert_location; -/* save done function that we have call when cmd is complete */ - scsicmd->scsi_done = visorhba_cmnd_done; +WARN_ON_ONCE (visorhba_cmnd_done != scsi_done);/* save destination */ cmdrsp->scsi.vdest.channel = scsidev->channel; cmdrsp->scsi.vdest.id = scsidev->id;
@@ -686,8 +685,7 @@ static void visorhba_serverdown_complete(struct visorhba_devdata *devdata)case CMD_SCSI_TYPE : scsicmd = pendingdel->sent; scsicmd->result =DID_RESET <<16 ; -if (scsicmd->scsi_done) - scsicmd->scsi_done (scsicmd); +scsi_done (scsicmd);break ;case CMD_SCSITASKMGMT_TYPE : cmdrsp = pendingdel->sent;
@@ -853,7 +851,7 @@ static void complete_scsi_command(struct uiscmdrsp *cmdrsp,else do_scsi_nolinuxstat (cmdrsp, scsicmd); - scsicmd->scsi_done (scsicmd); +scsi_done (scsicmd); }/*
Re: [PATCH v2 81/84] staging: unisys: visorhba: Call scsi_done() directly
Quoted 4 lines · Bart Van Assche
Conditional statements are faster than indirect calls. Hence call
scsi_done()directly.Signed-off-by Bart Van Assche <[email protected]>
Bart Van Assche
maintainerPATCH v2 82/84 target/tcm_loop: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/target/loopback/tcm_loop.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/target/loopback/tcm_loop.c +2 -2
@@ -71,7 +71,7 @@ static void tcm_loop_release_cmd(struct se_cmd *se_cmd)if (se_cmd->se_cmd_flags &SCF_SCSI_TMR_CDB )kmem_cache_free (tcm_loop_cmd_cache, tl_cmd);else - sc->scsi_done (sc); +scsi_done (sc); }static int tcm_loop_show_info (struct seq_file *m,struct Scsi_Host *host)
@@ -165,7 +165,7 @@ static void tcm_loop_target_queue_cmd(struct tcm_loop_cmd *tl_cmd)return ; out_done: - sc->scsi_done (sc); +scsi_done (sc); }/*
Bart Van Assche
maintainerPATCH v2 83/84 usb: Call scsi_done() directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly.
--- drivers/usb/storage/scsiglue.c | 1 - drivers/usb/storage/uas.c | 10 ++++------ drivers/usb/storage/usb.c | 4 ++-- 3 files changed, 6 insertions(+), 9 deletions(-)
drivers/usb/storage/scsiglue.c +0 -1
@@ -393,7 +393,6 @@ static int queuecommand_lck(struct scsi_cmnd *srb, }/* enqueue the command and wake up the control thread */ - srb->scsi_done = done; us->srb = srb;complete (&us->cmnd_ready);
drivers/usb/storage/uas.c +4 -6
@@ -256,7 +256,7 @@ static int uas_try_complete(struct scsi_cmnd *cmnd, const char *caller)return -EBUSY ; devinfo->cmnd[cmdinfo->uas_tag -1 ] =NULL ;uas_free_unsubmitted_urbs (cmnd); - cmnd->scsi_done (cmnd); +scsi_done (cmnd);return 0 ; }
@@ -653,7 +653,7 @@ static int uas_queuecommand_lck(struct scsi_cmnd *cmnd,memcpy (cmnd->sense_buffer, usb_stor_sense_invalidCDB,sizeof (usb_stor_sense_invalidCDB)); cmnd->result =SAM_STAT_CHECK_CONDITION ; - cmnd->scsi_done (cmnd); +scsi_done (cmnd);return 0 ; }
@@ -661,7 +661,7 @@ static int uas_queuecommand_lck(struct scsi_cmnd *cmnd,if (devinfo->resetting) {set_host_byte (cmnd,DID_ERROR ); - cmnd->scsi_done (cmnd); +scsi_done (cmnd); goto zombie; }
@@ -675,8 +675,6 @@ static int uas_queuecommand_lck(struct scsi_cmnd *cmnd,return SCSI_MLQUEUE_DEVICE_BUSY ; } - cmnd->scsi_done = done; -memset (cmdinfo,0 ,sizeof (*cmdinfo)); cmdinfo->uas_tag = idx +1 ;/* uas-tag == usb-stream-id, so 1 based */ cmdinfo->state =SUBMIT_STATUS_URB |ALLOC_CMD_URB |SUBMIT_CMD_URB ;
@@ -706,7 +704,7 @@ static int uas_queuecommand_lck(struct scsi_cmnd *cmnd,*/ if (err == -ENODEV ) {set_host_byte (cmnd,DID_ERROR ); - cmnd->scsi_done (cmnd); +scsi_done (cmnd); goto zombie; }if (err) {
drivers/usb/storage/usb.c +2 -2
@@ -388,7 +388,7 @@ static int usb_stor_control_thread(void * __us)if (srb->result ==DID_ABORT <<16 ) { SkipForAbort:usb_stor_dbg (us,"scsi command aborted\n" ); - srb =NULL ;/* Don't call srb->scsi_done() */ + srb =NULL ;/* Don't call scsi_done() */ }/*
@@ -417,7 +417,7 @@ static int usb_stor_control_thread(void * __us)if (srb) {usb_stor_dbg (us,"scsi cmd done, result=0x%x\n" , srb->result); - srb->scsi_done (srb); +scsi_done (srb); } }/* for (;;) */
Bart Van Assche
maintainerPATCH v2 84/84 scsi: core: Call scsi_done directly
In reply to Bart Van AsscheConditional statements are faster than indirect calls. Hence call scsi_done() directly. Since this patch removes the last user of the scsi_done member, also remove that data structure member.
--- drivers/scsi/hosts.c | 2 +- drivers/scsi/scsi_lib.c | 3 +-- include/scsi/scsi_cmnd.h | 4 ---- include/scsi/scsi_host.h | 2 +- 4 files changed, 3 insertions(+), 8 deletions(-)
drivers/scsi/hosts.c +1 -1
@@ -666,7 +666,7 @@ static bool complete_all_cmds_iter(struct request *rq, void *data, bool rsvd)scsi_dma_unmap (scmd); scmd->result =0 ;set_host_byte (scmd, status); - scmd->scsi_done (scmd); +scsi_done (scmd);return true; }
drivers/scsi/scsi_lib.c +1 -2
@@ -1520,7 +1520,7 @@ static int scsi_dispatch_cmd(struct scsi_cmnd *cmd)return rtn; done: - cmd->scsi_done (cmd); +scsi_done (cmd);return 0 ; }
@@ -1694,7 +1694,6 @@ static blk_status_t scsi_queue_rq(struct blk_mq_hw_ctx *hctx,scsi_set_resid (cmd,0 );memset (cmd->sense_buffer,0 ,SCSI_SENSE_BUFFERSIZE ); cmd->submitter =SUBMITTED_BY_BLOCK_LAYER ; - cmd->scsi_done = scsi_done;blk_mq_start_request (req); reason =scsi_dispatch_cmd (cmd);
include/scsi/scsi_cmnd.h +0 -4
@@ -123,10 +123,6 @@ struct scsi_cmnd {* command (auto-sense). Length must be * SCSI_SENSE_BUFFERSIZE bytes. */ -/* Low-level done function - can be used by low-level driver to point -* to completion function. Not used by mid/upper level code. */ -void (*scsi_done) (struct scsi_cmnd *); -/* * The following fields can be written to by the host specific code. * Everything else should be left alone.
include/scsi/scsi_host.h +1 -1
@@ -516,7 +516,7 @@ struct scsi_host_template {unsigned long irq_flags; \int rc; \spin_lock_irqsave (shost->host_lock, irq_flags); \ - rc = func_name##_lck (cmd, cmd->scsi_done); \ + rc = func_name##_lck(cmd, scsi_done); \spin_unlock_irqrestore (shost->host_lock, irq_flags); \return rc; \ }
Re: [PATCH v2 84/84] scsi: core: Call scsi_done directly
Quoted 11 lines · Bart Van Assche
Conditional statements are faster than indirect calls. Hence call
scsi_done()directly. Since this patch removes the last user of the
scsi_donemember, also remove that data structure member.Reviewed-by Benjamin Block <[email protected]>Signed-off-by Bart Van Assche <[email protected]>
Hi Bart,
Quoted 5 lines · Bart Van Assche
Hi Martin,
This patch series increases IOPS by 5% on my test setup in a single- threaded
test with queue depth 1 on top of thescsi_debugdriver.
Here you mentioned queue depth 1. Does this mean SW queue depth?
Kind regards,
Bean
Quoted 212 lines
Please consider this
patch series for kernel v5.16.Thanks,
Bart.
Changes compared to v1:
- Inserted theSUBMITTED_BY_prefix in front of the enumeration constants
introduced in patch 1.
- Reworked the fas216 patch such that thescsi_donepointer is preserved.
- Moved some SCSI core changes from the start of this series to the end to
improve bisectability of this series.
- Added explicit initialization of the new "submitter" member variable instead
of relying on implicit initialization.
- Added Reviewed-by/Acked-by tags.Bart Van Assche (84):
scsi: core: Use a member variable to track the SCSI command
submitter
scsi: core: Renamescsi_mq_done()intoscsi_done()and export it
ata: Callscsi_done()directly
firewire: sbp2: Callscsi_done()directly
ib_srp: Callscsi_done()directly
message: fusion: Callscsi_done()directly
zfcp_scsi: Callscsi_done()directly
3w-9xxx: Callscsi_done()directly
3w-sas: Callscsi_done()directly
3w-xxxx: Callscsi_done()directly
53c700: Callscsi_done()directly
BusLogic: Callscsi_done()directly
NCR5380: Callscsi_done()directly
a100u2w: Callscsi_done()directly
aacraid: Introduceaac_scsi_done()
aacraid: Callscsi_done()directly
acornscsi: Callscsi_done()directly
advansys: Callscsi_done()directly
aha152x: Callscsi_done()directly
aha1542: Callscsi_done()directly
aic7xxx: Callscsi_done()directly
arcmsr: Callscsi_done()directly
atp870u: Callscsi_done()directly
bfa: Callscsi_done()directly
bnx2fc: Callscsi_done()directly
csiostor: Callscsi_done()directly
cxlflash: Callscsi_done()directly
dc395x: Callscsi_done()directly
dpt_i2o: Callscsi_done()directly
esas2r: Callscsi_done()directly
esp_scsi: Callscsi_done()directly
fas216: Introduce structfas216_cmd_priv
fas216: Stop using scsi_cmnd.scsi_done
fdomain: Callscsi_done()directly
fnic: Callscsi_done()directly
hpsa: Callscsi_done()directly
hptiop: Callscsi_done()directly
ibmvscsi: Callscsi_done()directly
imm: Callscsi_done()directly
initio: Callscsi_done()directly
ipr: Callscsi_done()directly
ips: Callscsi_done()directly
libfc: Callscsi_done()directly
libiscsi: Callscsi_done()directly
libsas: Callscsi_done()directly
lpfc: Callscsi_done()directly
mac53c94: Callscsi_done()directly
megaraid: Callscsi_done()directly
megaraid: Callscsi_done()directly
mesh: Callscsi_done()directly
mpi3mr: Callscsi_done()directly
mpt3sas: Callscsi_done()directly
mvumi: Callscsi_done()directly
myrb: Callscsi_done()directly
myrs: Callscsi_done()directly
ncr53c8xx: Callscsi_done()directly
nsp32: Callscsi_done()directly
pcmcia: Callscsi_done()directly
pmcraid: Callscsi_done()directly
ppa: Callscsi_done()directly
ps3rom: Callscsi_done()directly
qedf: Callscsi_done()directly
qla1280: Callscsi_done()directly
qla2xxx: Callscsi_done()directly
qla4xxx: Callscsi_done()directly
qlogicfas408: Callscsi_done()directly
qlogicpti: Callscsi_done()directly
scsi_debug: Callscsi_done()directly
smartpqi: Callscsi_done()directly
snic: Callscsi_done()directly
stex: Callscsi_done()directly
storvsc_drv: Callscsi_done()directly
sym53c8xx_2: Callscsi_done()directly
ufs: Callscsi_done()directly
virtio_scsi: Callscsi_done()directly
vmw_pvscsi: Callscsi_done()directly
wd33c93: Callscsi_done()directly
wd719x: Callscsi_done()directly
xen-scsifront: Callscsi_done()directly
staging: rts5208: Callscsi_done()directly
staging: unisys: visorhba: Callscsi_done()directly target/tcm_loop: Callscsi_done()directly
usb: Callscsi_done()directly
scsi: core: Callscsi_donedirectlydrivers/ata/libata-sata.c | 2 +- drivers/ata/libata-scsi.c | 14 +-- drivers/firewire/sbp2.c | 2 +- drivers/infiniband/ulp/srp/ib_srp.c | 8 +- drivers/message/fusion/mptfc.c | 6 +- drivers/message/fusion/mptsas.c | 2 +- drivers/message/fusion/mptscsih.c | 10 +- drivers/message/fusion/mptspi.c | 4 +- drivers/s390/scsi/zfcp_fsf.c | 2 +- drivers/s390/scsi/zfcp_scsi.c | 4 +- drivers/scsi/3w-9xxx.c | 7 +- drivers/scsi/3w-sas.c | 7 +- drivers/scsi/3w-xxxx.c | 13 +- drivers/scsi/53c700.c | 5 +- drivers/scsi/BusLogic.c | 9 +- drivers/scsi/NCR5380.c | 12 +- drivers/scsi/a100u2w.c | 3 +- drivers/scsi/aacraid/aachba.c | 53 ++++---- drivers/scsi/advansys.c | 3 +- drivers/scsi/aha152x.c | 27 ++-- drivers/scsi/aha1542.c | 10 +- drivers/scsi/aic7xxx/aic79xx_osm.c | 3 +- drivers/scsi/aic7xxx/aic7xxx_osm.c | 3 +- drivers/scsi/arcmsr/arcmsr_hba.c | 17 ++- drivers/scsi/arm/acornscsi.c | 6 +- drivers/scsi/arm/arxescsi.c | 1 + drivers/scsi/arm/cumana_2.c | 1 + drivers/scsi/arm/eesox.c | 1 + drivers/scsi/arm/fas216.c | 8 +- drivers/scsi/arm/fas216.h | 10 ++ drivers/scsi/arm/powertec.c | 2 +- drivers/scsi/atp870u.c | 13 +- drivers/scsi/bfa/bfad_im.c | 8 +- drivers/scsi/bnx2fc/bnx2fc_io.c | 8 +- drivers/scsi/csiostor/csio_scsi.c | 8 +- drivers/scsi/cxlflash/main.c | 6 +- drivers/scsi/dc395x.c | 8 +- drivers/scsi/dpt_i2o.c | 11 +- drivers/scsi/esas2r/esas2r_main.c | 8 +- drivers/scsi/esp_scsi.c | 10 +- drivers/scsi/fdomain.c | 2 +- drivers/scsi/fnic/fnic_scsi.c | 119 ++++++++------ ---- drivers/scsi/hosts.c | 2 +- drivers/scsi/hpsa.c | 12 +- drivers/scsi/hptiop.c | 7 +- drivers/scsi/ibmvscsi/ibmvfc.c | 8 +- drivers/scsi/imm.c | 3 +- drivers/scsi/initio.c | 4 +- drivers/scsi/ipr.c | 10 +- drivers/scsi/ips.c | 28 ++--- drivers/scsi/libfc/fc_fcp.c | 6 +- drivers/scsi/libiscsi.c | 4 +- drivers/scsi/libsas/sas_scsi_host.c | 4 +- drivers/scsi/lpfc/lpfc_scsi.c | 8 +- drivers/scsi/mac53c94.c | 3 +- drivers/scsi/megaraid.c | 21 ++-- drivers/scsi/megaraid/megaraid_mbox.c | 9 +- drivers/scsi/megaraid/megaraid_sas_base.c | 16 +-- drivers/scsi/megaraid/megaraid_sas_fusion.c | 6 +- drivers/scsi/mesh.c | 16 +-- drivers/scsi/mpi3mr/mpi3mr_os.c | 26 ++-- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 18 +-- drivers/scsi/mvumi.c | 4 +- drivers/scsi/myrb.c | 32 ++--- drivers/scsi/myrs.c | 10 +- drivers/scsi/ncr53c8xx.c | 3 +- drivers/scsi/nsp32.c | 3 +- drivers/scsi/pcmcia/nsp_cs.c | 4 +- drivers/scsi/pcmcia/sym53c500_cs.c | 3 +- drivers/scsi/pmcraid.c | 11 +- drivers/scsi/ppa.c | 3 +- drivers/scsi/ps3rom.c | 5 +- drivers/scsi/qedf/qedf_io.c | 19 +-- drivers/scsi/qla1280.c | 5 +- drivers/scsi/qla2xxx/qla_os.c | 8 +- drivers/scsi/qla4xxx/ql4_os.c | 4 +- drivers/scsi/qlogicfas408.c | 3 +- drivers/scsi/qlogicpti.c | 4 +- drivers/scsi/scsi_debug.c | 8 +- drivers/scsi/scsi_error.c | 18 ++- drivers/scsi/scsi_lib.c | 16 ++- drivers/scsi/scsi_priv.h | 1 + drivers/scsi/smartpqi/smartpqi_init.c | 2 +- drivers/scsi/snic/snic_scsi.c | 33 +++-- drivers/scsi/stex.c | 6 +- drivers/scsi/storvsc_drv.c | 4 +- drivers/scsi/sym53c8xx_2/sym_glue.c | 3 +- drivers/scsi/ufs/ufshcd.c | 6 +- drivers/scsi/virtio_scsi.c | 7 +- drivers/scsi/vmw_pvscsi.c | 7 +- drivers/scsi/wd33c93.c | 14 +-- drivers/scsi/wd719x.c | 4 +- drivers/scsi/xen-scsifront.c | 4 +- drivers/staging/rts5208/rtsx.c | 5 +- .../staging/unisys/visorhba/visorhba_main.c | 14 +-- drivers/target/loopback/tcm_loop.c | 4 +- drivers/usb/storage/scsiglue.c | 1 - drivers/usb/storage/uas.c | 10 +- drivers/usb/storage/usb.c | 4 +- include/scsi/scsi_cmnd.h | 13 +- include/scsi/scsi_host.h | 2 +- 101 files changed, 452 insertions(+), 522 deletions(-)
Bart Van Assche
maintainerQuoted 6 lines · Bean Huo
Quoted 3 lines · Bart Van Assche
This patch series increases IOPS by 5% on my test setup in a single- threaded
test with queue depth 1 on top of thescsi_debugdriver.Here you mentioned queue depth 1. Does this mean SW queue depth?
Hi Bean,
Yes, what I wrote refers to the queue depth of the submitter. The script that I used to measure performance with and without this patch series is as follows:
#!/bin/bash
iodepth=${1:-1}
runtime=30
blocksize=512
numcpus=$(nproc)
modprobe -r scsi_debug
modprobe scsi_debug max_queue=128 submit_queues="$numcpus" delay=0 &&
udevadm settle
DEVICE=$(find /sys/bus/pseudo/drivers/scsi_debug/adapter*/host*/target*/*/block/ -maxdepth 1 -type d | grep -v 'block/$' | head -1 | xargs basename) || exit $? [ -n "$DEVICE" ] || exit $?
args=()
if [ "$iodepth" = 1 ]; then
args+=(--ioengine=psync)
else
args+=(--ioengine=io_uring --iodepth_batch=$((iodepth/2)))
fi
args+=(
--bs="${blocksize}"
--direct=1
--filename=/dev/"$DEVICE"
--group_reporting=1
--gtod_reduce=1
--invalidate=1
--iodepth="$iodepth"
--ioscheduler=none
--loops=$((1<<20))
--name=scsi_debug
--numjobs=1
--runtime="$runtime"
--rw=read
--thread
)
set -x
if numactl -m 0 -N 0 echo >&/dev/null; then
numactl -m 0 -N 0 -- fio "${args[@]}"
else
fio "${args[@]}"fi