Skip to contentSkip to conversation

tcm: Add transport_generic_handle_cdb_map() wrapper

PATCH New Nicholas A. Bellinger 1 participant 1 message Nov 9, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tcm: Add transport_generic_handle_cdb_map() wrapper

From: Nicholas Bellinger <[email protected]>

Hi hch,

Here is a patch that goes along with the:

[PATCH 1/9] target: remove never changing indirections in se_cmd

which adds a new transport_generic_handle_cdb_map() wrapper around the transport_add_cmd_to_queue(cmd, TRANSPORT_NEW_CMD_MAP) call used by tcm_loop_fabric_scsi.c:tcm_loop_queuecommand() to hand off of the TFO->new_cmd_map() caller.

---
 drivers/target/target_core_transport.c         |   26 +++++++++++++++++++++--
 drivers/target/tcm_loop/tcm_loop_fabric_scsi.c |    2 +-
 include/target/target_core_transport.h         |    1 +
 3 files changed, 25 insertions(+), 4 deletions(-)
drivers/target/target_core_transport.c +23 -3
index 6a6936e..fda11e9 100644
@@ -2943,14 +2943,15 @@ int transport_generic_allocate_tasks(
 }
 EXPORT_SYMBOL(transport_generic_allocate_tasks);
 
-/*	transport_generic_handle_cdb():
- *
- *
+/* 
+ * Used by fabric module frontends not defining a TFO->new_cmd_map()
+ * to queue up a newly setup se_cmd w/ TRANSPORT_NEW_CMD statis
  */
 int transport_generic_handle_cdb(
 	struct se_cmd *cmd)
 {
 	if (!SE_LUN(cmd)) {
+		dump_stack();
 		printk(KERN_ERR "SE_LUN(cmd) is NULL\n");
 		return -1;
 	}
@@ -2960,6 +2961,25 @@ int transport_generic_handle_cdb(
 }
 EXPORT_SYMBOL(transport_generic_handle_cdb);
 
+/*
+ * Used by fabric module frontends defining a TFO->new_cmd_map() caller
+ * to  queue up a newly setup se_cmd w/ TRANSPORT_NEW_CMD_MAP in order to
+ * complete setup in TCM process context w/ TFO->new_cmd_map().
+ */
+int transport_generic_handle_cdb_map(
+	struct se_cmd *cmd)
+{
+	if (!SE_LUN(cmd)) {
+		dump_stack();
+		printk(KERN_ERR "SE_LUN(cmd) is NULL\n");
+		return -1;
+	}
+
+	transport_add_cmd_to_queue(cmd, TRANSPORT_NEW_CMD_MAP);
+	return 0;	
+}
+EXPORT_SYMBOL(transport_generic_handle_cdb_map);
+
 /*	transport_generic_handle_data():
  *
  *
drivers/target/tcm_loop/tcm_loop_fabric_scsi.c +1 -1
index 3c204a8..80f2940 100644
@@ -350,7 +350,7 @@ static int tcm_loop_queuecommand(
 	/*
 	 * Queue up the newly allocated to be processed in TCM thread context.
 	*/
-	transport_add_cmd_to_queue(se_cmd, TRANSPORT_NEW_CMD_MAP);
+	transport_generic_handle_cdb_map(se_cmd);
 	/*
 	 * Reaquire the the struct scsi_host->host_lock before returning
 	 */
include/target/target_core_transport.h +1 -0
index 0701618..88d208e 100644
@@ -203,6 +203,7 @@ extern void transport_init_se_cmd(struct se_cmd *,
 extern void transport_free_se_cmd(struct se_cmd *);
 extern int transport_generic_allocate_tasks(struct se_cmd *, unsigned char *);
 extern int transport_generic_handle_cdb(struct se_cmd *);
+extern int transport_generic_handle_cdb_map(struct se_cmd *);
 extern int transport_generic_handle_data(struct se_cmd *);
 extern int transport_generic_handle_tmr(struct se_cmd *);
 extern int transport_stop_tasks_for_cmd(struct se_cmd *);
Signature · 1 line
1.5.6.5