target/iscsi: stop using se_tpg_fabric_ptr
authorChristoph Hellwig <hch@lst.de>
Fri, 1 May 2015 15:47:53 +0000 (17:47 +0200)
committerNicholas Bellinger <nab@linux-iscsi.org>
Sun, 31 May 2015 05:42:25 +0000 (22:42 -0700)
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
drivers/target/iscsi/iscsi_target_configfs.c

index 643024c1ee8dce8470f9b643cc9634e7808a750a..03b2e15c1b6c7d6644fdaa01b1d657013608c6b3 100644 (file)
@@ -1789,69 +1789,58 @@ static void lio_aborted_task(struct se_cmd *se_cmd)
        cmd->conn->conn_transport->iscsit_aborted_task(cmd->conn, cmd);
 }
 
-static char *lio_tpg_get_endpoint_wwn(struct se_portal_group *se_tpg)
+static inline struct iscsi_portal_group *iscsi_tpg(struct se_portal_group *se_tpg)
 {
-       struct iscsi_portal_group *tpg = se_tpg->se_tpg_fabric_ptr;
+       return container_of(se_tpg, struct iscsi_portal_group, tpg_se_tpg);
+}
 
-       return &tpg->tpg_tiqn->tiqn[0];
+static char *lio_tpg_get_endpoint_wwn(struct se_portal_group *se_tpg)
+{
+       return iscsi_tpg(se_tpg)->tpg_tiqn->tiqn;
 }
 
 static u16 lio_tpg_get_tag(struct se_portal_group *se_tpg)
 {
-       struct iscsi_portal_group *tpg = se_tpg->se_tpg_fabric_ptr;
-
-       return tpg->tpgt;
+       return iscsi_tpg(se_tpg)->tpgt;
 }
 
 static u32 lio_tpg_get_default_depth(struct se_portal_group *se_tpg)
 {
-       struct iscsi_portal_group *tpg = se_tpg->se_tpg_fabric_ptr;
-
-       return tpg->tpg_attrib.default_cmdsn_depth;
+       return iscsi_tpg(se_tpg)->tpg_attrib.default_cmdsn_depth;
 }
 
 static int lio_tpg_check_demo_mode(struct se_portal_group *se_tpg)
 {
-       struct iscsi_portal_group *tpg = se_tpg->se_tpg_fabric_ptr;
-
-       return tpg->tpg_attrib.generate_node_acls;
+       return iscsi_tpg(se_tpg)->tpg_attrib.generate_node_acls;
 }
 
 static int lio_tpg_check_demo_mode_cache(struct se_portal_group *se_tpg)
 {
-       struct iscsi_portal_group *tpg = se_tpg->se_tpg_fabric_ptr;
-
-       return tpg->tpg_attrib.cache_dynamic_acls;
+       return iscsi_tpg(se_tpg)->tpg_attrib.cache_dynamic_acls;
 }
 
 static int lio_tpg_check_demo_mode_write_protect(
        struct se_portal_group *se_tpg)
 {
-       struct iscsi_portal_group *tpg = se_tpg->se_tpg_fabric_ptr;
-
-       return tpg->tpg_attrib.demo_mode_write_protect;
+       return iscsi_tpg(se_tpg)->tpg_attrib.demo_mode_write_protect;
 }
 
 static int lio_tpg_check_prod_mode_write_protect(
        struct se_portal_group *se_tpg)
 {
-       struct iscsi_portal_group *tpg = se_tpg->se_tpg_fabric_ptr;
-
-       return tpg->tpg_attrib.prod_mode_write_protect;
+       return iscsi_tpg(se_tpg)->tpg_attrib.prod_mode_write_protect;
 }
 
 static int lio_tpg_check_prot_fabric_only(
        struct se_portal_group *se_tpg)
 {
-       struct iscsi_portal_group *tpg = se_tpg->se_tpg_fabric_ptr;
        /*
         * Only report fabric_prot_type if t10_pi has also been enabled
         * for incoming ib_isert sessions.
         */
-       if (!tpg->tpg_attrib.t10_pi)
+       if (!iscsi_tpg(se_tpg)->tpg_attrib.t10_pi)
                return 0;
-
-       return tpg->tpg_attrib.fabric_prot_type;
+       return iscsi_tpg(se_tpg)->tpg_attrib.fabric_prot_type;
 }
 
 /*
@@ -1896,9 +1885,7 @@ static void lio_tpg_close_session(struct se_session *se_sess)
 
 static u32 lio_tpg_get_inst_index(struct se_portal_group *se_tpg)
 {
-       struct iscsi_portal_group *tpg = se_tpg->se_tpg_fabric_ptr;
-
-       return tpg->tpg_tiqn->tiqn_index;
+       return iscsi_tpg(se_tpg)->tpg_tiqn->tiqn_index;
 }
 
 static void lio_set_default_node_attributes(struct se_node_acl *se_acl)