linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/5] tcm: Move transport_emulate_control_cdb() into __transport_execute_tasks()
@ 2010-10-13  8:47 Nicholas A. Bellinger
  0 siblings, 0 replies; only message in thread
From: Nicholas A. Bellinger @ 2010-10-13  8:47 UTC (permalink / raw)
  To: linux-scsi, linux-kernel, Christoph Hellwig
  Cc: FUJITA Tomonori, Mike Christie, Hannes Reinecke, James Bottomley,
	Boaz Harrosh, Jens Axboe, Martin K. Petersen, Douglas Gilbert,
	Richard Sharpe, Nicholas Bellinger

From: Nicholas Bellinger <nab@linux-iscsi.org>

This patch moves control path CDB emulation transport_emulate_control_cdb()
calls from IBLOCK, FILEIO and RAMDISK spa->do_task() into a generic
location in __transport_execute_tasks().  This code is called by all
non TCM/pSCSI backstores to handle internal SCF_SCSI_DATA_SG_IO_CDB
emulation.

Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Reported-by: Christoph Hellwig <hch@lst.de>
---
 drivers/target/target_core_file.c      |    3 ---
 drivers/target/target_core_iblock.c    |    3 ---
 drivers/target/target_core_rd.c        |    3 ---
 drivers/target/target_core_transport.c |   17 ++++++++++++++++-
 4 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c
index 62b4b4e..a5ad51c 100644
--- a/drivers/target/target_core_file.c
+++ b/drivers/target/target_core_file.c
@@ -783,9 +783,6 @@ static int fd_do_task(struct se_task *task)
 	struct fd_request *req = task->transport_req;
 	int ret = 0;
 
-	if (!(TASK_CMD(task)->se_cmd_flags & SCF_SCSI_DATA_SG_IO_CDB))
-		return transport_emulate_control_cdb(task);
-
 	req->fd_lba = task->task_lba;
 	req->fd_size = task->task_size;
 	/*
diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c
index 061c513..d999f10 100644
--- a/drivers/target/target_core_iblock.c
+++ b/drivers/target/target_core_iblock.c
@@ -584,9 +584,6 @@ static int iblock_do_task(struct se_task *task)
 	int write = (TASK_CMD(task)->data_direction == DMA_TO_DEVICE);
 	int ret;
 
-	if (!(TASK_CMD(task)->se_cmd_flags & SCF_SCSI_DATA_SG_IO_CDB))
-		return transport_emulate_control_cdb(task);
-
 	while (bio) {
 		nbio = bio->bi_next;
 		bio->bi_next = NULL;
diff --git a/drivers/target/target_core_rd.c b/drivers/target/target_core_rd.c
index fe27e59..374cd16 100644
--- a/drivers/target/target_core_rd.c
+++ b/drivers/target/target_core_rd.c
@@ -710,9 +710,6 @@ static int rd_MEMCPY_do_task(struct se_task *task)
 	struct rd_request *req = task->transport_req;
 	int ret;
 
-	if (!(TASK_CMD(task)->se_cmd_flags & SCF_SCSI_DATA_SG_IO_CDB))
-		return transport_emulate_control_cdb(task);
-
 	req->rd_lba = task->task_lba;
 	req->rd_page = (req->rd_lba * DEV_ATTRIB(dev)->block_size) / PAGE_SIZE;
 	req->rd_offset = (do_div(req->rd_lba,
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index d02644c..e678686 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -4253,7 +4253,22 @@ check_depth:
 			transport_complete_task(task, 1);
 		}
 	} else {
-		error = TRANSPORT(dev)->do_task(task);
+		/*
+		 * Currently for all virtual TCM plugins including IBLOCK, FILEIO and
+		 * RAMDISK we use the internal transport_emulate_control_cdb() logic
+		 * with struct se_subsystem_api callers for the primary SPC-3 TYPE_DISK
+		 * LUN emulation code.
+		 *
+		 * For TCM/pSCSI and all other SCF_SCSI_DATA_SG_IO_CDB I/O tasks we
+		 * call ->do_task() directly and let the underlying TCM subsystem plugin
+		 * code handle the CDB emulation.
+		 */
+		if ((TRANSPORT(dev)->transport_type != TRANSPORT_PLUGIN_PHBA_PDEV) &&
+		    (!(TASK_CMD(task)->se_cmd_flags & SCF_SCSI_DATA_SG_IO_CDB)))
+			error = transport_emulate_control_cdb(task);
+		else
+			error = TRANSPORT(dev)->do_task(task);
+
 		if (error != 0) {
 			cmd->transport_error_status = error;
 			atomic_set(&task->task_active, 0);
-- 
1.5.6.5

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2010-10-13  8:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-13  8:47 [PATCH 1/5] tcm: Move transport_emulate_control_cdb() into __transport_execute_tasks() Nicholas A. Bellinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).