Lines Matching refs:lun
110 struct se_lun *lun; in core_tpg_add_node_to_devs() local
114 hlist_for_each_entry_rcu(lun, &tpg->tpg_lun_hlist, link) { in core_tpg_add_node_to_devs()
115 if (lun_orig && lun != lun_orig) in core_tpg_add_node_to_devs()
118 dev = rcu_dereference_check(lun->lun_se_dev, in core_tpg_add_node_to_devs()
140 tpg->se_tpg_tfo->tpg_get_tag(tpg), lun->unpacked_lun, in core_tpg_add_node_to_devs()
143 core_enable_device_list_for_node(lun, NULL, lun->unpacked_lun, in core_tpg_add_node_to_devs()
150 core_scsi3_check_aptpl_registration(dev, tpg, lun, acl, in core_tpg_add_node_to_devs()
151 lun->unpacked_lun); in core_tpg_add_node_to_devs()
438 struct se_lun *lun = container_of(ref, struct se_lun, lun_ref); in core_tpg_lun_ref_release() local
440 complete(&lun->lun_shutdown_comp); in core_tpg_lun_ref_release()
611 struct se_lun *lun; in core_tpg_alloc_lun() local
613 lun = kzalloc(sizeof(*lun), GFP_KERNEL); in core_tpg_alloc_lun()
614 if (!lun) { in core_tpg_alloc_lun()
618 lun->unpacked_lun = unpacked_lun; in core_tpg_alloc_lun()
619 atomic_set(&lun->lun_acl_count, 0); in core_tpg_alloc_lun()
620 init_completion(&lun->lun_shutdown_comp); in core_tpg_alloc_lun()
621 INIT_LIST_HEAD(&lun->lun_deve_list); in core_tpg_alloc_lun()
622 INIT_LIST_HEAD(&lun->lun_dev_link); in core_tpg_alloc_lun()
623 atomic_set(&lun->lun_tg_pt_secondary_offline, 0); in core_tpg_alloc_lun()
624 spin_lock_init(&lun->lun_deve_lock); in core_tpg_alloc_lun()
625 mutex_init(&lun->lun_tg_pt_md_mutex); in core_tpg_alloc_lun()
626 INIT_LIST_HEAD(&lun->lun_tg_pt_gp_link); in core_tpg_alloc_lun()
627 spin_lock_init(&lun->lun_tg_pt_gp_lock); in core_tpg_alloc_lun()
628 lun->lun_tpg = tpg; in core_tpg_alloc_lun()
630 return lun; in core_tpg_alloc_lun()
635 struct se_lun *lun, in core_tpg_add_lun() argument
641 ret = percpu_ref_init(&lun->lun_ref, core_tpg_lun_ref_release, 0, in core_tpg_add_lun()
648 target_attach_tg_pt_gp(lun, dev->t10_alua.default_tg_pt_gp); in core_tpg_add_lun()
653 lun->lun_index = dev->dev_index; in core_tpg_add_lun()
654 rcu_assign_pointer(lun->lun_se_dev, dev); in core_tpg_add_lun()
656 list_add_tail(&lun->lun_dev_link, &dev->dev_sep_list); in core_tpg_add_lun()
660 lun->lun_access_ro = true; in core_tpg_add_lun()
662 lun->lun_access_ro = lun_access_ro; in core_tpg_add_lun()
664 hlist_add_head_rcu(&lun->link, &tpg->tpg_lun_hlist); in core_tpg_add_lun()
675 struct se_lun *lun) in core_tpg_remove_lun() argument
681 struct se_device *dev = rcu_dereference_raw(lun->lun_se_dev); in core_tpg_remove_lun()
683 lun->lun_shutdown = true; in core_tpg_remove_lun()
685 core_clear_lun_from_tpg(lun, tpg); in core_tpg_remove_lun()
692 transport_clear_lun_ref(lun); in core_tpg_remove_lun()
695 if (lun->lun_se_dev) { in core_tpg_remove_lun()
696 target_detach_tg_pt_gp(lun); in core_tpg_remove_lun()
699 list_del(&lun->lun_dev_link); in core_tpg_remove_lun()
701 rcu_assign_pointer(lun->lun_se_dev, NULL); in core_tpg_remove_lun()
705 hlist_del_rcu(&lun->link); in core_tpg_remove_lun()
707 lun->lun_shutdown = false; in core_tpg_remove_lun()
710 percpu_ref_exit(&lun->lun_ref); in core_tpg_remove_lun()