aboutsummaryrefslogtreecommitdiffstats
path: root/include/target
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2015-05-26 00:33:08 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2015-06-01 03:26:38 -0400
commitadf653f92f38e80a78bb77e912d49bcc8055330f (patch)
tree374904527485a43dbc810905fa6f280cd1c2f5cf /include/target
parentb3eeea6619a0ed4f37138661c49339b21361d397 (diff)
target: Subsume se_port + t10_alua_tg_pt_gp_member into se_lun
This patch eliminates all se_port + t10_alua_tg_pt_gp_member usage, and converts current users to direct se_lun pointer dereference. This includes the removal of core_export_port(), core_release_port() core_dev_export() and core_dev_unexport(). Along with conversion of special case se_lun pointer dereference within PR ALL_TG_PT=1 and ALUA access state transition UNIT_ATTENTION handling. Also, update core_enable_device_list_for_node() to reference the new per se_lun->lun_deve_list when creating a new entry, or replacing an existing one via RCU. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'include/target')
-rw-r--r--include/target/target_core_base.h74
1 files changed, 32 insertions, 42 deletions
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index ee7abdd6b7a2..1927dd5947a7 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -304,22 +304,13 @@ struct t10_alua_tg_pt_gp {
304 struct se_device *tg_pt_gp_dev; 304 struct se_device *tg_pt_gp_dev;
305 struct config_group tg_pt_gp_group; 305 struct config_group tg_pt_gp_group;
306 struct list_head tg_pt_gp_list; 306 struct list_head tg_pt_gp_list;
307 struct list_head tg_pt_gp_mem_list; 307 struct list_head tg_pt_gp_lun_list;
308 struct se_port *tg_pt_gp_alua_port; 308 struct se_lun *tg_pt_gp_alua_lun;
309 struct se_node_acl *tg_pt_gp_alua_nacl; 309 struct se_node_acl *tg_pt_gp_alua_nacl;
310 struct delayed_work tg_pt_gp_transition_work; 310 struct delayed_work tg_pt_gp_transition_work;
311 struct completion *tg_pt_gp_transition_complete; 311 struct completion *tg_pt_gp_transition_complete;
312}; 312};
313 313
314struct t10_alua_tg_pt_gp_member {
315 bool tg_pt_gp_assoc;
316 atomic_t tg_pt_gp_mem_ref_cnt;
317 spinlock_t tg_pt_gp_mem_lock;
318 struct t10_alua_tg_pt_gp *tg_pt_gp;
319 struct se_port *tg_pt;
320 struct list_head tg_pt_gp_mem_list;
321};
322
323struct t10_vpd { 314struct t10_vpd {
324 unsigned char device_identifier[INQUIRY_VPD_DEVICE_IDENTIFIER_LEN]; 315 unsigned char device_identifier[INQUIRY_VPD_DEVICE_IDENTIFIER_LEN];
325 int protocol_identifier_set; 316 int protocol_identifier_set;
@@ -650,6 +641,7 @@ struct se_dev_entry {
650#define DEF_PR_REG_ACTIVE 1 641#define DEF_PR_REG_ACTIVE 1
651 unsigned long deve_flags; 642 unsigned long deve_flags;
652 struct list_head alua_port_list; 643 struct list_head alua_port_list;
644 struct list_head lun_link;
653 struct list_head ua_list; 645 struct list_head ua_list;
654 struct hlist_node link; 646 struct hlist_node link;
655 struct rcu_head rcu_head; 647 struct rcu_head rcu_head;
@@ -697,7 +689,14 @@ struct se_port_stat_grps {
697 struct config_group scsi_transport_group; 689 struct config_group scsi_transport_group;
698}; 690};
699 691
692struct scsi_port_stats {
693 u32 cmd_pdus;
694 u64 tx_data_octets;
695 u64 rx_data_octets;
696};
697
700struct se_lun { 698struct se_lun {
699 /* RELATIVE TARGET PORT IDENTIFER */
701 u16 lun_rtpi; 700 u16 lun_rtpi;
702#define SE_LUN_LINK_MAGIC 0xffff7771 701#define SE_LUN_LINK_MAGIC 0xffff7771
703 u32 lun_link_magic; 702 u32 lun_link_magic;
@@ -707,12 +706,30 @@ struct se_lun {
707 u32 lun_index; 706 u32 lun_index;
708 atomic_t lun_acl_count; 707 atomic_t lun_acl_count;
709 spinlock_t lun_sep_lock; 708 spinlock_t lun_sep_lock;
710 struct se_device *lun_se_dev; 709 struct se_device __rcu *lun_se_dev;
711 struct se_port *lun_sep; 710
711 struct list_head lun_deve_list;
712 spinlock_t lun_deve_lock;
713
714 /* ALUA state */
715 int lun_tg_pt_secondary_stat;
716 int lun_tg_pt_secondary_write_md;
717 atomic_t lun_tg_pt_secondary_offline;
718 struct mutex lun_tg_pt_md_mutex;
719
720 /* ALUA target port group linkage */
721 struct list_head lun_tg_pt_gp_link;
722 struct t10_alua_tg_pt_gp *lun_tg_pt_gp;
723 spinlock_t lun_tg_pt_gp_lock;
724
725 atomic_t lun_active;
726 struct se_portal_group *lun_tpg;
727 struct scsi_port_stats lun_stats;
712 struct config_group lun_group; 728 struct config_group lun_group;
713 struct se_port_stat_grps port_stat_grps; 729 struct se_port_stat_grps port_stat_grps;
714 struct completion lun_ref_comp; 730 struct completion lun_ref_comp;
715 struct percpu_ref lun_ref; 731 struct percpu_ref lun_ref;
732 struct list_head lun_dev_link;
716 struct hlist_node link; 733 struct hlist_node link;
717 struct rcu_head rcu_head; 734 struct rcu_head rcu_head;
718}; 735};
@@ -737,7 +754,6 @@ struct se_device {
737#define DF_EMULATED_VPD_UNIT_SERIAL 0x00000004 754#define DF_EMULATED_VPD_UNIT_SERIAL 0x00000004
738#define DF_USING_UDEV_PATH 0x00000008 755#define DF_USING_UDEV_PATH 0x00000008
739#define DF_USING_ALIAS 0x00000010 756#define DF_USING_ALIAS 0x00000010
740 u32 dev_port_count;
741 /* Physical device queue depth */ 757 /* Physical device queue depth */
742 u32 queue_depth; 758 u32 queue_depth;
743 /* Used for SPC-2 reservations enforce of ISIDs */ 759 /* Used for SPC-2 reservations enforce of ISIDs */
@@ -754,7 +770,7 @@ struct se_device {
754 atomic_t dev_ordered_id; 770 atomic_t dev_ordered_id;
755 atomic_t dev_ordered_sync; 771 atomic_t dev_ordered_sync;
756 atomic_t dev_qf_count; 772 atomic_t dev_qf_count;
757 int export_count; 773 u32 export_count;
758 spinlock_t delayed_cmd_lock; 774 spinlock_t delayed_cmd_lock;
759 spinlock_t execute_task_lock; 775 spinlock_t execute_task_lock;
760 spinlock_t dev_reservation_lock; 776 spinlock_t dev_reservation_lock;
@@ -821,32 +837,6 @@ struct se_hba {
821 struct target_backend *backend; 837 struct target_backend *backend;
822}; 838};
823 839
824struct scsi_port_stats {
825 u64 cmd_pdus;
826 u64 tx_data_octets;
827 u64 rx_data_octets;
828};
829
830struct se_port {
831 /* RELATIVE TARGET PORT IDENTIFER */
832 u16 sep_rtpi;
833 int sep_tg_pt_secondary_stat;
834 int sep_tg_pt_secondary_write_md;
835 u32 sep_index;
836 struct scsi_port_stats sep_stats;
837 /* Used for ALUA Target Port Groups membership */
838 atomic_t sep_tg_pt_secondary_offline;
839 /* Used for PR ALL_TG_PT=1 */
840 atomic_t sep_tg_pt_ref_cnt;
841 spinlock_t sep_alua_lock;
842 struct mutex sep_tg_pt_md_mutex;
843 struct t10_alua_tg_pt_gp_member *sep_alua_tg_pt_gp_mem;
844 struct se_lun *sep_lun;
845 struct se_portal_group *sep_tpg;
846 struct list_head sep_alua_list;
847 struct list_head sep_list;
848};
849
850struct se_tpg_np { 840struct se_tpg_np {
851 struct se_portal_group *tpg_np_parent; 841 struct se_portal_group *tpg_np_parent;
852 struct config_group tpg_np_group; 842 struct config_group tpg_np_group;
@@ -872,7 +862,7 @@ struct se_portal_group {
872 /* linked list for initiator ACL list */ 862 /* linked list for initiator ACL list */
873 struct list_head acl_node_list; 863 struct list_head acl_node_list;
874 struct hlist_head tpg_lun_hlist; 864 struct hlist_head tpg_lun_hlist;
875 struct se_lun tpg_virt_lun0; 865 struct se_lun *tpg_virt_lun0;
876 /* List of TCM sessions associated wth this TPG */ 866 /* List of TCM sessions associated wth this TPG */
877 struct list_head tpg_sess_list; 867 struct list_head tpg_sess_list;
878 /* Pointer to $FABRIC_MOD dependent code */ 868 /* Pointer to $FABRIC_MOD dependent code */