Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bc0c94b1 authored by Nicholas Bellinger's avatar Nicholas Bellinger
Browse files

target: Drop unnecessary core_tpg_register TFO parameter



This patch drops unnecessary target_core_fabric_ops parameter usage
for core_tpg_register() during fabric driver TFO->fabric_make_tpg()
se_portal_group creation callback execution.

Instead, use the existing se_wwn->wwn_tf->tf_ops pointer to ensure
fabric driver is really using the same TFO provided at module_init
time.

Also go ahead and drop the forward TFO declarations tree-wide, and
handling the special case for iscsi-target discovery TPG.

Cc: Christoph Hellwig <hch@lst.de>
Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent 9e37d042
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -92,7 +92,6 @@ MODULE_PARM_DESC(srpt_service_guid,
		 " instead of using the node_guid of the first HCA.");

static struct ib_client srpt_client;
static const struct target_core_fabric_ops srpt_template;
static void srpt_release_channel(struct srpt_rdma_ch *ch);
static int srpt_queue_status(struct se_cmd *cmd);

@@ -3733,8 +3732,7 @@ static struct se_portal_group *srpt_make_tpg(struct se_wwn *wwn,
	int res;

	/* Initialize sport->port_wwn and sport->port_tpg_1 */
	res = core_tpg_register(&srpt_template, &sport->port_wwn,
			&sport->port_tpg_1, SCSI_PROTOCOL_SRP);
	res = core_tpg_register(&sport->port_wwn, &sport->port_tpg_1, SCSI_PROTOCOL_SRP);
	if (res)
		return ERR_PTR(res);

+2 −7
Original line number Diff line number Diff line
@@ -52,9 +52,6 @@
static struct workqueue_struct *tcm_qla2xxx_free_wq;
static struct workqueue_struct *tcm_qla2xxx_cmd_wq;

static const struct target_core_fabric_ops tcm_qla2xxx_ops;
static const struct target_core_fabric_ops tcm_qla2xxx_npiv_ops;

/*
 * Parse WWN.
 * If strict, we require lower-case hex and colon separators to be sure
@@ -1004,8 +1001,7 @@ static struct se_portal_group *tcm_qla2xxx_make_tpg(
	tpg->tpg_attrib.cache_dynamic_acls = 1;
	tpg->tpg_attrib.demo_mode_login_only = 1;

	ret = core_tpg_register(&tcm_qla2xxx_ops, wwn, &tpg->se_tpg,
				SCSI_PROTOCOL_FCP);
	ret = core_tpg_register(wwn, &tpg->se_tpg, SCSI_PROTOCOL_FCP);
	if (ret < 0) {
		kfree(tpg);
		return NULL;
@@ -1124,8 +1120,7 @@ static struct se_portal_group *tcm_qla2xxx_npiv_make_tpg(
	tpg->tpg_attrib.cache_dynamic_acls = 1;
	tpg->tpg_attrib.demo_mode_login_only = 1;

	ret = core_tpg_register(&tcm_qla2xxx_npiv_ops, wwn, &tpg->se_tpg,
				SCSI_PROTOCOL_FCP);
	ret = core_tpg_register(wwn, &tpg->se_tpg, SCSI_PROTOCOL_FCP);
	if (ret < 0) {
		kfree(tpg);
		return NULL;
+1 −2
Original line number Diff line number Diff line
@@ -1419,8 +1419,7 @@ static struct se_portal_group *lio_target_tiqn_addtpg(
	if (!tpg)
		return NULL;

	ret = core_tpg_register(&iscsi_ops, wwn, &tpg->tpg_se_tpg,
				SCSI_PROTOCOL_ISCSI);
	ret = core_tpg_register(wwn, &tpg->tpg_se_tpg, SCSI_PROTOCOL_ISCSI);
	if (ret < 0)
		return NULL;

+6 −2
Original line number Diff line number Diff line
@@ -66,8 +66,12 @@ int iscsit_load_discovery_tpg(void)
		pr_err("Unable to allocate struct iscsi_portal_group\n");
		return -1;
	}

	ret = core_tpg_register(&iscsi_ops, NULL, &tpg->tpg_se_tpg, -1);
	/*
	 * Save iscsi_ops pointer for special case discovery TPG that
	 * doesn't exist as se_wwn->wwn_group within configfs.
	 */
	tpg->tpg_se_tpg.se_tpg_tfo = &iscsi_ops;
	ret = core_tpg_register(NULL, &tpg->tpg_se_tpg, -1);
	if (ret < 0) {
		kfree(tpg);
		return -1;
+1 −4
Original line number Diff line number Diff line
@@ -40,8 +40,6 @@

#define to_tcm_loop_hba(hba)	container_of(hba, struct tcm_loop_hba, dev)

static const struct target_core_fabric_ops loop_ops;

static struct workqueue_struct *tcm_loop_workqueue;
static struct kmem_cache *tcm_loop_cmd_cache;

@@ -1081,8 +1079,7 @@ static struct se_portal_group *tcm_loop_make_naa_tpg(
	/*
	 * Register the tl_tpg as a emulated SAS TCM Target Endpoint
	 */
	ret = core_tpg_register(&loop_ops, wwn, &tl_tpg->tl_se_tpg,
				tl_hba->tl_proto_id);
	ret = core_tpg_register(wwn, &tl_tpg->tl_se_tpg, tl_hba->tl_proto_id);
	if (ret < 0)
		return ERR_PTR(-ENOMEM);

Loading