scsi: Add SHT->queuecommand_unlocked() for host_lock less I/O dispatch
Subsystems (11)
PATCH 1/1 scsi: Add SHT->queuecommand_unlocked() for host_lock less I/O dispatch
From: Nicholas Bellinger <[email protected]>
Following up on a request made by jejb and Co. offlist to convert SHT->unlocked_cmd to use SHT->queuecommand_unlocked() for host_lock less operation in modern LLDs..
This patch adds scsi_dispatch_cmd_unlocked() and scsi_dispatch_cmd_locked() which are now called directly from scsi_dispatch_cmd() depending upon if SHT->queuecommand_unlocked() function pointer exists on a per driver basis. Note that by default ->queuecommand_unlocked is disabled, and all LLDs not defining a SHT->queuecommand_unlocked() will be using the legacy scsi_dispatch_cmd_locked() -> SHT->queuecommand() for I/O dispatch.
This patch also drops the usage of scsi_cmd_get_serial() in scsi_dispatch_cmd() and assumes the legacy SCSI LLDs that depend upon struct scsi_cmnd->serial_number will call the now EXPORT_SYMBOL()'ed scsi_cmd_get_serial() call.
This patch also adds a cmd->eh_eflags |= SCSI_EH_SOFTIRQ_DONE assignment in scsi_softirq_done() in order to signal scsi_try_to_abort_cmd() that the command has been completed. This patch uses blk_test_rq_complete() together with a new SCSI_EH_SOFTIRQ_DONE in scsi_error.c:scsi_try_to_abort_cmd() in order to handle the struct scsi_cmnd timeout case intsead w/o scmd->serial_number usage:
- if (scmd->serial_number == 0)
+ if ((blk_test_rq_complete(scmd->request)) &&
+ (scmd->eh_eflags & SCSI_EH_SOFTIRQ_DONE))
return SUCCESS;
Finally, this patch also converts the remaining struct Scsi_Host->cmd_serial_number to atomic_t following a recommedation by Joe Eykholt to increment each serial_number by 2 so that the serial is odd, and wraps to 1 instead of 0.
Along with the changes to SCSI ML, this series includes the following LLD commits to enable lock-less operation for certain LLDs, and adds the explict scsi_cmd_get_serial() to the legacy LLDs still requring cmd->serial_number for anything beyond informational purposes:
libiscsi: Remove host_lock unlock() + lock() from iscsi_queuecommand()
libsas: Remove host_lock unlock() + lock() from sas_queuecommand()
aic94xx: Set SHT->queuecommand_unlocked for libsas queuecommand()
mvsas: Set SHT->queuecommand_unlocked for libsas queuecommand()
pm8001: Set SHT->queuecommand_unlocked for libsas queuecommand()
libata: Remove host_lock unlock() + lock() and set SHT->queuecommand_unlocked()
lpfc: Remove host_lock unlock() + lock() and set SHT->queuecommand_unlocked()
qla4xxx: Remove host_lock unlock() + lock() and set SHT->queuecommand_unlocked()
qla2xxx: Remove host_lock unlock() + lock() and set SHT->queuecommand_unlocked()
fnic: Remove host_lock unlock() + lock() and set SHT->queuecommand_unlocked()
mpt2sas: Add scsi_cmd_get_serial() call and set SHT->queuecommand_unlocked() mpt/fusion: Add scsi_cmd_get_serial() call and set SHT->queuecommand_unlocked()dpt_i2o: Add scsi_cmd_get_serial() call
eata: Add scsi_cmd_get_serial() call
u14-34f: Add scsi_cmd_get_serial() call
Note that this patch series currently does not contain host_lock less operation for libfc or fcoe as there are outstanding items wrt to rport state w/o host_lock held in libfc ->queuecommand().
Many thanks to Vasu Dev, Tim Chen, Andi Kleen, Mike Christie, Joe Eykholt, Mike Anderson, Christof Schmitt, Brian King, Jens Axboe, James Bottomley, and H. Peter Anvin for their help with this series!
--- block/blk.h | 4 ++ drivers/ata/libata-scsi.c | 4 +- drivers/message/fusion/mptfc.c | 2 +- drivers/message/fusion/mptsas.c | 2 +- drivers/message/fusion/mptscsih.c | 5 ++ drivers/message/fusion/mptspi.c | 2 +- drivers/scsi/aic94xx/aic94xx_init.c | 2 +- drivers/scsi/dpt_i2o.c | 5 ++ drivers/scsi/eata.c | 5 ++ drivers/scsi/fnic/fnic_main.c | 2 +- drivers/scsi/fnic/fnic_scsi.c | 9 --- drivers/scsi/hosts.c | 4 ++ drivers/scsi/iscsi_tcp.c | 2 +- drivers/scsi/libiscsi.c | 4 -- drivers/scsi/libsas/sas_scsi_host.c | 5 -- drivers/scsi/lpfc/lpfc_scsi.c | 6 +-- drivers/scsi/mpt2sas/mpt2sas_scsih.c | 7 ++- drivers/scsi/mvsas/mv_init.c | 2 +- drivers/scsi/pm8001/pm8001_init.c | 2 +- drivers/scsi/qla2xxx/qla_os.c | 11 +--- drivers/scsi/qla4xxx/ql4_os.c | 10 +--- drivers/scsi/scsi.c | 95 ++++++++++++++++++++++++++-------- drivers/scsi/scsi_error.c | 11 +++- drivers/scsi/scsi_lib.c | 6 ++ drivers/scsi/scsi_priv.h | 1 + drivers/scsi/u14-34f.c | 6 ++ include/linux/libata.h | 2 +- include/scsi/scsi_cmnd.h | 1 + include/scsi/scsi_host.h | 23 +++++++- 29 files changed, 162 insertions(+), 78 deletions(-)
block/blk.h +4 -0
@@ -46,6 +46,10 @@ static inline void blk_clear_rq_complete(struct request *rq)clear_bit (REQ_ATOM_COMPLETE , &rq->atomic_flags); } +static inline int blk_test_rq_complete (struct request *rq) +{ +return test_bit (REQ_ATOM_COMPLETE , &rq->atomic_flags); +}/* * Internal elevator interface */
drivers/ata/libata-scsi.c +1 -3
@@ -3174,7 +3174,7 @@ static inline int __ata_scsi_queuecmd(struct scsi_cmnd *scmd,* ATA and ATAPI devices appearing as SCSI devices. * * LOCKING: -* Releases scsi-layer-held lock, and obtains host lock. +* None * * RETURNS: * Return value from __ata_scsi_queuecmd() if @cmd can be queued,
@@ -3190,7 +3190,6 @@ int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) ap =ata_shost_to_port (shost); -spin_unlock (shost->host_lock);spin_lock (ap->lock);ata_scsi_dump_cdb (ap, cmd);
@@ -3204,7 +3203,6 @@ int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) }spin_unlock (ap->lock); -spin_lock (shost->host_lock);return rc; }
drivers/message/fusion/mptfc.c +1 -1
@@ -113,7 +113,7 @@ static struct scsi_host_template mptfc_driver_template = { .proc_info = mptscsih_proc_info, .name = "MPT FC Host", .info = mptscsih_info, - .queuecommand = mptfc_qcmd, + .queuecommand_unlocked = mptfc_qcmd, .target_alloc = mptfc_target_alloc, .slave_alloc = mptfc_slave_alloc, .slave_configure = mptscsih_slave_configure,
drivers/message/fusion/mptsas.c +1 -1
@@ -1962,7 +1962,7 @@ static struct scsi_host_template mptsas_driver_template = { .proc_info = mptscsih_proc_info, .name = "MPT SAS Host", .info = mptscsih_info, - .queuecommand = mptsas_qcmd, + .queuecommand_unlocked = mptsas_qcmd, .target_alloc = mptsas_target_alloc, .slave_alloc = mptsas_slave_alloc, .slave_configure = mptsas_slave_configure,
drivers/message/fusion/mptscsih.c +5 -0
@@ -1411,6 +1411,11 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) hd =shost_priv (SCpnt->device->host); ioc = hd->ioc; SCpnt->scsi_done = done; +/* +* Call scsi_cmd_get_serial() because we need a valid serial number +* in mptscsih_abort() +*/ +scsi_cmd_get_serial (SCpnt);dmfprintk (ioc,printk (MYIOC_s_DEBUG_FMT"qcmd: SCpnt=%p, done()=%p\n" , ioc->name, SCpnt, done));
drivers/message/fusion/mptspi.c +1 -1
@@ -832,7 +832,7 @@ static struct scsi_host_template mptspi_driver_template = { .proc_info = mptscsih_proc_info, .name = "MPT SPI Host", .info = mptscsih_info, - .queuecommand = mptspi_qcmd, + .queuecommand_unlocked = mptspi_qcmd, .target_alloc = mptspi_target_alloc, .slave_alloc = mptspi_slave_alloc, .slave_configure = mptspi_slave_configure,
drivers/scsi/aic94xx/aic94xx_init.c +1 -1
@@ -65,7 +65,7 @@ static struct scsi_host_template aic94xx_sht = { .module = THIS_MODULE,/* .name is initialized */ .name = "aic94xx", - .queuecommand = sas_queuecommand, + .queuecommand_unlocked = sas_queuecommand, .target_alloc = sas_target_alloc, .slave_configure = sas_slave_configure, .slave_destroy = sas_slave_destroy,
drivers/scsi/dpt_i2o.c +5 -0
@@ -430,6 +430,11 @@ static int adpt_queue(struct scsi_cmnd * cmd, void (*done) (struct scsi_cmnd *)) cmd->scsi_done = done;/* +* Call scsi_cmd_get_serial() because we need a valid serial number +* for adpt_cmd_to_context() +*/ +scsi_cmd_get_serial (cmd); +/* * SCSI REQUEST_SENSE commands will be executed automatically by the * Host Adapter for any errors, so they should not be executed * explicitly unless the Sense Data is zero indicating that no error
drivers/scsi/eata.c +5 -0
@@ -1765,6 +1765,11 @@ static int eata2x_queuecommand(struct scsi_cmnd *SCpnt,struct hostdata *ha = (struct hostdata *)shost->hostdata;unsigned int i, k;struct mscp *cpp; +/* +* Call scsi_cmd_get_serial() because we need a valid serial number +* for the main eata interrupt handler in ihdlr() +*/ +scsi_cmd_get_serial (SCpnt);if (SCpnt->host_scribble) panic("%s: qcomm, pid %ld, SCpnt %p already active.\n",
drivers/scsi/fnic/fnic_main.c +1 -1
@@ -93,7 +93,7 @@ static int fnic_slave_alloc(struct scsi_device *sdev)static struct scsi_host_template fnic_host_template = { .module =THIS_MODULE , .name =DRV_NAME , - .queuecommand = fnic_queuecommand, + .queuecommand_unlocked = fnic_queuecommand, .eh_abort_handler = fnic_abort_cmd, .eh_device_reset_handler = fnic_device_reset, .eh_host_reset_handler = fnic_host_reset,
drivers/scsi/fnic/fnic_scsi.c +0 -9
@@ -373,13 +373,6 @@ int fnic_queuecommand(struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *))if (lp->state !=LPORT_ST_READY || !(lp->link_up))return SCSI_MLQUEUE_HOST_BUSY ; -/* -* Release host lock, use driver resource specific locks from here. -* Don't re-enable interrupts in case they were disabled prior to the -* caller disabling them. -*/ -spin_unlock (lp->host->host_lock); -/* Get a new io_req for this SCSI IO */ fnic =lport_priv (lp);
@@ -452,8 +445,6 @@ int fnic_queuecommand(struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *)) } } out: -/* acquire host lock before returning to SCSI */ -spin_lock (lp->host->host_lock);return ret; }
drivers/scsi/hosts.c +4 -0
@@ -381,6 +381,10 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) shost->unchecked_isa_dma = sht->unchecked_isa_dma; shost->use_clustering = sht->use_clustering; shost->ordered_tag = sht->ordered_tag; +/* +* Set the default shost->cmd_serial_number to 1. +*/ +atomic_set (&shost->cmd_serial_number,1 );if (sht->supported_mode ==MODE_UNKNOWN )/* means we didn't set it ... default to INITIATOR */
drivers/scsi/iscsi_tcp.c +1 -1
@@ -867,7 +867,7 @@ static int iscsi_sw_tcp_slave_configure(struct scsi_device *sdev)static struct scsi_host_template iscsi_sw_tcp_sht = { .module =THIS_MODULE , .name ="iSCSI Initiator over TCP/IP" , - .queuecommand = iscsi_queuecommand, + .queuecommand_unlocked = iscsi_queuecommand, .change_queue_depth = iscsi_change_queue_depth, .can_queue =ISCSI_DEF_XMIT_CMDS_MAX -1 , .sg_tablesize =4096 ,
drivers/scsi/libiscsi.c +0 -4
@@ -1615,7 +1615,6 @@ int iscsi_queuecommand(struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *)) host = sc->device->host; ihost =shost_priv (host); -spin_unlock (host->host_lock); cls_session =starget_to_session (scsi_target (sc->device)); session = cls_session->dd_data;
@@ -1706,7 +1705,6 @@ int iscsi_queuecommand(struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *)) session->queued_cmdsn++;spin_unlock (&session->lock); -spin_lock (host->host_lock);return 0 ; prepd_reject:
@@ -1716,7 +1714,6 @@ reject:spin_unlock (&session->lock);ISCSI_DBG_SESSION (session,"cmd 0x%x rejected (%d)\n" , sc->cmnd[0 ], reason); -spin_lock (host->host_lock);return SCSI_MLQUEUE_TARGET_BUSY ; prepd_fault:
@@ -1733,7 +1730,6 @@ fault:scsi_in (sc)->resid =scsi_in (sc)->length; }done (sc); -spin_lock (host->host_lock);return 0 ; }EXPORT_SYMBOL_GPL (iscsi_queuecommand);
drivers/scsi/libsas/sas_scsi_host.c +0 -5
@@ -191,18 +191,14 @@ int sas_queue_up(struct sas_task *task)*/ int sas_queuecommand (struct scsi_cmnd *cmd,void (*scsi_done)(struct scsi_cmnd *)) - __releases(host->host_lock) __acquires(dev->sata_dev.ap->lock) __releases(dev->sata_dev.ap->lock) - __acquires(host->host_lock) {int res =0 ;struct domain_device *dev =cmd_to_domain_dev (cmd);struct Scsi_Host *host = cmd->device->host;struct sas_internal *i =to_sas_internal (host->transportt); -spin_unlock_irq (host->host_lock); - {struct sas_ha_struct *sas_ha = dev->port->ha;struct sas_task *task;
@@ -250,7 +246,6 @@ int sas_queuecommand(struct scsi_cmnd *cmd, } } out: -spin_lock_irq (host->host_lock);return res; }
drivers/scsi/lpfc/lpfc_scsi.c +2 -4
@@ -3034,11 +3034,9 @@ lpfc_queuecommand(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *)) goto out_host_busy_free_buf; }if (phba->cfg_poll &ENABLE_FCP_RING_POLLING ) { -spin_unlock (shost->host_lock);lpfc_sli_handle_fast_ring_event (phba, &phba->sli.ring[LPFC_FCP_RING ],HA_R0RE_REQ ); -spin_lock (shost->host_lock);if (phba->cfg_poll &DISABLE_FCP_RING_INT )lpfc_poll_rearm_timer (phba); }
@@ -3721,7 +3719,7 @@ struct scsi_host_template lpfc_template = { .module = THIS_MODULE, .name = LPFC_DRIVER_NAME, .info = lpfc_info, - .queuecommand = lpfc_queuecommand, + .queuecommand_unlocked = lpfc_queuecommand, .eh_abort_handler = lpfc_abort_handler, .eh_device_reset_handler = lpfc_device_reset_handler, .eh_target_reset_handler = lpfc_target_reset_handler,
@@ -3744,7 +3742,7 @@ struct scsi_host_template lpfc_vport_template = { .module = THIS_MODULE, .name = LPFC_DRIVER_NAME, .info = lpfc_info, - .queuecommand = lpfc_queuecommand, + .queuecommand_unlocked = lpfc_queuecommand, .eh_abort_handler = lpfc_abort_handler, .eh_device_reset_handler = lpfc_device_reset_handler, .eh_target_reset_handler = lpfc_target_reset_handler,
drivers/scsi/mpt2sas/mpt2sas_scsih.c +6 -1
@@ -3325,6 +3325,11 @@ _scsih_qcmd(struct scsi_cmnd *scmd, void (*done)(struct scsi_cmnd *))u16 smid; scmd->scsi_done = done; +/* +* Call scsi_cmd_get_serial() because we need a valid serial number +* in mpt2sas_scsih_issue_tm() +*/ +scsi_cmd_get_serial (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 ;
@@ -6450,7 +6455,7 @@ static struct scsi_host_template scsih_driver_template = { .module = THIS_MODULE, .name = "Fusion MPT SAS Host", .proc_name = MPT2SAS_DRIVER_NAME, - .queuecommand = _scsih_qcmd, + .queuecommand_unlocked = _scsih_qcmd, .target_alloc = _scsih_target_alloc, .slave_alloc = _scsih_slave_alloc, .slave_configure = _scsih_slave_configure,
drivers/scsi/mvsas/mv_init.c +1 -1
@@ -42,7 +42,7 @@ static const struct mvs_chip_info mvs_chips[] = {static struct scsi_host_template mvs_sht = { .module =THIS_MODULE , .name =DRV_NAME , - .queuecommand = sas_queuecommand, + .queuecommand_unlocked = sas_queuecommand, .target_alloc = sas_target_alloc, .slave_configure = mvs_slave_configure, .slave_destroy = sas_slave_destroy,
drivers/scsi/pm8001/pm8001_init.c +1 -1
@@ -57,7 +57,7 @@ LIST_HEAD(hba_list);static struct scsi_host_template pm8001_sht = { .module =THIS_MODULE , .name =DRV_NAME , - .queuecommand = sas_queuecommand, + .queuecommand_unlocked = sas_queuecommand, .target_alloc = sas_target_alloc, .slave_configure = pm8001_slave_configure, .slave_destroy = sas_slave_destroy,
drivers/scsi/qla2xxx/qla_os.c +3 -8
@@ -188,7 +188,7 @@ static int qla2x00_change_queue_type(struct scsi_device *, int);struct scsi_host_template qla2xxx_driver_template = { .module =THIS_MODULE , .name =QLA2XXX_DRIVER_NAME , - .queuecommand = qla2xxx_queuecommand, + .queuecommand_unlocked = qla2xxx_queuecommand, .eh_abort_handler = qla2xxx_eh_abort, .eh_device_reset_handler = qla2xxx_eh_device_reset,
@@ -574,26 +574,21 @@ qla2xxx_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) goto qc24_target_busy; } -spin_unlock_irq (vha->host->host_lock); - sp =qla2x00_get_new_sp (base_vha, fcport, cmd, done);if (!sp) - goto qc24_host_busy_lock; + goto qc24_host_busy; rval = ha->isp_ops->start_scsi (sp);if (rval !=QLA_SUCCESS ) goto qc24_host_busy_free_sp; -spin_lock_irq (vha->host->host_lock); -return 0 ; qc24_host_busy_free_sp:qla2x00_sp_free_dma (sp);mempool_free (sp, ha->srb_mempool); -qc24_host_busy_lock: -spin_lock_irq (vha->host->host_lock); +qc24_host_busy:return SCSI_MLQUEUE_HOST_BUSY ; qc24_target_busy:
drivers/scsi/qla4xxx/ql4_os.c +2 -8
@@ -97,7 +97,7 @@ static struct scsi_host_template qla4xxx_driver_template = { .module = THIS_MODULE, .name = DRIVER_NAME, .proc_name = DRIVER_NAME, - .queuecommand = qla4xxx_queuecommand, + .queuecommand_unlocked = qla4xxx_queuecommand, .eh_abort_handler = qla4xxx_eh_abort, .eh_device_reset_handler = qla4xxx_eh_device_reset,
@@ -511,26 +511,20 @@ static int qla4xxx_queuecommand(struct scsi_cmnd *cmd, test_bit(DPC_RESET_HA_FW_CONTEXT, &ha->dpc_flags)) goto qc_host_busy; -spin_unlock_irq (ha->host->host_lock); - srb =qla4xxx_get_new_srb (ha, ddb_entry, cmd, done);if (!srb) - goto qc_host_busy_lock; + goto qc_host_busy; rval =qla4xxx_send_command_to_isp (ha, srb);if (rval !=QLA_SUCCESS ) goto qc_host_busy_free_sp; -spin_lock_irq (ha->host->host_lock);return 0 ; qc_host_busy_free_sp:qla4xxx_srb_free_dma (ha, srb);mempool_free (srb, ha->srb_mempool); -qc_host_busy_lock: -spin_lock_irq (ha->host->host_lock); - qc_host_busy:return SCSI_MLQUEUE_HOST_BUSY ;
drivers/scsi/scsi.c +74 -21
122 lines not on this page · raw message
drivers/scsi/scsi_error.c +8 -3
@@ -39,6 +39,8 @@#include "scsi_logging.h" #include "scsi_transport_api.h" +#include <../block/blk.h> /* For REQ_ATOM_COMPLETE */ +#include <trace/events/scsi.h> #define SENSE_TIMEOUT (10*HZ)
@@ -645,11 +647,14 @@ static int __scsi_try_to_abort_cmd(struct scsi_cmnd *scmd)static int scsi_try_to_abort_cmd (struct scsi_cmnd *scmd) {/* -* scsi_done was called just after the command timed out and before -* we had a chance to process it. (db) +* Use the struct request atomic_flags here to check if +* block/blk.h:blk_mark_rq_complete() has already been called +* from the block softirq */ -if (scmd->serial_number ==0 ) +if ((blk_test_rq_complete (scmd->request)) && + (scmd->eh_eflags &SCSI_EH_SOFTIRQ_DONE ))return SUCCESS ; +return __scsi_try_to_abort_cmd (scmd); }
drivers/scsi/scsi_lib.c +6 -0
@@ -1402,6 +1402,12 @@ static void scsi_softirq_done(struct request *rq)int disposition;INIT_LIST_HEAD (&cmd->eh_entry); +/* +* Set the SCSI_EH_SOFTIRQ_DONE flag to signal scsi_error.c: +* scsi_try_to_abort_cmd() that this cmd has reached +* scsi_softirq_done() +*/ + cmd->eh_eflags |=SCSI_EH_SOFTIRQ_DONE ;/* * Set the serial numbers back to zero
drivers/scsi/scsi_priv.h +1 -0
@@ -17,6 +17,7 @@ struct scsi_nl_hdr;* Scsi Error Handler Flags */ #define SCSI_EH_CANCEL_CMD 0x0001/* Cancel this cmd */ +#define SCSI_EH_SOFTIRQ_DONE 0x0002/* cmd reached scsi_softirq_done() */ #define SCSI_SENSE_VALID (scmd) \ (((scmd)->sense_buffer[0] & 0x70) == 0x70)
drivers/scsi/u14-34f.c +6 -0
@@ -1255,6 +1255,12 @@ static int u14_34f_queuecommand(struct scsi_cmnd *SCpnt, void (*done)(struct scs/* j is the board number */ j = ((struct hostdata *) SCpnt->device->host->hostdata)->board_number; +/* +* Call scsi_cmd_get_serial() because we need a valid serial number +* for reorder(). +*/ +scsi_cmd_get_serial (SCpnt); +if (SCpnt->host_scribble)panic ("%s: qcomm, pid %ld, SCpnt %p already active.\n" ,BN (j), SCpnt->serial_number, SCpnt);
include/linux/libata.h +1 -1
@@ -1187,7 +1187,7 @@ extern struct device_attribute *ata_common_sdev_attrs[]; .module = THIS_MODULE, \ .name = drv_name, \ .ioctl = ata_scsi_ioctl, \ - .queuecommand = ata_scsi_queuecmd, \ + .queuecommand_unlocked = ata_scsi_queuecmd, \ .can_queue = ATA_DEF_QUEUE, \ .this_id = ATA_SHT_THIS_ID, \ .cmd_per_lun = ATA_SHT_CMD_PER_LUN, \
include/scsi/scsi_cmnd.h +1 -0
@@ -136,6 +136,7 @@ extern struct scsi_cmnd *__scsi_get_command(struct Scsi_Host *, gfp_t);extern void scsi_put_command (struct scsi_cmnd *);extern void __scsi_put_command (struct Scsi_Host *,struct scsi_cmnd *,struct device *); +extern void scsi_cmd_get_serial (struct scsi_cmnd *);extern void scsi_finish_command (struct scsi_cmnd *cmd); extern void *scsi_kmap_atomic_sg(struct scatterlist *sg, int sg_count,
include/scsi/scsi_host.h +20 -3
@@ -106,6 +106,12 @@ struct scsi_host_template {* command before queuecommand returns, but in this case you * *must* return 0 from queuecommand). * +* Note that queuecommand() is the function used by legacy +* LLDs that require struct Scsi_Host->host_lock be held while +* dispatching struct scsi_cmnd descriptors. Modern LLDs that +* do not have this requirement run in 'host_lock-less' mode +* using queuecommand_unlocked below. +* * Queuecommand may also reject the command, in which case it may * not touch the command and must not call done() for it. *
@@ -131,6 +137,18 @@ struct scsi_host_template { void (*done)(struct scsi_cmnd *));/* +* The queuecommand_unlocked() function that provides an opitional +* method of struct Scsi_Host->host_lock less dispatch of +* struct scsi_cmnd descriptors. +* +* Note that this API caller is otherwise expected to function the +* exact same as the legacy queuecommand(). +* +* STATUS: OPTIONAL +*/ +int (* queuecommand_unlocked)(struct scsi_cmnd *, +void (*done)(struct scsi_cmnd *)); +/* * The transfer functions are used to queue a scsi command to * the LLD. When the driver is finished processing the command * the done callback is invoked.
@@ -604,10 +622,9 @@ struct Scsi_Host {short unsigned int max_sectors;unsigned long dma_boundary;/* -* Used to assign serial numbers to the cmds. -* Protected by the host lock. +* Used to assign serial numbers to the cmds in scsi_cmd_get_serial() */ -unsigned long cmd_serial_number; +atomic_t cmd_serial_number; unsigned active_mode:2; unsigned unchecked_isa_dma:1;
Signature · 1 line
1.7.3.2