diff options
| author | Christoph Hellwig <hch@infradead.org> | 2012-10-08 00:03:19 -0400 |
|---|---|---|
| committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2012-11-06 23:55:43 -0500 |
| commit | 0fd97ccf45be26fb01b3a412f1f6c6b5044b2f16 (patch) | |
| tree | c642e3da11e534a311a1e998ef740a3d44b9187b | |
| parent | 3d70f8c617a436c7146ecb81df2265b4626dfe89 (diff) | |
target: kill struct se_subsystem_dev
Simplify the code a lot by killing the superflous struct se_subsystem_dev.
Instead se_device is allocated early on by the backend driver, which allocates
it as part of its own per-device structure, borrowing the scheme that is for
example used for inode allocation.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
26 files changed, 1049 insertions, 1909 deletions
diff --git a/drivers/target/loopback/tcm_loop.h b/drivers/target/loopback/tcm_loop.h index 7b54893db665..dd7a84ee78e1 100644 --- a/drivers/target/loopback/tcm_loop.h +++ b/drivers/target/loopback/tcm_loop.h | |||
| @@ -53,7 +53,6 @@ struct tcm_loop_hba { | |||
| 53 | struct se_hba_s *se_hba; | 53 | struct se_hba_s *se_hba; |
| 54 | struct se_lun *tl_hba_lun; | 54 | struct se_lun *tl_hba_lun; |
| 55 | struct se_port *tl_hba_lun_sep; | 55 | struct se_port *tl_hba_lun_sep; |
| 56 | struct se_device_s *se_dev_hba_ptr; | ||
| 57 | struct tcm_loop_nexus *tl_nexus; | 56 | struct tcm_loop_nexus *tl_nexus; |
| 58 | struct device dev; | 57 | struct device dev; |
| 59 | struct Scsi_Host *sh; | 58 | struct Scsi_Host *sh; |
diff --git a/drivers/target/target_core_alua.c b/drivers/target/target_core_alua.c index 9a5f9a7aecd2..15c127b780d8 100644 --- a/drivers/target/target_core_alua.c +++ b/drivers/target/target_core_alua.c | |||
| @@ -61,7 +61,7 @@ struct t10_alua_lu_gp *default_lu_gp; | |||
| 61 | */ | 61 | */ |
| 62 | int target_emulate_report_target_port_groups(struct se_cmd *cmd) | 62 | int target_emulate_report_target_port_groups(struct se_cmd *cmd) |
| 63 | { | 63 | { |
| 64 | struct se_subsystem_dev *su_dev = cmd->se_dev->se_sub_dev; | 64 | struct se_device *dev = cmd->se_dev; |
| 65 | struct se_port *port; | 65 | struct se_port *port; |
| 66 | struct t10_alua_tg_pt_gp *tg_pt_gp; | 66 | struct t10_alua_tg_pt_gp *tg_pt_gp; |
| 67 | struct t10_alua_tg_pt_gp_member *tg_pt_gp_mem; | 67 | struct t10_alua_tg_pt_gp_member *tg_pt_gp_mem; |
| @@ -86,8 +86,8 @@ int target_emulate_report_target_port_groups(struct se_cmd *cmd) | |||
| 86 | } | 86 | } |
| 87 | buf = transport_kmap_data_sg(cmd); | 87 | buf = transport_kmap_data_sg(cmd); |
| 88 | 88 | ||
| 89 | spin_lock(&su_dev->t10_alua.tg_pt_gps_lock); | 89 | spin_lock(&dev->t10_alua.tg_pt_gps_lock); |
| 90 | list_for_each_entry(tg_pt_gp, &su_dev->t10_alua.tg_pt_gps_list, | 90 | list_for_each_entry(tg_pt_gp, &dev->t10_alua.tg_pt_gps_list, |
| 91 | tg_pt_gp_list) { | 91 | tg_pt_gp_list) { |
| 92 | /* | 92 | /* |
| 93 | * Check if the Target port group and Target port descriptor list | 93 | * Check if the Target port group and Target port descriptor list |
| @@ -160,7 +160,7 @@ int target_emulate_report_target_port_groups(struct se_cmd *cmd) | |||
| 160 | } | 160 | } |
| 161 | spin_unlock(&tg_pt_gp->tg_pt_gp_lock); | 161 | spin_unlock(&tg_pt_gp->tg_pt_gp_lock); |
| 162 | } | 162 | } |
| 163 | spin_unlock(&su_dev->t10_alua.tg_pt_gps_lock); | 163 | spin_unlock(&dev->t10_alua.tg_pt_gps_lock); |
| 164 | /* | 164 | /* |
| 165 | * Set the RETURN DATA LENGTH set in the header of the DataIN Payload | 165 | * Set the RETURN DATA LENGTH set in the header of the DataIN Payload |
| 166 | */ | 166 | */ |
| @@ -203,7 +203,6 @@ int target_emulate_report_target_port_groups(struct se_cmd *cmd) | |||
| 203 | int target_emulate_set_target_port_groups(struct se_cmd *cmd) | 203 | int target_emulate_set_target_port_groups(struct se_cmd *cmd) |
| 204 | { | 204 | { |
| 205 | struct se_device *dev = cmd->se_dev; | 205 | struct se_device *dev = cmd->se_dev; |
| 206 | struct se_subsystem_dev *su_dev = dev->se_sub_dev; | ||
| 207 | struct se_port *port, *l_port = cmd->se_lun->lun_sep; | 206 | struct se_port *port, *l_port = cmd->se_lun->lun_sep; |
| 208 | struct se_node_acl *nacl = cmd->se_sess->se_node_acl; | 207 | struct se_node_acl *nacl = cmd->se_sess->se_node_acl; |
| 209 | struct t10_alua_tg_pt_gp *tg_pt_gp = NULL, *l_tg_pt_gp; | 208 | struct t10_alua_tg_pt_gp *tg_pt_gp = NULL, *l_tg_pt_gp; |
| @@ -303,9 +302,9 @@ int target_emulate_set_target_port_groups(struct se_cmd *cmd) | |||
| 303 | * Locate the matching target port group ID from | 302 | * Locate the matching target port group ID from |
| 304 | * the global tg_pt_gp list | 303 | * the global tg_pt_gp list |
| 305 | */ | 304 | */ |
| 306 | spin_lock(&su_dev->t10_alua.tg_pt_gps_lock); | 305 | spin_lock(&dev->t10_alua.tg_pt_gps_lock); |
| 307 | list_for_each_entry(tg_pt_gp, | 306 | list_for_each_entry(tg_pt_gp, |
| 308 | &su_dev->t10_alua.tg_pt_gps_list, | 307 | &dev->t10_alua.tg_pt_gps_list, |
| 309 | tg_pt_gp_list) { | 308 | tg_pt_gp_list) { |
| 310 | if (!tg_pt_gp->tg_pt_gp_valid_id) | 309 | if (!tg_pt_gp->tg_pt_gp_valid_id) |
| 311 | continue; | 310 | continue; |
| @@ -315,18 +314,18 @@ int target_emulate_set_target_port_groups(struct se_cmd *cmd) | |||
| 315 | 314 | ||
| 316 | atomic_inc(&tg_pt_gp->tg_pt_gp_ref_cnt); | 315 | atomic_inc(&tg_pt_gp->tg_pt_gp_ref_cnt); |
| 317 | smp_mb__after_atomic_inc(); | 316 | smp_mb__after_atomic_inc(); |
| 318 | spin_unlock(&su_dev->t10_alua.tg_pt_gps_lock); | 317 | spin_unlock(&dev->t10_alua.tg_pt_gps_lock); |
| 319 | 318 | ||
| 320 | rc = core_alua_do_port_transition(tg_pt_gp, | 319 | rc = core_alua_do_port_transition(tg_pt_gp, |
| 321 | dev, l_port, nacl, | 320 | dev, l_port, nacl, |
| 322 | alua_access_state, 1); | 321 | alua_access_state, 1); |
| 323 | 322 | ||
| 324 | spin_lock(&su_dev->t10_alua.tg_pt_gps_lock); | 323 | spin_lock(&dev->t10_alua.tg_pt_gps_lock); |
| 325 | atomic_dec(&tg_pt_gp->tg_pt_gp_ref_cnt); | 324 | atomic_dec(&tg_pt_gp->tg_pt_gp_ref_cnt); |
| 326 | smp_mb__after_atomic_dec(); | 325 | smp_mb__after_atomic_dec(); |
| 327 | break; | 326 | break; |
| 328 | } | 327 | } |
| 329 | spin_unlock(&su_dev->t10_alua.tg_pt_gps_lock); | 328 | spin_unlock(&dev->t10_alua.tg_pt_gps_lock); |
| 330 | /* | 329 | /* |
| 331 | * If not matching target port group ID can be located | 330 | * If not matching target port group ID can be located |
| 332 | * throw an exception with ASCQ: INVALID_PARAMETER_LIST | 331 | * throw an exception with ASCQ: INVALID_PARAMETER_LIST |
| @@ -758,8 +757,7 @@ static int core_alua_update_tpg_primary_metadata( | |||
| 758 | int primary_state, | 757 | int primary_state, |
| 759 | unsigned char *md_buf) | 758 | unsigned char *md_buf) |
| 760 | { | 759 | { |
| 761 | struct se_subsystem_dev *su_dev = tg_pt_gp->tg_pt_gp_su_dev; | 760 | struct t10_wwn *wwn = &tg_pt_gp->tg_pt_gp_dev->t10_wwn; |
| 762 | struct t10_wwn *wwn = &su_dev->t10_wwn; | ||
| 763 | char path[ALUA_METADATA_PATH_LEN]; | 761 | char path[ALUA_METADATA_PATH_LEN]; |
| 764 | int len; | 762 | int len; |
| 765 | 763 | ||
| @@ -899,7 +897,6 @@ int core_alua_do_port_transition( | |||
| 899 | { | 897 | { |
| 900 | struct se_device *dev; | 898 | struct se_device *dev; |
| 901 | struct se_port *port; | 899 | struct se_port *port; |
| 902 | struct se_subsystem_dev *su_dev; | ||
| 903 | struct se_node_acl *nacl; | 900 | struct se_node_acl *nacl; |
| 904 | struct t10_alua_lu_gp *lu_gp; | 901 | struct t10_alua_lu_gp *lu_gp; |
| 905 | struct t10_alua_lu_gp_member *lu_gp_mem, *local_lu_gp_mem; | 902 | struct t10_alua_lu_gp_member *lu_gp_mem, *local_lu_gp_mem; |
| @@ -949,14 +946,13 @@ int core_alua_do_port_transition( | |||
| 949 | lu_gp_mem_list) { | 946 | lu_gp_mem_list) { |
| 950 | 947 | ||
| 951 | dev = lu_gp_mem->lu_gp_mem_dev; | 948 | dev = lu_gp_mem->lu_gp_mem_dev; |
| 952 | su_dev = dev->se_sub_dev; | ||
| 953 | atomic_inc(&lu_gp_mem->lu_gp_mem_ref_cnt); | 949 | atomic_inc(&lu_gp_mem->lu_gp_mem_ref_cnt); |
| 954 | smp_mb__after_atomic_inc(); | 950 | smp_mb__after_atomic_inc(); |
| 955 | spin_unlock(&lu_gp->lu_gp_lock); | 951 | spin_unlock(&lu_gp->lu_gp_lock); |
| 956 | 952 | ||
| 957 | spin_lock(&su_dev->t10_alua.tg_pt_gps_lock); | 953 | spin_lock(&dev->t10_alua.tg_pt_gps_lock); |
| 958 | list_for_each_entry(tg_pt_gp, | ||
