Lines Matching refs:pr_reg
57 struct t10_pr_registration *pr_reg, in core_pr_dump_initiator_port() argument
61 if (!pr_reg->isid_present_at_reg) { in core_pr_dump_initiator_port()
66 snprintf(buf, size, ",i,0x%s", pr_reg->pr_reg_isid); in core_pr_dump_initiator_port()
120 struct t10_pr_registration *pr_reg; in target_check_scsi2_reservation_conflict() local
124 pr_reg = core_scsi3_locate_pr_reg(cmd->se_dev, se_sess->se_node_acl, in target_check_scsi2_reservation_conflict()
126 if (pr_reg) { in target_check_scsi2_reservation_conflict()
148 if (pr_reg->pr_res_holder) { in target_check_scsi2_reservation_conflict()
149 core_scsi3_put_pr_reg(pr_reg); in target_check_scsi2_reservation_conflict()
152 if ((pr_reg->pr_res_type == PR_TYPE_WRITE_EXCLUSIVE_REGONLY) || in target_check_scsi2_reservation_conflict()
153 (pr_reg->pr_res_type == PR_TYPE_EXCLUSIVE_ACCESS_REGONLY) || in target_check_scsi2_reservation_conflict()
154 (pr_reg->pr_res_type == PR_TYPE_WRITE_EXCLUSIVE_ALLREG) || in target_check_scsi2_reservation_conflict()
155 (pr_reg->pr_res_type == PR_TYPE_EXCLUSIVE_ACCESS_ALLREG)) { in target_check_scsi2_reservation_conflict()
156 core_scsi3_put_pr_reg(pr_reg); in target_check_scsi2_reservation_conflict()
159 core_scsi3_put_pr_reg(pr_reg); in target_check_scsi2_reservation_conflict()
603 struct t10_pr_registration *pr_reg; in __core_scsi3_do_alloc_registration() local
605 pr_reg = kmem_cache_zalloc(t10_pr_reg_cache, GFP_ATOMIC); in __core_scsi3_do_alloc_registration()
606 if (!pr_reg) { in __core_scsi3_do_alloc_registration()
611 INIT_LIST_HEAD(&pr_reg->pr_reg_list); in __core_scsi3_do_alloc_registration()
612 INIT_LIST_HEAD(&pr_reg->pr_reg_abort_list); in __core_scsi3_do_alloc_registration()
613 INIT_LIST_HEAD(&pr_reg->pr_reg_aptpl_list); in __core_scsi3_do_alloc_registration()
614 INIT_LIST_HEAD(&pr_reg->pr_reg_atp_list); in __core_scsi3_do_alloc_registration()
615 INIT_LIST_HEAD(&pr_reg->pr_reg_atp_mem_list); in __core_scsi3_do_alloc_registration()
616 atomic_set(&pr_reg->pr_res_holders, 0); in __core_scsi3_do_alloc_registration()
617 pr_reg->pr_reg_nacl = nacl; in __core_scsi3_do_alloc_registration()
618 pr_reg->pr_reg_deve = deve; in __core_scsi3_do_alloc_registration()
619 pr_reg->pr_res_mapped_lun = deve->mapped_lun; in __core_scsi3_do_alloc_registration()
620 pr_reg->pr_aptpl_target_lun = deve->se_lun->unpacked_lun; in __core_scsi3_do_alloc_registration()
621 pr_reg->pr_res_key = sa_res_key; in __core_scsi3_do_alloc_registration()
622 pr_reg->pr_reg_all_tg_pt = all_tg_pt; in __core_scsi3_do_alloc_registration()
623 pr_reg->pr_reg_aptpl = aptpl; in __core_scsi3_do_alloc_registration()
624 pr_reg->pr_reg_tg_pt_lun = deve->se_lun; in __core_scsi3_do_alloc_registration()
630 pr_reg->pr_reg_bin_isid = get_unaligned_be64(isid); in __core_scsi3_do_alloc_registration()
631 snprintf(pr_reg->pr_reg_isid, PR_REG_ISID_LEN, "%s", isid); in __core_scsi3_do_alloc_registration()
632 pr_reg->isid_present_at_reg = 1; in __core_scsi3_do_alloc_registration()
635 return pr_reg; in __core_scsi3_do_alloc_registration()
658 struct t10_pr_registration *pr_reg, *pr_reg_atp, *pr_reg_tmp, *pr_reg_tmp_safe; in __core_scsi3_alloc_registration() local
664 pr_reg = __core_scsi3_do_alloc_registration(dev, nacl, deve, isid, in __core_scsi3_alloc_registration()
666 if (!pr_reg) in __core_scsi3_alloc_registration()
672 return pr_reg; in __core_scsi3_alloc_registration()
747 &pr_reg->pr_reg_atp_list); in __core_scsi3_alloc_registration()
757 return pr_reg; in __core_scsi3_alloc_registration()
760 &pr_reg->pr_reg_atp_list, pr_reg_atp_mem_list) { in __core_scsi3_alloc_registration()
765 kmem_cache_free(t10_pr_reg_cache, pr_reg); in __core_scsi3_alloc_registration()
782 struct t10_pr_registration *pr_reg; in core_scsi3_alloc_aptpl_registration() local
789 pr_reg = kmem_cache_zalloc(t10_pr_reg_cache, GFP_KERNEL); in core_scsi3_alloc_aptpl_registration()
790 if (!pr_reg) { in core_scsi3_alloc_aptpl_registration()
795 INIT_LIST_HEAD(&pr_reg->pr_reg_list); in core_scsi3_alloc_aptpl_registration()
796 INIT_LIST_HEAD(&pr_reg->pr_reg_abort_list); in core_scsi3_alloc_aptpl_registration()
797 INIT_LIST_HEAD(&pr_reg->pr_reg_aptpl_list); in core_scsi3_alloc_aptpl_registration()
798 INIT_LIST_HEAD(&pr_reg->pr_reg_atp_list); in core_scsi3_alloc_aptpl_registration()
799 INIT_LIST_HEAD(&pr_reg->pr_reg_atp_mem_list); in core_scsi3_alloc_aptpl_registration()
800 atomic_set(&pr_reg->pr_res_holders, 0); in core_scsi3_alloc_aptpl_registration()
801 pr_reg->pr_reg_nacl = NULL; in core_scsi3_alloc_aptpl_registration()
802 pr_reg->pr_reg_deve = NULL; in core_scsi3_alloc_aptpl_registration()
803 pr_reg->pr_res_mapped_lun = mapped_lun; in core_scsi3_alloc_aptpl_registration()
804 pr_reg->pr_aptpl_target_lun = target_lun; in core_scsi3_alloc_aptpl_registration()
805 pr_reg->pr_res_key = sa_res_key; in core_scsi3_alloc_aptpl_registration()
806 pr_reg->pr_reg_all_tg_pt = all_tg_pt; in core_scsi3_alloc_aptpl_registration()
807 pr_reg->pr_reg_aptpl = 1; in core_scsi3_alloc_aptpl_registration()
808 pr_reg->pr_reg_tg_pt_lun = NULL; in core_scsi3_alloc_aptpl_registration()
809 pr_reg->pr_res_scope = 0; /* Always LUN_SCOPE */ in core_scsi3_alloc_aptpl_registration()
810 pr_reg->pr_res_type = type; in core_scsi3_alloc_aptpl_registration()
816 pr_reg->pr_reg_bin_isid = get_unaligned_be64(isid); in core_scsi3_alloc_aptpl_registration()
817 snprintf(pr_reg->pr_reg_isid, PR_REG_ISID_LEN, "%s", isid); in core_scsi3_alloc_aptpl_registration()
818 pr_reg->isid_present_at_reg = 1; in core_scsi3_alloc_aptpl_registration()
823 snprintf(pr_reg->pr_iport, PR_APTPL_MAX_IPORT_LEN, "%s", i_port); in core_scsi3_alloc_aptpl_registration()
824 snprintf(pr_reg->pr_tport, PR_APTPL_MAX_TPORT_LEN, "%s", t_port); in core_scsi3_alloc_aptpl_registration()
825 pr_reg->pr_reg_tpgt = tpgt; in core_scsi3_alloc_aptpl_registration()
832 pr_reg->pr_res_holder = res_holder; in core_scsi3_alloc_aptpl_registration()
834 list_add_tail(&pr_reg->pr_reg_aptpl_list, &pr_tmpl->aptpl_reg_list); in core_scsi3_alloc_aptpl_registration()
844 struct t10_pr_registration *pr_reg) in core_scsi3_aptpl_reserve() argument
849 core_pr_dump_initiator_port(pr_reg, i_buf, PR_REG_ISID_ID_LEN); in core_scsi3_aptpl_reserve()
852 dev->dev_pr_res_holder = pr_reg; in core_scsi3_aptpl_reserve()
858 core_scsi3_pr_dump_type(pr_reg->pr_res_type), in core_scsi3_aptpl_reserve()
859 (pr_reg->pr_reg_all_tg_pt) ? 1 : 0); in core_scsi3_aptpl_reserve()
876 struct t10_pr_registration *pr_reg, *pr_reg_tmp; in __core_scsi3_check_aptpl_registration() local
898 list_for_each_entry_safe(pr_reg, pr_reg_tmp, &pr_tmpl->aptpl_reg_list, in __core_scsi3_check_aptpl_registration()
901 if (!strcmp(pr_reg->pr_iport, i_port) && in __core_scsi3_check_aptpl_registration()
902 (pr_reg->pr_res_mapped_lun == deve->mapped_lun) && in __core_scsi3_check_aptpl_registration()
903 !(strcmp(pr_reg->pr_tport, t_port)) && in __core_scsi3_check_aptpl_registration()
904 (pr_reg->pr_reg_tpgt == tpgt) && in __core_scsi3_check_aptpl_registration()
905 (pr_reg->pr_aptpl_target_lun == target_lun)) { in __core_scsi3_check_aptpl_registration()
907 pr_reg->pr_reg_nacl = nacl; in __core_scsi3_check_aptpl_registration()
908 pr_reg->pr_reg_deve = deve; in __core_scsi3_check_aptpl_registration()
909 pr_reg->pr_reg_tg_pt_lun = lun; in __core_scsi3_check_aptpl_registration()
911 list_del(&pr_reg->pr_reg_aptpl_list); in __core_scsi3_check_aptpl_registration()
918 __core_scsi3_add_registration(dev, nacl, pr_reg, 0, 0); in __core_scsi3_check_aptpl_registration()
923 if (pr_reg->pr_res_holder) in __core_scsi3_check_aptpl_registration()
925 nacl, pr_reg); in __core_scsi3_check_aptpl_registration()
959 struct t10_pr_registration *pr_reg, in __core_scsi3_dump_registration() argument
966 core_pr_dump_initiator_port(pr_reg, i_buf, PR_REG_ISID_ID_LEN); in __core_scsi3_dump_registration()
978 (pr_reg->pr_reg_all_tg_pt) ? "ALL" : "SINGLE", in __core_scsi3_dump_registration()
982 pr_reg->pr_res_key, pr_reg->pr_res_generation, in __core_scsi3_dump_registration()
983 pr_reg->pr_reg_aptpl); in __core_scsi3_dump_registration()
993 struct t10_pr_registration *pr_reg, in __core_scsi3_add_registration() argument
1010 pr_reg->pr_res_generation = (register_move) ? in __core_scsi3_add_registration()
1015 list_add_tail(&pr_reg->pr_reg_list, &pr_tmpl->registration_list); in __core_scsi3_add_registration()
1016 pr_reg->pr_reg_deve->def_pr_registered = 1; in __core_scsi3_add_registration()
1018 __core_scsi3_dump_registration(tfo, dev, nacl, pr_reg, register_type); in __core_scsi3_add_registration()
1023 if (!pr_reg->pr_reg_all_tg_pt || register_move) in __core_scsi3_add_registration()
1030 &pr_reg->pr_reg_atp_list, pr_reg_atp_mem_list) { in __core_scsi3_add_registration()
1063 struct t10_pr_registration *pr_reg; in core_scsi3_alloc_registration() local
1065 pr_reg = __core_scsi3_alloc_registration(dev, nacl, deve, isid, in core_scsi3_alloc_registration()
1067 if (!pr_reg) in core_scsi3_alloc_registration()
1070 __core_scsi3_add_registration(dev, nacl, pr_reg, in core_scsi3_alloc_registration()
1081 struct t10_pr_registration *pr_reg, *pr_reg_tmp; in __core_scsi3_locate_pr_reg() local
1085 list_for_each_entry_safe(pr_reg, pr_reg_tmp, in __core_scsi3_locate_pr_reg()
1090 if (pr_reg->pr_reg_nacl != nacl) in __core_scsi3_locate_pr_reg()
1093 tpg = pr_reg->pr_reg_nacl->se_tpg; in __core_scsi3_locate_pr_reg()
1098 if (!pr_reg->isid_present_at_reg) { in __core_scsi3_locate_pr_reg()
1108 atomic_inc_mb(&pr_reg->pr_res_holders); in __core_scsi3_locate_pr_reg()
1110 return pr_reg; in __core_scsi3_locate_pr_reg()
1119 if (strcmp(isid, pr_reg->pr_reg_isid)) in __core_scsi3_locate_pr_reg()
1122 atomic_inc_mb(&pr_reg->pr_res_holders); in __core_scsi3_locate_pr_reg()
1124 return pr_reg; in __core_scsi3_locate_pr_reg()
1149 static void core_scsi3_put_pr_reg(struct t10_pr_registration *pr_reg) in core_scsi3_put_pr_reg() argument
1151 atomic_dec_mb(&pr_reg->pr_res_holders); in core_scsi3_put_pr_reg()
1156 struct t10_pr_registration *pr_reg) in core_scsi3_check_implicit_release() argument
1158 struct se_node_acl *nacl = pr_reg->pr_reg_nacl; in core_scsi3_check_implicit_release()
1168 if (pr_res_holder == pr_reg) { in core_scsi3_check_implicit_release()
1182 __core_scsi3_complete_pro_release(dev, nacl, pr_reg, 0); in core_scsi3_check_implicit_release()
1190 } else if (pr_reg->pr_reg_all_tg_pt && in core_scsi3_check_implicit_release()
1192 pr_reg->pr_reg_nacl->initiatorname)) && in core_scsi3_check_implicit_release()
1193 (pr_res_holder->pr_res_key == pr_reg->pr_res_key)) { in core_scsi3_check_implicit_release()
1197 " Port\n", pr_reg->pr_res_key); in core_scsi3_check_implicit_release()
1210 struct t10_pr_registration *pr_reg, in __core_scsi3_free_registration() argument
1215 pr_reg->pr_reg_nacl->se_tpg->se_tpg_tfo; in __core_scsi3_free_registration()
1220 core_pr_dump_initiator_port(pr_reg, i_buf, PR_REG_ISID_ID_LEN); in __core_scsi3_free_registration()
1222 pr_reg->pr_reg_deve->def_pr_registered = 0; in __core_scsi3_free_registration()
1223 pr_reg->pr_reg_deve->pr_res_key = 0; in __core_scsi3_free_registration()
1224 list_del(&pr_reg->pr_reg_list); in __core_scsi3_free_registration()
1230 core_scsi3_put_pr_reg(pr_reg); in __core_scsi3_free_registration()
1237 while (atomic_read(&pr_reg->pr_res_holders) != 0) { in __core_scsi3_free_registration()
1247 pr_reg->pr_reg_nacl->initiatorname, in __core_scsi3_free_registration()
1251 (pr_reg->pr_reg_all_tg_pt) ? "ALL" : "SINGLE", in __core_scsi3_free_registration()
1254 " 0x%08x\n", tfo->get_fabric_name(), pr_reg->pr_res_key, in __core_scsi3_free_registration()
1255 pr_reg->pr_res_generation); in __core_scsi3_free_registration()
1258 pr_reg->pr_reg_deve = NULL; in __core_scsi3_free_registration()
1259 pr_reg->pr_reg_nacl = NULL; in __core_scsi3_free_registration()
1260 kmem_cache_free(t10_pr_reg_cache, pr_reg); in __core_scsi3_free_registration()
1267 list_add_tail(&pr_reg->pr_reg_abort_list, preempt_and_abort_list); in __core_scsi3_free_registration()
1275 struct t10_pr_registration *pr_reg, *pr_reg_tmp, *pr_res_holder; in core_scsi3_free_pr_reg_from_nacl() local
1290 list_for_each_entry_safe(pr_reg, pr_reg_tmp, in core_scsi3_free_pr_reg_from_nacl()
1293 if (pr_reg->pr_reg_nacl != nacl) in core_scsi3_free_pr_reg_from_nacl()
1296 __core_scsi3_free_registration(dev, pr_reg, NULL, 0); in core_scsi3_free_pr_reg_from_nacl()
1305 struct t10_pr_registration *pr_reg, *pr_reg_tmp, *pr_res_holder; in core_scsi3_free_all_registrations() local
1317 list_for_each_entry_safe(pr_reg, pr_reg_tmp, in core_scsi3_free_all_registrations()
1320 __core_scsi3_free_registration(dev, pr_reg, NULL, 0); in core_scsi3_free_all_registrations()
1325 list_for_each_entry_safe(pr_reg, pr_reg_tmp, &pr_tmpl->aptpl_reg_list, in core_scsi3_free_all_registrations()
1327 list_del(&pr_reg->pr_reg_aptpl_list); in core_scsi3_free_all_registrations()
1328 kmem_cache_free(t10_pr_reg_cache, pr_reg); in core_scsi3_free_all_registrations()
1808 struct t10_pr_registration *pr_reg; in core_scsi3_update_aptpl_buf() local
1819 list_for_each_entry(pr_reg, &dev->t10_pr.registration_list, in core_scsi3_update_aptpl_buf()
1824 tpg = pr_reg->pr_reg_nacl->se_tpg; in core_scsi3_update_aptpl_buf()
1825 lun = pr_reg->pr_reg_tg_pt_lun; in core_scsi3_update_aptpl_buf()
1830 if (pr_reg->isid_present_at_reg) in core_scsi3_update_aptpl_buf()
1832 pr_reg->pr_reg_isid); in core_scsi3_update_aptpl_buf()
1837 if (dev->dev_pr_res_holder == pr_reg) { in core_scsi3_update_aptpl_buf()
1846 pr_reg->pr_reg_nacl->initiatorname, isid_buf, in core_scsi3_update_aptpl_buf()
1847 pr_reg->pr_res_key, pr_reg->pr_res_type, in core_scsi3_update_aptpl_buf()
1848 pr_reg->pr_res_scope, pr_reg->pr_reg_all_tg_pt, in core_scsi3_update_aptpl_buf()
1849 pr_reg->pr_res_mapped_lun); in core_scsi3_update_aptpl_buf()
1856 pr_reg->pr_reg_nacl->initiatorname, isid_buf, in core_scsi3_update_aptpl_buf()
1857 pr_reg->pr_res_key, pr_reg->pr_reg_all_tg_pt, in core_scsi3_update_aptpl_buf()
1858 pr_reg->pr_res_mapped_lun); in core_scsi3_update_aptpl_buf()
1991 struct t10_pr_registration *pr_reg, *pr_reg_p, *pr_reg_tmp; in core_scsi3_emulate_pro_register() local
2013 pr_reg = core_scsi3_locate_pr_reg(dev, se_sess->se_node_acl, se_sess); in core_scsi3_emulate_pro_register()
2014 if (!pr_reg) { in core_scsi3_emulate_pro_register()
2060 if ((register_type == REGISTER) && (res_key != pr_reg->pr_res_key)) { in core_scsi3_emulate_pro_register()
2065 pr_reg->pr_res_key); in core_scsi3_emulate_pro_register()
2081 if (pr_reg->pr_reg_all_tg_pt && !all_tg_pt) { in core_scsi3_emulate_pro_register()
2098 pr_reg->pr_res_generation = core_scsi3_pr_generation(cmd->se_dev); in core_scsi3_emulate_pro_register()
2099 pr_reg->pr_res_key = sa_res_key; in core_scsi3_emulate_pro_register()
2104 pr_reg->pr_reg_nacl->initiatorname, in core_scsi3_emulate_pro_register()
2105 pr_reg->pr_res_key, pr_reg->pr_res_generation); in core_scsi3_emulate_pro_register()
2112 cmd->se_dev, pr_reg); in core_scsi3_emulate_pro_register()
2117 type = pr_reg->pr_res_type; in core_scsi3_emulate_pro_register()
2124 if (pr_reg->pr_reg_all_tg_pt) { in core_scsi3_emulate_pro_register()
2133 if (pr_reg == pr_reg_p) in core_scsi3_emulate_pro_register()
2135 if (strcmp(pr_reg->pr_reg_nacl->initiatorname, in core_scsi3_emulate_pro_register()
2147 __core_scsi3_free_registration(cmd->se_dev, pr_reg, NULL, 1); in core_scsi3_emulate_pro_register()
2148 pr_reg = NULL; in core_scsi3_emulate_pro_register()
2182 if (pr_reg) in core_scsi3_emulate_pro_register()
2183 core_scsi3_put_pr_reg(pr_reg); in core_scsi3_emulate_pro_register()
2215 struct t10_pr_registration *pr_reg, *pr_res_holder; in core_scsi3_pro_reserve() local
2229 pr_reg = core_scsi3_locate_pr_reg(cmd->se_dev, se_sess->se_node_acl, in core_scsi3_pro_reserve()
2231 if (!pr_reg) { in core_scsi3_pro_reserve()
2245 if (res_key != pr_reg->pr_res_key) { in core_scsi3_pro_reserve()
2248 " 0x%016Lx\n", res_key, pr_reg->pr_res_key); in core_scsi3_pro_reserve()
2285 if (pr_res_holder != pr_reg) { in core_scsi3_pro_reserve()
2340 pr_reg->pr_res_scope = scope; in core_scsi3_pro_reserve()
2341 pr_reg->pr_res_type = type; in core_scsi3_pro_reserve()
2342 pr_reg->pr_res_holder = 1; in core_scsi3_pro_reserve()
2343 dev->dev_pr_res_holder = pr_reg; in core_scsi3_pro_reserve()
2344 core_pr_dump_initiator_port(pr_reg, i_buf, PR_REG_ISID_ID_LEN); in core_scsi3_pro_reserve()
2349 (pr_reg->pr_reg_all_tg_pt) ? 1 : 0); in core_scsi3_pro_reserve()
2361 core_scsi3_put_pr_reg(pr_reg); in core_scsi3_pro_reserve()
2390 struct t10_pr_registration *pr_reg, in __core_scsi3_complete_pro_release() argument
2397 core_pr_dump_initiator_port(pr_reg, i_buf, PR_REG_ISID_ID_LEN); in __core_scsi3_complete_pro_release()
2406 core_scsi3_pr_dump_type(pr_reg->pr_res_type), in __core_scsi3_complete_pro_release()
2407 (pr_reg->pr_reg_all_tg_pt) ? 1 : 0); in __core_scsi3_complete_pro_release()
2414 pr_reg->pr_res_holder = pr_reg->pr_res_type = pr_reg->pr_res_scope = 0; in __core_scsi3_complete_pro_release()
2424 struct t10_pr_registration *pr_reg, *pr_reg_p, *pr_res_holder; in core_scsi3_emulate_pro_release() local
2436 pr_reg = core_scsi3_locate_pr_reg(dev, se_sess->se_node_acl, se_sess); in core_scsi3_emulate_pro_release()
2437 if (!pr_reg) { in core_scsi3_emulate_pro_release()
2467 if ((all_reg == 0) && (pr_res_holder != pr_reg)) { in core_scsi3_emulate_pro_release()
2491 if (res_key != pr_reg->pr_res_key) { in core_scsi3_emulate_pro_release()
2494 " 0x%016Lx\n", res_key, pr_reg->pr_res_key); in core_scsi3_emulate_pro_release()
2538 pr_reg, 1); in core_scsi3_emulate_pro_release()
2561 if (pr_reg_p == pr_reg) in core_scsi3_emulate_pro_release()
2575 core_scsi3_put_pr_reg(pr_reg); in core_scsi3_emulate_pro_release()
2586 struct t10_pr_registration *pr_reg, *pr_reg_tmp, *pr_reg_n, *pr_res_holder; in core_scsi3_emulate_pro_clear() local
2633 list_for_each_entry_safe(pr_reg, pr_reg_tmp, in core_scsi3_emulate_pro_clear()
2636 calling_it_nexus = (pr_reg_n == pr_reg) ? 1 : 0; in core_scsi3_emulate_pro_clear()
2637 pr_reg_nacl = pr_reg->pr_reg_nacl; in core_scsi3_emulate_pro_clear()
2638 pr_res_mapped_lun = pr_reg->pr_res_mapped_lun; in core_scsi3_emulate_pro_clear()
2639 __core_scsi3_free_registration(dev, pr_reg, NULL, in core_scsi3_emulate_pro_clear()
2668 struct t10_pr_registration *pr_reg, in __core_scsi3_complete_pro_preempt() argument
2674 struct se_node_acl *nacl = pr_reg->pr_reg_nacl; in __core_scsi3_complete_pro_preempt()
2679 core_pr_dump_initiator_port(pr_reg, i_buf, PR_REG_ISID_ID_LEN); in __core_scsi3_complete_pro_preempt()
2687 dev->dev_pr_res_holder = pr_reg; in __core_scsi3_complete_pro_preempt()
2688 pr_reg->pr_res_holder = 1; in __core_scsi3_complete_pro_preempt()
2689 pr_reg->pr_res_type = type; in __core_scsi3_complete_pro_preempt()
2690 pr_reg->pr_res_scope = scope; in __core_scsi3_complete_pro_preempt()
2696 (pr_reg->pr_reg_all_tg_pt) ? 1 : 0); in __core_scsi3_complete_pro_preempt()
2706 list_add_tail(&pr_reg->pr_reg_abort_list, in __core_scsi3_complete_pro_preempt()
2714 struct t10_pr_registration *pr_reg, *pr_reg_tmp; in core_scsi3_release_preempt_and_abort() local
2716 list_for_each_entry_safe(pr_reg, pr_reg_tmp, preempt_and_abort_list, in core_scsi3_release_preempt_and_abort()
2719 list_del(&pr_reg->pr_reg_abort_list); in core_scsi3_release_preempt_and_abort()
2720 if (pr_reg_holder == pr_reg) in core_scsi3_release_preempt_and_abort()
2722 if (pr_reg->pr_res_holder) { in core_scsi3_release_preempt_and_abort()
2727 pr_reg->pr_reg_deve = NULL; in core_scsi3_release_preempt_and_abort()
2728 pr_reg->pr_reg_nacl = NULL; in core_scsi3_release_preempt_and_abort()
2729 kmem_cache_free(t10_pr_reg_cache, pr_reg); in core_scsi3_release_preempt_and_abort()
2741 struct t10_pr_registration *pr_reg, *pr_reg_tmp, *pr_reg_n, *pr_res_holder; in core_scsi3_pro_preempt() local
2798 list_for_each_entry_safe(pr_reg, pr_reg_tmp, in core_scsi3_pro_preempt()
2818 if (pr_reg->pr_res_key != sa_res_key) in core_scsi3_pro_preempt()
2822 calling_it_nexus = (pr_reg_n == pr_reg) ? 1 : 0; in core_scsi3_pro_preempt()
2823 pr_reg_nacl = pr_reg->pr_reg_nacl; in core_scsi3_pro_preempt()
2824 pr_res_mapped_lun = pr_reg->pr_res_mapped_lun; in core_scsi3_pro_preempt()
2825 __core_scsi3_free_registration(dev, pr_reg, in core_scsi3_pro_preempt()
2843 (pr_reg->pr_res_key != sa_res_key)) in core_scsi3_pro_preempt()
2847 calling_it_nexus = (pr_reg_n == pr_reg) ? 1 : 0; in core_scsi3_pro_preempt()
2851 pr_reg_nacl = pr_reg->pr_reg_nacl; in core_scsi3_pro_preempt()
2852 pr_res_mapped_lun = pr_reg->pr_res_mapped_lun; in core_scsi3_pro_preempt()
2853 __core_scsi3_free_registration(dev, pr_reg, in core_scsi3_pro_preempt()
2943 list_for_each_entry_safe(pr_reg, pr_reg_tmp, in core_scsi3_pro_preempt()
2946 calling_it_nexus = (pr_reg_n == pr_reg) ? 1 : 0; in core_scsi3_pro_preempt()
2950 if (pr_reg->pr_res_key != sa_res_key) in core_scsi3_pro_preempt()
2953 pr_reg_nacl = pr_reg->pr_reg_nacl; in core_scsi3_pro_preempt()
2954 pr_res_mapped_lun = pr_reg->pr_res_mapped_lun; in core_scsi3_pro_preempt()
2955 __core_scsi3_free_registration(dev, pr_reg, in core_scsi3_pro_preempt()
2990 list_for_each_entry_safe(pr_reg, pr_reg_tmp, in core_scsi3_pro_preempt()
2993 calling_it_nexus = (pr_reg_n == pr_reg) ? 1 : 0; in core_scsi3_pro_preempt()
2997 core_scsi3_ua_allocate(pr_reg->pr_reg_nacl, in core_scsi3_pro_preempt()
2998 pr_reg->pr_res_mapped_lun, 0x2A, in core_scsi3_pro_preempt()
3061 struct t10_pr_registration *pr_reg, *pr_res_holder, *dest_pr_reg; in core_scsi3_emulate_pro_register_and_move() local
3087 pr_reg = core_scsi3_locate_pr_reg(cmd->se_dev, se_sess->se_node_acl, in core_scsi3_emulate_pro_register_and_move()
3089 if (!pr_reg) { in core_scsi3_emulate_pro_register_and_move()
3098 if (res_key != pr_reg->pr_res_key) { in core_scsi3_emulate_pro_register_and_move()
3101 " res_key: 0x%016Lx\n", res_key, pr_reg->pr_res_key); in core_scsi3_emulate_pro_register_and_move()
3228 pr_reg_nacl = pr_reg->pr_reg_nacl; in core_scsi3_emulate_pro_register_and_move()
3234 if (!iport_ptr || !pr_reg->isid_present_at_reg) { in core_scsi3_emulate_pro_register_and_move()
3241 if (!strcmp(iport_ptr, pr_reg->pr_reg_isid)) { in core_scsi3_emulate_pro_register_and_move()
3245 pr_reg->pr_reg_isid); in core_scsi3_emulate_pro_register_and_move()
3325 if (pr_res_holder != pr_reg) { in core_scsi3_emulate_pro_register_and_move()
3404 pr_reg->pr_res_scope = scope; in core_scsi3_emulate_pro_register_and_move()
3405 core_pr_dump_initiator_port(pr_reg, i_buf, PR_REG_ISID_ID_LEN); in core_scsi3_emulate_pro_register_and_move()
3437 __core_scsi3_free_registration(dev, pr_reg, NULL, 1); in core_scsi3_emulate_pro_register_and_move()
3440 core_scsi3_put_pr_reg(pr_reg); in core_scsi3_emulate_pro_register_and_move()
3458 core_scsi3_put_pr_reg(pr_reg); in core_scsi3_emulate_pro_register_and_move()
3630 struct t10_pr_registration *pr_reg; in core_scsi3_pri_read_keys() local
3650 list_for_each_entry(pr_reg, &dev->t10_pr.registration_list, in core_scsi3_pri_read_keys()
3659 buf[off++] = ((pr_reg->pr_res_key >> 56) & 0xff); in core_scsi3_pri_read_keys()
3660 buf[off++] = ((pr_reg->pr_res_key >> 48) & 0xff); in core_scsi3_pri_read_keys()
3661 buf[off++] = ((pr_reg->pr_res_key >> 40) & 0xff); in core_scsi3_pri_read_keys()
3662 buf[off++] = ((pr_reg->pr_res_key >> 32) & 0xff); in core_scsi3_pri_read_keys()
3663 buf[off++] = ((pr_reg->pr_res_key >> 24) & 0xff); in core_scsi3_pri_read_keys()
3664 buf[off++] = ((pr_reg->pr_res_key >> 16) & 0xff); in core_scsi3_pri_read_keys()
3665 buf[off++] = ((pr_reg->pr_res_key >> 8) & 0xff); in core_scsi3_pri_read_keys()
3666 buf[off++] = (pr_reg->pr_res_key & 0xff); in core_scsi3_pri_read_keys()
3691 struct t10_pr_registration *pr_reg; in core_scsi3_pri_read_reservation() local
3712 pr_reg = dev->dev_pr_res_holder; in core_scsi3_pri_read_reservation()
3713 if (pr_reg) { in core_scsi3_pri_read_reservation()
3741 if ((pr_reg->pr_res_type == PR_TYPE_WRITE_EXCLUSIVE_ALLREG) || in core_scsi3_pri_read_reservation()
3742 (pr_reg->pr_res_type == PR_TYPE_EXCLUSIVE_ACCESS_ALLREG)) in core_scsi3_pri_read_reservation()
3745 pr_res_key = pr_reg->pr_res_key; in core_scsi3_pri_read_reservation()
3758 buf[21] = (pr_reg->pr_res_scope & 0xf0) | in core_scsi3_pri_read_reservation()
3759 (pr_reg->pr_res_type & 0x0f); in core_scsi3_pri_read_reservation()
3838 struct t10_pr_registration *pr_reg, *pr_reg_tmp; in core_scsi3_pri_read_full_status() local
3861 list_for_each_entry_safe(pr_reg, pr_reg_tmp, in core_scsi3_pri_read_full_status()
3864 se_nacl = pr_reg->pr_reg_nacl; in core_scsi3_pri_read_full_status()
3865 se_tpg = pr_reg->pr_reg_nacl->se_tpg; in core_scsi3_pri_read_full_status()
3868 atomic_inc_mb(&pr_reg->pr_res_holders); in core_scsi3_pri_read_full_status()
3875 se_tpg, se_nacl, pr_reg, &format_code); in core_scsi3_pri_read_full_status()
3881 atomic_dec_mb(&pr_reg->pr_res_holders); in core_scsi3_pri_read_full_status()
3887 buf[off++] = ((pr_reg->pr_res_key >> 56) & 0xff); in core_scsi3_pri_read_full_status()
3888 buf[off++] = ((pr_reg->pr_res_key >> 48) & 0xff); in core_scsi3_pri_read_full_status()
3889 buf[off++] = ((pr_reg->pr_res_key >> 40) & 0xff); in core_scsi3_pri_read_full_status()
3890 buf[off++] = ((pr_reg->pr_res_key >> 32) & 0xff); in core_scsi3_pri_read_full_status()
3891 buf[off++] = ((pr_reg->pr_res_key >> 24) & 0xff); in core_scsi3_pri_read_full_status()
3892 buf[off++] = ((pr_reg->pr_res_key >> 16) & 0xff); in core_scsi3_pri_read_full_status()
3893 buf[off++] = ((pr_reg->pr_res_key >> 8) & 0xff); in core_scsi3_pri_read_full_status()
3894 buf[off++] = (pr_reg->pr_res_key & 0xff); in core_scsi3_pri_read_full_status()
3900 if (pr_reg->pr_reg_all_tg_pt) in core_scsi3_pri_read_full_status()
3909 if (pr_reg->pr_res_holder) { in core_scsi3_pri_read_full_status()
3911 buf[off++] = (pr_reg->pr_res_scope & 0xf0) | in core_scsi3_pri_read_full_status()
3912 (pr_reg->pr_res_type & 0x0f); in core_scsi3_pri_read_full_status()
3927 if (!pr_reg->pr_reg_all_tg_pt) { in core_scsi3_pri_read_full_status()
3928 struct se_port *port = pr_reg->pr_reg_tg_pt_lun->lun_sep; in core_scsi3_pri_read_full_status()
3939 se_nacl, pr_reg, &format_code, &buf[off+4]); in core_scsi3_pri_read_full_status()
3942 atomic_dec_mb(&pr_reg->pr_res_holders); in core_scsi3_pri_read_full_status()