Skip to contentSkip to conversation

target: merge release_cmd methods

PATCH Christoph Hellwig 2 participants 2 messages Jun 1, 2011 – Jun 4, 2011 1 message not in the archive

Subsystems (7)
lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

[add the missing lists]

On Tue, May 31, 2011 at 09:57:18PM -0400, Christoph Hellwig wrote:
The release_cmd_to_pool and release_cmd_direct methods are always the same. Merge them into a single release_cmd method, and clean up the fallout.

Documentation/target/tcm_mod_builder.py +2 -3
Index: lio-core/Documentation/target/tcm_mod_builder.py
===================================================================
@@ -391,8 +391,7 @@ def tcm_mod_build_configfs(proto_ident,
 	buf += "	.tpg_alloc_fabric_acl		= " + fabric_mod_name + "_alloc_fabric_acl,\n"
 	buf += "	.tpg_release_fabric_acl		= " + fabric_mod_name + "_release_fabric_acl,\n"
 	buf += "	.tpg_get_inst_index		= " + fabric_mod_name + "_tpg_get_inst_index,\n"
-	buf += "	.release_cmd_to_pool		= " + fabric_mod_name + "_release_cmd,\n"
-	buf += "	.release_cmd_direct		= " + fabric_mod_name + "_release_cmd,\n"
+	buf += "	.release_cmd			= " + fabric_mod_name + "_release_cmd,\n"
 	buf += "	.shutdown_session		= " + fabric_mod_name + "_shutdown_session,\n"
 	buf += "	.close_session			= " + fabric_mod_name + "_close_session,\n"
 	buf += "	.stop_session			= " + fabric_mod_name + "_stop_session,\n"
@@ -814,7 +813,7 @@ def tcm_mod_dump_fabric_ops(proto_ident,
 			buf += "}\n\n"
 			bufi += "u32 " + fabric_mod_name + "_tpg_get_inst_index(struct se_portal_group *);\n"
 
-		if re.search('release_cmd_to_pool', fo):
+		if re.search('release_cmd', fo):
 			buf += "void " + fabric_mod_name + "_release_cmd(struct se_cmd *se_cmd)\n"
 			buf += "{\n"
 			buf += "	return;\n"
drivers/infiniband/ulp/srpt/ib_srpt.c +2 -3
Index: lio-core/drivers/infiniband/ulp/srpt/ib_srpt.c
===================================================================
@@ -1347,7 +1347,7 @@ static void srpt_put_send_ioctx(struct s
 	WARN_ON(srpt_get_cmd_state(ioctx) != SRPT_STATE_DONE);
 
 	srpt_unmap_sg_to_ib_sge(ioctx->ch, ioctx);
-	transport_generic_free_cmd(&ioctx->cmd, 0, 1, 0);
+	transport_generic_free_cmd(&ioctx->cmd, 0, 0);
 
 	if (ioctx->n_rbuf > 1) {
 		kfree(ioctx->rbufs);
@@ -3845,8 +3845,7 @@ static struct target_core_fabric_ops srp
 	.tpg_alloc_fabric_acl		= srpt_alloc_fabric_acl,
 	.tpg_release_fabric_acl		= srpt_release_fabric_acl,
 	.tpg_get_inst_index		= srpt_tpg_get_inst_index,
-	.release_cmd_to_pool		= srpt_release_cmd,
-	.release_cmd_direct		= srpt_release_cmd,
+	.release_cmd			= srpt_release_cmd,
 	.check_stop_free		= srpt_check_stop_free,
 	.shutdown_session		= srpt_shutdown_session,
 	.close_session			= srpt_close_session,
drivers/scsi/ibmvscsi/ibmvscsis.c +2 -3
Index: lio-core/drivers/scsi/ibmvscsi/ibmvscsis.c
===================================================================
@@ -446,8 +446,7 @@ static struct target_core_fabric_ops ibm
 	.tpg_get_inst_index		= ibmvscsis_tpg_get_inst_index,
 	.new_cmd_map			= ibmvscsis_new_cmd_map,
 	.check_stop_free		= ibmvscsis_check_stop_free,
-	.release_cmd_to_pool		= ibmvscsis_release_cmd,
-	.release_cmd_direct		= ibmvscsis_release_cmd,
+	.release_cmd			= ibmvscsis_release_cmd,
 	.shutdown_session		= ibmvscsis_shutdown_session,
 	.close_session			= ibmvscsis_close_session,
 	.stop_session			= ibmvscsis_stop_session,
@@ -923,7 +922,7 @@ static void ibmvscsis_check_stop_free(st
 {
 	if (se_cmd->se_tmr_req)
 		return;
-	transport_generic_free_cmd(se_cmd, 0, 1, 0);
+	transport_generic_free_cmd(se_cmd, 0, 0);
 }
 
 static u64 scsi_lun_to_int(u64 lun)
drivers/target/iscsi/iscsi_target_configfs.c +1 -9
Index: lio-core/drivers/target/iscsi/iscsi_target_configfs.c
===================================================================
@@ -1758,13 +1758,6 @@ static void lio_set_default_node_attribu
 	iscsit_set_default_node_attribues(acl);
 }
 
-static void lio_release_cmd_direct(struct se_cmd *se_cmd)
-{
-	struct iscsi_cmd *cmd = container_of(se_cmd, struct iscsi_cmd, se_cmd);
-
-	iscsit_release_cmd(cmd);
-}
-
 static void lio_release_cmd(struct se_cmd *se_cmd)
 {
 	struct iscsi_cmd *cmd = container_of(se_cmd, struct iscsi_cmd, se_cmd);
@@ -1809,8 +1802,7 @@ int iscsi_target_register_configfs(void)
 	fabric->tf_ops.tpg_alloc_fabric_acl = &lio_tpg_alloc_fabric_acl;
 	fabric->tf_ops.tpg_release_fabric_acl = &lio_tpg_release_fabric_acl;
 	fabric->tf_ops.tpg_get_inst_index = &lio_tpg_get_inst_index;
-	fabric->tf_ops.release_cmd_to_pool = &lio_release_cmd;
-	fabric->tf_ops.release_cmd_direct = &lio_release_cmd_direct;
+	fabric->tf_ops.release_cmd = &lio_release_cmd;
 	fabric->tf_ops.shutdown_session = &lio_tpg_shutdown_session;
 	fabric->tf_ops.close_session = &lio_tpg_close_session;
 	fabric->tf_ops.stop_session = &lio_tpg_stop_session;
drivers/target/loopback/tcm_loop.c +4 -8
Index: lio-core/drivers/target/loopback/tcm_loop.c
===================================================================
@@ -204,13 +204,10 @@ static void tcm_loop_check_stop_free(str
 	 * Release the struct se_cmd, which will make a callback to release
 	 * struct tcm_loop_cmd * in tcm_loop_deallocate_core_cmd()
 	 */
-	transport_generic_free_cmd(se_cmd, 0, 1, 0);
+	transport_generic_free_cmd(se_cmd, 0, 0);
 }
 
-/*
- * Called from struct target_core_fabric_ops->release_cmd_to_pool()
- */
-static void tcm_loop_deallocate_core_cmd(struct se_cmd *se_cmd)
+static void tcm_loop_release_cmd(struct se_cmd *se_cmd)
 {
 	struct tcm_loop_cmd *tl_cmd = container_of(se_cmd,
 				struct tcm_loop_cmd, tl_se_cmd);
@@ -395,7 +392,7 @@ static int tcm_loop_device_reset(struct
 		SUCCESS : FAILED;
 release:
 	if (se_cmd)
-		transport_generic_free_cmd(se_cmd, 1, 1, 0);
+		transport_generic_free_cmd(se_cmd, 1, 0);
 	else
 		kmem_cache_free(tcm_loop_cmd_cache, tl_cmd);
 	kfree(tl_tmr);
@@ -1415,8 +1412,7 @@ static int tcm_loop_register_configfs(vo
 	 */
 	fabric->tf_ops.new_cmd_map = &tcm_loop_new_cmd_map;
 	fabric->tf_ops.check_stop_free = &tcm_loop_check_stop_free;
-	fabric->tf_ops.release_cmd_to_pool = &tcm_loop_deallocate_core_cmd;
-	fabric->tf_ops.release_cmd_direct = &tcm_loop_deallocate_core_cmd;
+	fabric->tf_ops.release_cmd = &tcm_loop_release_cmd;
 	fabric->tf_ops.shutdown_session = &tcm_loop_shutdown_session;
 	fabric->tf_ops.close_session = &tcm_loop_close_session;
 	fabric->tf_ops.stop_session = &tcm_loop_stop_session;
drivers/target/target_core_configfs.c +2 -6
Index: lio-core/drivers/target/target_core_configfs.c
===================================================================
@@ -427,12 +427,8 @@ static int target_fabric_tf_ops_check(
 		printk(KERN_ERR "Missing tfo->tpg_get_inst_index()\n");
 		return -EINVAL;
 	}
-	if (!(tfo->release_cmd_to_pool)) {
-		printk(KERN_ERR "Missing tfo->release_cmd_to_pool()\n");
-		return -EINVAL;
-	}
-	if (!(tfo->release_cmd_direct)) {
-		printk(KERN_ERR "Missing tfo->release_cmd_direct()\n");
+	if (!tfo->release_cmd) {
+		printk(KERN_ERR "Missing tfo->release_cmd()\n");
 		return -EINVAL;
 	}
 	if (!(tfo->shutdown_session)) {
drivers/target/target_core_transport.c +19 -34

149 lines not on this page · raw message

drivers/target/tcm_fc/tfc_conf.c +1 -2
Index: lio-core/drivers/target/tcm_fc/tfc_conf.c
===================================================================
@@ -536,8 +536,7 @@ static struct target_core_fabric_ops ft_
 	.tpg_release_fabric_acl =	ft_tpg_release_fabric_acl,
 	.tpg_get_inst_index =		ft_tpg_get_inst_index,
 	.check_stop_free =		ft_check_stop_free,
-	.release_cmd_to_pool =		ft_release_cmd,
-	.release_cmd_direct =		ft_release_cmd,
+	.release_cmd =			ft_release_cmd,
 	.shutdown_session =		ft_sess_shutdown,
 	.close_session =		ft_sess_close,
 	.stop_session =			ft_sess_stop,
drivers/target/tcm_qla2xxx/tcm_qla2xxx_configfs.c +2 -4
Index: lio-core/drivers/target/tcm_qla2xxx/tcm_qla2xxx_configfs.c
===================================================================
@@ -1212,8 +1212,7 @@ static struct target_core_fabric_ops tcm
 	.tpg_get_inst_index		= tcm_qla2xxx_tpg_get_inst_index,
 	.new_cmd_map			= tcm_qla2xxx_new_cmd_map,
 	.check_stop_free		= tcm_qla2xxx_check_stop_free,
-	.release_cmd_to_pool		= tcm_qla2xxx_release_cmd,
-	.release_cmd_direct		= tcm_qla2xxx_release_cmd,
+	.release_cmd			= tcm_qla2xxx_release_cmd,
 	.shutdown_session		= tcm_qla2xxx_shutdown_session,
 	.close_session			= tcm_qla2xxx_close_session,
 	.stop_session			= tcm_qla2xxx_stop_session,
@@ -1263,8 +1262,7 @@ static struct target_core_fabric_ops tcm
 	.tpg_alloc_fabric_acl		= tcm_qla2xxx_alloc_fabric_acl,
 	.tpg_release_fabric_acl		= tcm_qla2xxx_release_fabric_acl,
 	.tpg_get_inst_index		= tcm_qla2xxx_tpg_get_inst_index,
-	.release_cmd_to_pool		= tcm_qla2xxx_release_cmd,
-	.release_cmd_direct		= tcm_qla2xxx_release_cmd,
+	.release_cmd			= tcm_qla2xxx_release_cmd,
 	.shutdown_session		= tcm_qla2xxx_shutdown_session,
 	.close_session			= tcm_qla2xxx_close_session,
 	.stop_session			= tcm_qla2xxx_stop_session,
drivers/target/tcm_vhost/tcm_vhost_configfs.c +1 -2
Index: lio-core/drivers/target/tcm_vhost/tcm_vhost_configfs.c
===================================================================
@@ -615,8 +615,7 @@ static struct target_core_fabric_ops tcm
 	.tpg_release_fabric_acl		= tcm_vhost_release_fabric_acl,
 	.tpg_get_inst_index		= tcm_vhost_tpg_get_inst_index,
 	.new_cmd_map			= tcm_vhost_new_cmd_map,
-	.release_cmd_to_pool		= tcm_vhost_release_cmd,
-	.release_cmd_direct		= tcm_vhost_release_cmd,
+	.release_cmd			= tcm_vhost_release_cmd,
 	.shutdown_session		= tcm_vhost_shutdown_session,
 	.close_session			= tcm_vhost_close_session,
 	.stop_session			= tcm_vhost_stop_session,
include/target/target_core_fabric_ops.h +1 -2
Index: lio-core/include/target/target_core_fabric_ops.h
===================================================================
@@ -43,8 +43,7 @@ struct target_core_fabric_ops {
 	 * I/O descriptor in transport_cmd_check_stop()
 	 */
 	void (*check_stop_free)(struct se_cmd *);
-	void (*release_cmd_to_pool)(struct se_cmd *);
-	void (*release_cmd_direct)(struct se_cmd *);
+	void (*release_cmd)(struct se_cmd *);
 	/*
 	 * Called with spin_lock_bh(struct se_portal_group->session_lock held.
 	 */
drivers/target/iscsi/iscsi_target.c +2 -2
Index: lio-core/drivers/target/iscsi/iscsi_target.c
===================================================================
@@ -3570,7 +3570,7 @@ get_immediate:
 					iscsit_release_cmd(cmd);
 				else
 					transport_generic_free_cmd(SE_CMD(cmd),
-								1, 1, 0);
+								1, 0);
 				goto get_immediate;
 			case ISTATE_SEND_NOPIN_WANT_RESPONSE:
 				spin_unlock_bh(&cmd->istate_lock);
@@ -3985,7 +3985,7 @@ static void iscsit_release_commands_from
 			if (cmd->tmr_req && se_cmd->transport_wait_for_tasks)
 				se_cmd->transport_wait_for_tasks(se_cmd, 1, 1);
 			else if (SE_CMD(cmd)->se_cmd_flags & SCF_SE_LUN_CMD)
-				transport_release_cmd_to_pool(se_cmd);
+				transport_release_cmd(se_cmd);
 			else
 				iscsit_release_cmd(cmd);
 
drivers/target/tcm_fc/tfc_cmd.c +1 -1
Index: lio-core/drivers/target/tcm_fc/tfc_cmd.c
===================================================================
@@ -150,7 +150,7 @@ void ft_release_cmd(struct se_cmd *se_cm
 
 void ft_check_stop_free(struct se_cmd *se_cmd)
 {
-	transport_generic_free_cmd(se_cmd, 0, 1, 0);
+	transport_generic_free_cmd(se_cmd, 0, 0);
 }
 
 /*
drivers/target/tcm_qla2xxx/tcm_qla2xxx_fabric.c +2 -2
Index: lio-core/drivers/target/tcm_qla2xxx/tcm_qla2xxx_fabric.c
===================================================================
@@ -407,7 +407,7 @@ void tcm_qla2xxx_check_stop_free(struct
 		 * Release the associated se_cmd->se_tmr_req and se_cmd
 		 * TMR related state now.
 		 */
-		transport_generic_free_cmd(se_cmd, 1, 1, 0);
+		transport_generic_free_cmd(se_cmd, 1, 0);
 		qla_tgt_free_mcmd(mcmd);
 		return;
 	}
@@ -709,7 +709,7 @@ int tcm_qla2xxx_handle_tmr(struct qla_tg
 	 * Locate the underlying TCM struct se_lun from sc->device->lun
 	 */
 	if (transport_lookup_tmr_lun(se_cmd, lun) < 0) {
-		transport_generic_free_cmd(se_cmd, 1, 1, 0);
+		transport_generic_free_cmd(se_cmd, 1, 0);
 		return -EINVAL;
 	}
 	/*
include/target/target_core_transport.h +2 -2
Index: lio-core/include/target/target_core_transport.h
===================================================================
@@ -179,8 +179,8 @@ extern int transport_clear_lun_from_sess
 extern int transport_check_aborted_status(struct se_cmd *, int);
 extern int transport_send_check_condition_and_sense(struct se_cmd *, u8, int);
 extern void transport_send_task_abort(struct se_cmd *);
-extern void transport_release_cmd_to_pool(struct se_cmd *);
-extern void transport_generic_free_cmd(struct se_cmd *, int, int, int);
+extern void transport_release_cmd(struct se_cmd *);
+extern void transport_generic_free_cmd(struct se_cmd *, int, int);
 extern void transport_generic_wait_for_cmds(struct se_cmd *, int);
 extern int transport_init_task_sg(struct se_task *, struct se_mem *, u32);
 extern int transport_map_mem_to_sg(struct se_task *, struct list_head *,
#2 lore raw
Quoted 8 lines · Christoph Hellwig

[add the missing lists]

On Tue, May 31, 2011 at 09:57:18PM -0400, Christoph Hellwig wrote:
The release_cmd_to_pool and release_cmd_direct methods are always the same. Merge them into a single release_cmd method, and clean up the fallout.

Hey Christoph,

Apologies for the delay here.. I think this looks reasonable to merge into for v4.1, and thanks for the nice target core and fabric cleanup with TFO->release_cmd().

Committed as e6ce6902ad2 into lio-core-2.6.git/master with some minor transport_generic_free_cmd() parameter build breakage in drivers/target/tcm_fc/tfc_cmd.c.

--nab