target: make the tpg_get_default_depth method optional
authorChristoph Hellwig <hch@lst.de>
Mon, 13 Apr 2015 17:51:13 +0000 (19:51 +0200)
committerNicholas Bellinger <nab@linux-iscsi.org>
Sun, 31 May 2015 05:41:50 +0000 (22:41 -0700)
All fabric drivers except for iSCSI always return 1, so implement
that as default behavior.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Documentation/target/tcm_mod_builder.py
drivers/infiniband/ulp/srpt/ib_srpt.c
drivers/scsi/qla2xxx/tcm_qla2xxx.c
drivers/target/loopback/tcm_loop.c
drivers/target/sbp/sbp_target.c
drivers/target/target_core_configfs.c
drivers/target/target_core_tpg.c
drivers/target/tcm_fc/tfc_conf.c
drivers/usb/gadget/legacy/tcm_usb_gadget.c
drivers/vhost/scsi.c
drivers/xen/xen-scsiback.c

index 2ba71cea01723cf3216ef4e95708789b6e0cc9f2..3dab9b28f4f0fa549727b8b26cfdb1c0aa964598 100755 (executable)
@@ -377,7 +377,6 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name):
        buf += "        .get_fabric_proto_ident         = " + fabric_mod_name + "_get_fabric_proto_ident,\n"
        buf += "        .tpg_get_wwn                    = " + fabric_mod_name + "_get_fabric_wwn,\n"
        buf += "        .tpg_get_tag                    = " + fabric_mod_name + "_get_tag,\n"
-       buf += "        .tpg_get_default_depth          = " + fabric_mod_name + "_get_default_depth,\n"
        buf += "        .tpg_get_pr_transport_id        = " + fabric_mod_name + "_get_pr_transport_id,\n"
        buf += "        .tpg_get_pr_transport_id_len    = " + fabric_mod_name + "_get_pr_transport_id_len,\n"
        buf += "        .tpg_parse_pr_out_transport_id  = " + fabric_mod_name + "_parse_pr_out_transport_id,\n"
@@ -590,13 +589,6 @@ def tcm_mod_dump_fabric_ops(proto_ident, fabric_mod_dir_var, fabric_mod_name):
                        buf += "}\n\n"
                        bufi += "u16 " + fabric_mod_name + "_get_tag(struct se_portal_group *);\n"
 
-               if re.search('get_default_depth', fo):
-                       buf += "u32 " + fabric_mod_name + "_get_default_depth(struct se_portal_group *se_tpg)\n"
-                       buf += "{\n"
-                       buf += "        return 1;\n"
-                       buf += "}\n\n"
-                       bufi += "u32 " + fabric_mod_name + "_get_default_depth(struct se_portal_group *);\n"
-
                if re.search('get_pr_transport_id\)\(', fo):
                        buf += "u32 " + fabric_mod_name + "_get_pr_transport_id(\n"
                        buf += "        struct se_portal_group *se_tpg,\n"
index 6fbc7bc824d292dab1d9cedf06f8fba2d2af1dc3..8198d4cb0694f9365e47c49dcf429bed34494af4 100644 (file)
@@ -3411,11 +3411,6 @@ static u16 srpt_get_tag(struct se_portal_group *tpg)
        return 1;
 }
 
-static u32 srpt_get_default_depth(struct se_portal_group *se_tpg)
-{
-       return 1;
-}
-
 static u32 srpt_get_pr_transport_id(struct se_portal_group *se_tpg,
                                    struct se_node_acl *se_nacl,
                                    struct t10_pr_registration *pr_reg,
@@ -3920,7 +3915,6 @@ static const struct target_core_fabric_ops srpt_template = {
        .get_fabric_proto_ident         = srpt_get_fabric_proto_ident,
        .tpg_get_wwn                    = srpt_get_fabric_wwn,
        .tpg_get_tag                    = srpt_get_tag,
-       .tpg_get_default_depth          = srpt_get_default_depth,
        .tpg_get_pr_transport_id        = srpt_get_pr_transport_id,
        .tpg_get_pr_transport_id_len    = srpt_get_pr_transport_id_len,
        .tpg_parse_pr_out_transport_id  = srpt_parse_pr_out_transport_id,
index 8a6c875473037f52cf60959852d97de74cd69d5f..5d69abcf9ed0bf272fe0807d3fbe1f73fc64ca6d 100644 (file)
@@ -223,11 +223,6 @@ static u16 tcm_qla2xxx_get_tag(struct se_portal_group *se_tpg)
        return tpg->lport_tpgt;
 }
 
-static u32 tcm_qla2xxx_get_default_depth(struct se_portal_group *se_tpg)
-{
-       return 1;
-}
-
 static u32 tcm_qla2xxx_get_pr_transport_id(
        struct se_portal_group *se_tpg,
        struct se_node_acl *se_nacl,
@@ -1991,7 +1986,6 @@ static const struct target_core_fabric_ops tcm_qla2xxx_ops = {
        .get_fabric_proto_ident         = tcm_qla2xxx_get_fabric_proto_ident,
        .tpg_get_wwn                    = tcm_qla2xxx_get_fabric_wwn,
        .tpg_get_tag                    = tcm_qla2xxx_get_tag,
-       .tpg_get_default_depth          = tcm_qla2xxx_get_default_depth,
        .tpg_get_pr_transport_id        = tcm_qla2xxx_get_pr_transport_id,
        .tpg_get_pr_transport_id_len    = tcm_qla2xxx_get_pr_transport_id_len,
        .tpg_parse_pr_out_transport_id  = tcm_qla2xxx_parse_pr_out_transport_id,
@@ -2049,7 +2043,6 @@ static const struct target_core_fabric_ops tcm_qla2xxx_npiv_ops = {
        .get_fabric_proto_ident         = tcm_qla2xxx_get_fabric_proto_ident,
        .tpg_get_wwn                    = tcm_qla2xxx_get_fabric_wwn,
        .tpg_get_tag                    = tcm_qla2xxx_get_tag,
-       .tpg_get_default_depth          = tcm_qla2xxx_get_default_depth,
        .tpg_get_pr_transport_id        = tcm_qla2xxx_get_pr_transport_id,
        .tpg_get_pr_transport_id_len    = tcm_qla2xxx_get_pr_transport_id_len,
        .tpg_parse_pr_out_transport_id  = tcm_qla2xxx_parse_pr_out_transport_id,
index e11bcf3e0889907f801d8a04a2a09c3a500cc75e..12b85b03e9ae0b0a78afb6e52e86d8968e5b3948 100644 (file)
@@ -566,11 +566,6 @@ static u16 tcm_loop_get_tag(struct se_portal_group *se_tpg)
        return tl_tpg->tl_tpgt;
 }
 
-static u32 tcm_loop_get_default_depth(struct se_portal_group *se_tpg)
-{
-       return 1;
-}
-
 static u32 tcm_loop_get_pr_transport_id(
        struct se_portal_group *se_tpg,
        struct se_node_acl *se_nacl,
@@ -1378,7 +1373,6 @@ static const struct target_core_fabric_ops loop_ops = {
        .get_fabric_proto_ident         = tcm_loop_get_fabric_proto_ident,
        .tpg_get_wwn                    = tcm_loop_get_endpoint_wwn,
        .tpg_get_tag                    = tcm_loop_get_tag,
-       .tpg_get_default_depth          = tcm_loop_get_default_depth,
        .tpg_get_pr_transport_id        = tcm_loop_get_pr_transport_id,
        .tpg_get_pr_transport_id_len    = tcm_loop_get_pr_transport_id_len,
        .tpg_parse_pr_out_transport_id  = tcm_loop_parse_pr_out_transport_id,
index 61da83be896667d5a0b88461e46074ea6f984389..0d70d4f58e43db8183f057e421da12c8b83c8066 100644 (file)
@@ -1707,11 +1707,6 @@ static u16 sbp_get_tag(struct se_portal_group *se_tpg)
        return tpg->tport_tpgt;
 }
 
-static u32 sbp_get_default_depth(struct se_portal_group *se_tpg)
-{
-       return 1;
-}
-
 static struct se_node_acl *sbp_alloc_fabric_acl(struct se_portal_group *se_tpg)
 {
        return kzalloc(sizeof(struct se_node_acl), GFP_KERNEL);
@@ -2490,7 +2485,6 @@ static const struct target_core_fabric_ops sbp_ops = {
        .get_fabric_proto_ident         = sbp_get_fabric_proto_ident,
        .tpg_get_wwn                    = sbp_get_fabric_wwn,
        .tpg_get_tag                    = sbp_get_tag,
-       .tpg_get_default_depth          = sbp_get_default_depth,
        .tpg_get_pr_transport_id        = sbp_get_pr_transport_id,
        .tpg_get_pr_transport_id_len    = sbp_get_pr_transport_id_len,
        .tpg_parse_pr_out_transport_id  = sbp_parse_pr_out_transport_id,
index e7b0430a0575d0403dbb38b0fd4d41df1ccce79d..c87ca0c50545e03de35bd8e1e3084648d3aa70dc 100644 (file)
@@ -330,10 +330,6 @@ static int target_fabric_tf_ops_check(const struct target_core_fabric_ops *tfo)
                pr_err("Missing tfo->tpg_get_tag()\n");
                return -EINVAL;
        }
-       if (!tfo->tpg_get_default_depth) {
-               pr_err("Missing tfo->tpg_get_default_depth()\n");
-               return -EINVAL;
-       }
        if (!tfo->tpg_get_pr_transport_id) {
                pr_err("Missing tfo->tpg_get_pr_transport_id()\n");
                return -EINVAL;
index 47f064415bf661fc2bb39b27762f870c4acabc56..5a9deb2b24af9047206daac48db1956405d5c319 100644 (file)
@@ -282,7 +282,10 @@ struct se_node_acl *core_tpg_check_initiator_node_acl(
        spin_lock_init(&acl->device_list_lock);
        spin_lock_init(&acl->nacl_sess_lock);
        atomic_set(&acl->acl_pr_ref_count, 0);
-       acl->queue_depth = tpg->se_tpg_tfo->tpg_get_default_depth(tpg);
+       if (tpg->se_tpg_tfo->tpg_get_default_depth)
+               acl->queue_depth = tpg->se_tpg_tfo->tpg_get_default_depth(tpg);
+       else
+               acl->queue_depth = 1;
        snprintf(acl->initiatorname, TRANSPORT_IQN_LEN, "%s", initiatorname);
        acl->se_tpg = tpg;
        acl->acl_index = scsi_get_new_index(SCSI_AUTH_INTR_INDEX);
index 65dce1345966e392fe57c6bf7eadd80dc86351cd..46b4387460e53921a9c0d378bef5e0733f5e8bd6 100644 (file)
@@ -486,11 +486,6 @@ static u16 ft_get_tag(struct se_portal_group *se_tpg)
        return tpg->index;
 }
 
-static u32 ft_get_default_depth(struct se_portal_group *se_tpg)
-{
-       return 1;
-}
-
 static int ft_check_false(struct se_portal_group *se_tpg)
 {
        return 0;
@@ -514,7 +509,6 @@ static const struct target_core_fabric_ops ft_fabric_ops = {
        .get_fabric_proto_ident =       fc_get_fabric_proto_ident,
        .tpg_get_wwn =                  ft_get_fabric_wwn,
        .tpg_get_tag =                  ft_get_tag,
-       .tpg_get_default_depth =        ft_get_default_depth,
        .tpg_get_pr_transport_id =      fc_get_pr_transport_id,
        .tpg_get_pr_transport_id_len =  fc_get_pr_transport_id_len,
        .tpg_parse_pr_out_transport_id = fc_parse_pr_out_transport_id,
index aba80e245e44ca25a0315fbe54bb7989a59b1796..b7a78f72fb0ece6ddaf96009ccb0964c92c8273b 100644 (file)
@@ -1307,11 +1307,6 @@ static u16 usbg_get_tag(struct se_portal_group *se_tpg)
        return tpg->tport_tpgt;
 }
 
-static u32 usbg_get_default_depth(struct se_portal_group *se_tpg)
-{
-       return 1;
-}
-
 static u32 usbg_get_pr_transport_id(
        struct se_portal_group *se_tpg,
        struct se_node_acl *se_nacl,
@@ -1852,7 +1847,6 @@ static const struct target_core_fabric_ops usbg_ops = {
        .get_fabric_proto_ident         = usbg_get_fabric_proto_ident,
        .tpg_get_wwn                    = usbg_get_fabric_wwn,
        .tpg_get_tag                    = usbg_get_tag,
-       .tpg_get_default_depth          = usbg_get_default_depth,
        .tpg_get_pr_transport_id        = usbg_get_pr_transport_id,
        .tpg_get_pr_transport_id_len    = usbg_get_pr_transport_id_len,
        .tpg_parse_pr_out_transport_id  = usbg_parse_pr_out_transport_id,
index d21f2ba6c899aab34dfe009be2927574c087a2b7..fb8a93d5bfba6d10a30872c6fd66b4514a2d9686 100644 (file)
@@ -326,11 +326,6 @@ static u16 vhost_scsi_get_tpgt(struct se_portal_group *se_tpg)
        return tpg->tport_tpgt;
 }
 
-static u32 vhost_scsi_get_default_depth(struct se_portal_group *se_tpg)
-{
-       return 1;
-}
-
 static u32
 vhost_scsi_get_pr_transport_id(struct se_portal_group *se_tpg,
                              struct se_node_acl *se_nacl,
@@ -2300,7 +2295,6 @@ static struct target_core_fabric_ops vhost_scsi_ops = {
        .get_fabric_proto_ident         = vhost_scsi_get_fabric_proto_ident,
        .tpg_get_wwn                    = vhost_scsi_get_fabric_wwn,
        .tpg_get_tag                    = vhost_scsi_get_tpgt,
-       .tpg_get_default_depth          = vhost_scsi_get_default_depth,
        .tpg_get_pr_transport_id        = vhost_scsi_get_pr_transport_id,
        .tpg_get_pr_transport_id_len    = vhost_scsi_get_pr_transport_id_len,
        .tpg_parse_pr_out_transport_id  = vhost_scsi_parse_pr_out_transport_id,
index b7f51504f85adc1b5d19d33e48d066bdd60684c5..c0d4aee0eeb5631a841e92ca9a01e0455f475f5d 100644 (file)
@@ -1292,11 +1292,6 @@ static u16 scsiback_get_tag(struct se_portal_group *se_tpg)
        return tpg->tport_tpgt;
 }
 
-static u32 scsiback_get_default_depth(struct se_portal_group *se_tpg)
-{
-       return 1;
-}
-
 static u32
 scsiback_get_pr_transport_id(struct se_portal_group *se_tpg,
                              struct se_node_acl *se_nacl,
@@ -1950,7 +1945,6 @@ static const struct target_core_fabric_ops scsiback_ops = {
        .get_fabric_proto_ident         = scsiback_get_fabric_proto_ident,
        .tpg_get_wwn                    = scsiback_get_fabric_wwn,
        .tpg_get_tag                    = scsiback_get_tag,
-       .tpg_get_default_depth          = scsiback_get_default_depth,
        .tpg_get_pr_transport_id        = scsiback_get_pr_transport_id,
        .tpg_get_pr_transport_id_len    = scsiback_get_pr_transport_id_len,
        .tpg_parse_pr_out_transport_id  = scsiback_parse_pr_out_transport_id,