Lines Matching refs:lun

35 		struct se_lun *lun, int explicit, int offline);
39 static void __target_attach_tg_pt_gp(struct se_lun *lun,
140 struct se_lun *lun;
217 list_for_each_entry(lun, &tg_pt_gp->tg_pt_gp_lun_list,
228 put_unaligned_be16(lun->lun_tpg->tpg_rtpi, &buf[off]);
387 struct se_lun *lun;
400 list_for_each_entry(lun, &dev->dev_sep_list,
402 if (lun->lun_tpg->tpg_rtpi != rtpi)
409 lun, 1, 1))
648 struct se_lun *lun = cmd->se_lun;
663 if (atomic_read(&lun->lun_tg_pt_secondary_offline)) {
669 tg_pt_gp = rcu_dereference(lun->lun_tg_pt_gp);
913 struct se_lun *lun;
917 list_for_each_entry(lun, &tg_pt_gp->tg_pt_gp_lun_list,
933 if (!percpu_ref_tryget_live(&lun->lun_ref))
937 spin_lock(&lun->lun_deve_lock);
938 list_for_each_entry(se_deve, &lun->lun_deve_list, lun_link) {
954 (tg_pt_gp->tg_pt_gp_alua_lun == lun))
968 spin_unlock(&lun->lun_deve_lock);
971 percpu_ref_put(&lun->lun_ref);
1168 static int core_alua_update_tpg_secondary_metadata(struct se_lun *lun)
1170 struct se_portal_group *se_tpg = lun->lun_tpg;
1175 mutex_lock(&lun->lun_tg_pt_md_mutex);
1186 atomic_read(&lun->lun_tg_pt_secondary_offline),
1187 lun->lun_tg_pt_secondary_stat);
1194 lun->unpacked_lun);
1199 lun->unpacked_lun);
1211 mutex_unlock(&lun->lun_tg_pt_md_mutex);
1216 struct se_lun *lun,
1224 tg_pt_gp = rcu_dereference(lun->lun_tg_pt_gp);
1237 atomic_set(&lun->lun_tg_pt_secondary_offline, 1);
1239 atomic_set(&lun->lun_tg_pt_secondary_offline, 0);
1241 lun->lun_tg_pt_secondary_stat = (explicit) ?
1261 if (lun->lun_tg_pt_secondary_write_md)
1262 core_alua_update_tpg_secondary_metadata(lun);
1711 struct se_lun *lun, *next;
1742 list_for_each_entry_safe(lun, next,
1744 list_del_init(&lun->lun_tg_pt_gp_link);
1753 spin_lock(&lun->lun_tg_pt_gp_lock);
1755 __target_attach_tg_pt_gp(lun,
1758 rcu_assign_pointer(lun->lun_tg_pt_gp, NULL);
1759 spin_unlock(&lun->lun_tg_pt_gp_lock);
1802 static void __target_attach_tg_pt_gp(struct se_lun *lun,
1807 assert_spin_locked(&lun->lun_tg_pt_gp_lock);
1810 rcu_assign_pointer(lun->lun_tg_pt_gp, tg_pt_gp);
1811 list_add_tail(&lun->lun_tg_pt_gp_link, &tg_pt_gp->tg_pt_gp_lun_list);
1813 spin_lock(&lun->lun_deve_lock);
1814 list_for_each_entry(se_deve, &lun->lun_deve_list, lun_link)
1817 spin_unlock(&lun->lun_deve_lock);
1821 void target_attach_tg_pt_gp(struct se_lun *lun,
1824 spin_lock(&lun->lun_tg_pt_gp_lock);
1825 __target_attach_tg_pt_gp(lun, tg_pt_gp);
1826 spin_unlock(&lun->lun_tg_pt_gp_lock);
1830 static void __target_detach_tg_pt_gp(struct se_lun *lun,
1833 assert_spin_locked(&lun->lun_tg_pt_gp_lock);
1836 list_del_init(&lun->lun_tg_pt_gp_link);
1841 void target_detach_tg_pt_gp(struct se_lun *lun)
1845 spin_lock(&lun->lun_tg_pt_gp_lock);
1846 tg_pt_gp = rcu_dereference_check(lun->lun_tg_pt_gp,
1847 lockdep_is_held(&lun->lun_tg_pt_gp_lock));
1849 __target_detach_tg_pt_gp(lun, tg_pt_gp);
1850 rcu_assign_pointer(lun->lun_tg_pt_gp, NULL);
1852 spin_unlock(&lun->lun_tg_pt_gp_lock);
1856 static void target_swap_tg_pt_gp(struct se_lun *lun,
1860 assert_spin_locked(&lun->lun_tg_pt_gp_lock);
1863 __target_detach_tg_pt_gp(lun, old_tg_pt_gp);
1864 __target_attach_tg_pt_gp(lun, new_tg_pt_gp);
1867 ssize_t core_alua_show_tg_pt_gp_info(struct se_lun *lun, char *page)
1874 tg_pt_gp = rcu_dereference(lun->lun_tg_pt_gp);
1886 atomic_read(&lun->lun_tg_pt_secondary_offline) ?
1888 core_alua_dump_status(lun->lun_tg_pt_secondary_stat));
1896 struct se_lun *lun,
1900 struct se_portal_group *tpg = lun->lun_tpg;
1905 struct se_device *dev = rcu_dereference_raw(lun->lun_se_dev);
1936 spin_lock(&lun->lun_tg_pt_gp_lock);
1937 tg_pt_gp = rcu_dereference_check(lun->lun_tg_pt_gp,
1938 lockdep_is_held(&lun->lun_tg_pt_gp_lock));
1951 config_item_name(&lun->lun_group.cg_item),
1956 target_swap_tg_pt_gp(lun, tg_pt_gp,
1958 spin_unlock(&lun->lun_tg_pt_gp_lock);
1965 target_swap_tg_pt_gp(lun, tg_pt_gp, tg_pt_gp_new);
1966 spin_unlock(&lun->lun_tg_pt_gp_lock);
1971 config_item_name(&lun->lun_group.cg_item),
2149 ssize_t core_alua_show_offline_bit(struct se_lun *lun, char *page)
2152 atomic_read(&lun->lun_tg_pt_secondary_offline));
2156 struct se_lun *lun,
2164 struct se_device *dev = rcu_dereference_raw(lun->lun_se_dev);
2183 ret = core_alua_set_tg_pt_secondary_state(lun, 0, (int)tmp);
2191 struct se_lun *lun,
2194 return sprintf(page, "%d\n", lun->lun_tg_pt_secondary_stat);
2198 struct se_lun *lun,
2217 lun->lun_tg_pt_secondary_stat = (int)tmp;
2223 struct se_lun *lun,
2226 return sprintf(page, "%d\n", lun->lun_tg_pt_secondary_write_md);
2230 struct se_lun *lun,
2247 lun->lun_tg_pt_secondary_write_md = (int)tmp;