Skip to contentSkip to conversation

scsi: Add IRQ_DISABLE_SCSI_QCMD wrapper

PATCH In review Nicholas A. Bellinger 1 participant 1 message Nov 12, 2010 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 3/11 scsi: Add IRQ_DISABLE_SCSI_QCMD wrapper

From: Nicholas Bellinger <[email protected]>

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.

---
 include/scsi/scsi_host.h |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
include/scsi/scsi_host.h +15 -0
index 6909038..ddb0622 100644
@@ -523,6 +523,21 @@ 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_cmnd *cmd,				\
+		 void (*done)(struct scsi_cmnd *))			\
+	{								\
+		unsigned long irq_flags;				\
+		int rc;							\
+		local_irq_save(irq_flags);				\
+		rc = func_name##_irq_disable (cmd, done);		\
+		local_irq_restore(irq_flags);				\
+		return rc;						\
+	}	
 
 /*
  * shost state: If you alter this, you also need to alter scsi_sysfs.c
Signature · 1 line
1.7.2.3