Messages in this thread | | | From | "Jack Wang" <> | Subject | RE: [PATCH] scsi: Add SHT->unlocked_qcmd for host_lock less SHT->queuecommand() dispatch | Date | Wed, 27 Oct 2010 09:52:07 +0800 |
| |
From: Nicholas Bellinger <nab@linux-iscsi.org>
Greetings all,
This patch adds scsi_dispatch_cmd_unlocked() and scsi_dispatch_cmd_locked() which are now called directly from scsi_dispatch_cmd() depending upon what is reported by SHT->unlocked_qcmd on a per driver basis. Note that by default unlocked_qcmd is disabled, and all LLDs not defining a SHT->unlocked_qcmd will be using the legacy scsi_dispatch_cmd_locked().
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 start struct Scsi_Host-> cmd_serial_number at 1, and increment each serial_number by 2 so that the serial is odd, and wraps to 1 instead of 0. struct Scsi_Host->cmd_serial_number is initialized to '1' in drivers/scsi/hosts.c:scsi_host_alloc().
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->unlocked_qcmd=1 for libsas queuecommand() mvsas: Set SHT->unlocked_qcmd=1 for libsas queuecommand() pm8001: Set SHT->unlocked_qcmd=1 for libsas queuecommand() libata: Remove host_lock unlock() + lock() from ata_scsi_queuecmd() lpfc: Remove host_lock unlock() + lock() from lpfc_queuecommand() qla4xxx: Remove host_lock unlock() + lock() from qla4xxx_queuecommand() qla2xxx: Remove host_lock unlock() + lock() from qla2xxx_queuecommand() fnic: Remove host_lock unlock() + lock() from fnic_queuecommand() mpt2sas: Add scsi_cmd_get_serial() call and set SHT->unlocked_qcmd=1 mpt/fusion: Add scsi_cmd_get_serial() call and set SHT->unlocked_qcmd=1 dpt_i2o: Add scsi_cmd_get_serial() call eata: Add scsi_cmd_get_serial() call u14-34f: Add scsi_cmd_get_serial() call
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org> Acked-by: Ravi Anand <ravi.anand@qlogic.com> (for qla2xx) Acked-by: Luben Tuikov <ltuikov@yahoo.com> (for aic94xx)
Hi, Nab
Please consider to add my ack. Thanks! Acked-by: Jack Wang <jack_wang@usish.com> (for pm8001)
Jack
| |