[PATCH] tcm_loop: Drop host_lock around struct scsi_cmnd->scsi_done()

From: Nicholas A. Bellinger
Date: Wed Sep 01 2010 - 17:23:37 EST


From: Nicholas Bellinger <nab@xxxxxxxxxxxxxxx>

Greetings all,

This patch updates tcm_loop_queue_data_in() and tcm_loop_queue_status()
to no longer hold struct Scsi_Host->host_lock while calling the
struct scsi_cmnd->scsi_done() callback, in order queue the *sc off into
the block softirq. This optimization is safely allowed for SCSI LLDs on
modern v2.6 kernels, and is done by the majority of mainline SCSI LLDs.

Thanks to Vasu Dev to the clarification on this item!

Signed-off-by: Nicholas A. Bellinger <nab@xxxxxxxxxxxxxxx>
---
drivers/target/tcm_loop/tcm_loop_fabric.c | 7 -------
1 files changed, 0 insertions(+), 7 deletions(-)

diff --git a/drivers/target/tcm_loop/tcm_loop_fabric.c b/drivers/target/tcm_loop/tcm_loop_fabric.c
index 588730a..ef23f07 100644
--- a/drivers/target/tcm_loop/tcm_loop_fabric.c
+++ b/drivers/target/tcm_loop/tcm_loop_fabric.c
@@ -379,7 +379,6 @@ int tcm_loop_queue_data_in(struct se_cmd *se_cmd)
struct tcm_loop_cmd *tl_cmd =
(struct tcm_loop_cmd *)se_cmd->se_fabric_cmd_ptr;
struct scsi_cmnd *sc = tl_cmd->sc;
- unsigned long flags;

TL_CDB_DEBUG( "tcm_loop_queue_data_in() called for scsi_cmnd: %p"
" cdb: 0x%02x\n", sc, sc->cmnd[0]);
@@ -393,10 +392,7 @@ int tcm_loop_queue_data_in(struct se_cmd *se_cmd)
}

sc->result = host_byte(DID_OK) | SAM_STAT_GOOD;
-
- spin_lock_irqsave(sc->device->host->host_lock, flags);
(*sc->scsi_done)(sc);
- spin_unlock_irqrestore(sc->device->host->host_lock, flags);
return 0;
}

@@ -405,7 +401,6 @@ int tcm_loop_queue_status(struct se_cmd *se_cmd)
struct tcm_loop_cmd *tl_cmd =
(struct tcm_loop_cmd *)se_cmd->se_fabric_cmd_ptr;
struct scsi_cmnd *sc = tl_cmd->sc;
- unsigned long flags;

TL_CDB_DEBUG("tcm_loop_queue_status() called for scsi_cmnd: %p"
" cdb: 0x%02x\n", sc, sc->cmnd[0]);
@@ -421,9 +416,7 @@ int tcm_loop_queue_status(struct se_cmd *se_cmd)
} else
sc->result = host_byte(DID_OK) | se_cmd->scsi_status;

- spin_lock_irqsave(sc->device->host->host_lock, flags);
(*sc->scsi_done)(sc);
- spin_unlock_irqrestore(sc->device->host->host_lock, flags);
return 0;
}

--
1.5.6.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/