From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Nicholas A. Bellinger" Subject: [PATCH 02/12] scsi: Add IRQ_DISABLE_SCSI_QCMD wrapper Date: Sun, 19 Dec 2010 13:21:57 -0800 Message-ID: <1292793727-31957-3-git-send-email-nab@linux-iscsi.org> References: <1292793727-31957-1-git-send-email-nab@linux-iscsi.org> Return-path: Received: from nm26-vm0.bullet.mail.ac4.yahoo.com ([98.139.52.242]:43027 "HELO nm26-vm0.bullet.mail.ac4.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1757194Ab0LSVWZ (ORCPT ); Sun, 19 Dec 2010 16:22:25 -0500 In-Reply-To: <1292793727-31957-1-git-send-email-nab@linux-iscsi.org> Sender: linux-scsi-owner@vger.kernel.org List-Id: linux-scsi@vger.kernel.org To: linux-scsi , linux-kernel , James Bottomley , Jeff Garzik , Christoph Hellwig Cc: Mike Anderson , Tejun Heo , Vasu Dev , Tim Chen , Andi Kleen , Ravi Anand , Andrew Vasquez , Joe Eykholt , James Smart , Douglas Gilbert , adam radford , Kashyap Desai , MPTFusionLinux , Nicholas Bellinger From: Nicholas Bellinger This patch adds a IRQ_DISABLE_SCSI_QCMD() wrapper macro used by LLDs that can now run in host_lock less mode, but still need interrupts disabled using local_irq_save() before calling their lld_queuecommand() dispatcher. jgarzik says this method is in fact slower than doing a spin_lock_irqsave() on internal lib_lld_queuecommand() callers (as is done in libiscsi and libata) but is still needed by the majority of lock_less LLDs. Signed-off-by: Nicholas A. Bellinger --- include/scsi/scsi_host.h | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index e7e3858..321b114 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h @@ -521,6 +521,20 @@ struct scsi_host_template { return rc; \ } +/* + * Used for LLDs running in lock-less mode, but that still require having + * interrupts disable during their lld_queuecommand() dispatch. + */ +#define IRQ_DISABLE_SCSI_QCMD(func_name) \ + int func_name(struct Scsi_Host *shost, struct scsi_cmnd *cmd) \ + { \ + unsigned long irq_flags; \ + int rc; \ + local_irq_save(irq_flags); \ + rc = func_name##_irq_disable(cmd, cmd->scsi_done); \ + local_irq_restore(irq_flags); \ + return rc; \ + } /* * shost state: If you alter this, you also need to alter scsi_sysfs.c -- 1.7.3.4