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 /drivers/target/target_core_spc.c | |
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>
Diffstat (limited to 'drivers/target/target_core_spc.c')
-rw-r--r-- | drivers/target/target_core_spc.c | 91 |
1 files changed, 42 insertions, 49 deletions
diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c index 6fd434d3d7e4..0af45ae32f8c 100644 --- a/drivers/target/target_core_spc.c +++ b/drivers/target/target_core_spc.c | |||
@@ -95,14 +95,14 @@ static int spc_emulate_inquiry_std(struct se_cmd *cmd, char *buf) | |||
95 | /* | 95 | /* |
96 | * Enable SCCS and TPGS fields for Emulated ALUA | 96 | * Enable SCCS and TPGS fields for Emulated ALUA |
97 | */ | 97 | */ |
98 | if (dev->se_sub_dev->t10_alua.alua_type == SPC3_ALUA_EMULATED) | 98 | if (dev->t10_alua.alua_type == SPC3_ALUA_EMULATED) |
99 | spc_fill_alua_data(lun->lun_sep, buf); | 99 | spc_fill_alua_data(lun->lun_sep, buf); |
100 | 100 | ||
101 | buf[7] = 0x2; /* CmdQue=1 */ | 101 | buf[7] = 0x2; /* CmdQue=1 */ |
102 | 102 | ||
103 | snprintf(&buf[8], 8, "LIO-ORG"); | 103 | snprintf(&buf[8], 8, "LIO-ORG"); |
104 | snprintf(&buf[16], 16, "%s", dev->se_sub_dev->t10_wwn.model); | 104 | snprintf(&buf[16], 16, "%s", dev->t10_wwn.model); |
105 | snprintf(&buf[32], 4, "%s", dev->se_sub_dev->t10_wwn.revision); | 105 | snprintf(&buf[32], 4, "%s", dev->t10_wwn.revision); |
106 | buf[4] = 31; /* Set additional length to 31 */ | 106 | buf[4] = 31; /* Set additional length to 31 */ |
107 | 107 | ||
108 | return 0; | 108 | return 0; |
@@ -114,15 +114,13 @@ static int spc_emulate_evpd_80(struct se_cmd *cmd, unsigned char *buf) | |||
114 | struct se_device *dev = cmd->se_dev; | 114 | struct se_device *dev = cmd->se_dev; |
115 | u16 len = 0; | 115 | u16 len = 0; |
116 | 116 | ||
117 | if (dev->se_sub_dev->su_dev_flags & | 117 | if (dev->dev_flags & DF_EMULATED_VPD_UNIT_SERIAL) { |
118 | SDF_EMULATED_VPD_UNIT_SERIAL) { | ||
119 | u32 unit_serial_len; | 118 | u32 unit_serial_len; |
120 | 119 | ||
121 | unit_serial_len = strlen(dev->se_sub_dev->t10_wwn.unit_serial); | 120 | unit_serial_len = strlen(dev->t10_wwn.unit_serial); |
122 | unit_serial_len++; /* For NULL Terminator */ | 121 | unit_serial_len++; /* For NULL Terminator */ |
123 | 122 | ||
124 | len += sprintf(&buf[4], "%s", | 123 | len += sprintf(&buf[4], "%s", dev->t10_wwn.unit_serial); |
125 | dev->se_sub_dev->t10_wwn.unit_serial); | ||
126 | len++; /* Extra Byte for NULL Terminator */ | 124 | len++; /* Extra Byte for NULL Terminator */ |
127 | buf[3] = len; | 125 | buf[3] = len; |
128 | } | 126 | } |
@@ -132,7 +130,7 @@ static int spc_emulate_evpd_80(struct se_cmd *cmd, unsigned char *buf) | |||
132 | static void spc_parse_naa_6h_vendor_specific(struct se_device *dev, | 130 | static void spc_parse_naa_6h_vendor_specific(struct se_device *dev, |
133 | unsigned char *buf) | 131 | unsigned char *buf) |
134 | { | 132 | { |
135 | unsigned char *p = &dev->se_sub_dev->t10_wwn.unit_serial[0]; | 133 | unsigned char *p = &dev->t10_wwn.unit_serial[0]; |
136 | int cnt; | 134 | int cnt; |
137 | bool next = true; | 135 | bool next = true; |
138 | 136 | ||
@@ -173,7 +171,7 @@ static int spc_emulate_evpd_83(struct se_cmd *cmd, unsigned char *buf) | |||
173 | struct t10_alua_lu_gp_member *lu_gp_mem; | 171 | struct t10_alua_lu_gp_member *lu_gp_mem; |
174 | struct t10_alua_tg_pt_gp *tg_pt_gp; | 172 | struct t10_alua_tg_pt_gp *tg_pt_gp; |
175 | struct t10_alua_tg_pt_gp_member *tg_pt_gp_mem; | 173 | struct t10_alua_tg_pt_gp_member *tg_pt_gp_mem; |
176 | unsigned char *prod = &dev->se_sub_dev->t10_wwn.model[0]; | 174 | unsigned char *prod = &dev->t10_wwn.model[0]; |
177 | u32 prod_len; | 175 | u32 prod_len; |
178 | u32 unit_serial_len, off = 0; | 176 | u32 unit_serial_len, off = 0; |
179 | u16 len = 0, id_len; | 177 | u16 len = 0, id_len; |
@@ -188,7 +186,7 @@ static int spc_emulate_evpd_83(struct se_cmd *cmd, unsigned char *buf) | |||
188 | * /sys/kernel/config/target/core/$HBA/$DEV/wwn/vpd_unit_serial | 186 | * /sys/kernel/config/target/core/$HBA/$DEV/wwn/vpd_unit_serial |
189 | * value in order to return the NAA id. | 187 | * value in order to return the NAA id. |
190 | */ | 188 | */ |
191 | if (!(dev->se_sub_dev->su_dev_flags & SDF_EMULATED_VPD_UNIT_SERIAL)) | 189 | if (!(dev->dev_flags & DF_EMULATED_VPD_UNIT_SERIAL)) |
192 | goto check_t10_vend_desc; | 190 | goto check_t10_vend_desc; |
193 | 191 | ||
194 | /* CODE SET == Binary */ | 192 | /* CODE SET == Binary */ |
@@ -236,14 +234,12 @@ check_t10_vend_desc: | |||
236 | prod_len += strlen(prod); | 234 | prod_len += strlen(prod); |
237 | prod_len++; /* For : */ | 235 | prod_len++; /* For : */ |
238 | 236 | ||
239 | if (dev->se_sub_dev->su_dev_flags & | 237 | if (dev->dev_flags & DF_EMULATED_VPD_UNIT_SERIAL) { |
240 | SDF_EMULATED_VPD_UNIT_SERIAL) { | 238 | unit_serial_len = strlen(&dev->t10_wwn.unit_serial[0]); |
241 | unit_serial_len = | ||
242 | strlen(&dev->se_sub_dev->t10_wwn.unit_serial[0]); | ||
243 | unit_serial_len++; /* For NULL Terminator */ | 239 | unit_serial_len++; /* For NULL Terminator */ |
244 | 240 | ||
245 | id_len += sprintf(&buf[off+12], "%s:%s", prod, | 241 | id_len += sprintf(&buf[off+12], "%s:%s", prod, |
246 | &dev->se_sub_dev->t10_wwn.unit_serial[0]); | 242 | &dev->t10_wwn.unit_serial[0]); |
247 | } | 243 | } |
248 | buf[off] = 0x2; /* ASCII */ | 244 | buf[off] = 0x2; /* ASCII */ |
249 | buf[off+1] = 0x1; /* T10 Vendor ID */ | 245 | buf[off+1] = 0x1; /* T10 Vendor ID */ |
@@ -298,8 +294,7 @@ check_t10_vend_desc: | |||
298 | * Get the PROTOCOL IDENTIFIER as defined by spc4r17 | 294 | * Get the PROTOCOL IDENTIFIER as defined by spc4r17 |
299 | * section 7.5.1 Table 362 | 295 | * section 7.5.1 Table 362 |
300 | */ | 296 | */ |
301 | if (dev->se_sub_dev->t10_alua.alua_type != | 297 | if (dev->t10_alua.alua_type != SPC3_ALUA_EMULATED) |
302 | SPC3_ALUA_EMULATED) | ||
303 | goto check_scsi_name; | 298 | goto check_scsi_name; |
304 | 299 | ||
305 | tg_pt_gp_mem = port->sep_alua_tg_pt_gp_mem; | 300 | tg_pt_gp_mem = port->sep_alua_tg_pt_gp_mem; |
@@ -422,7 +417,7 @@ static int spc_emulate_evpd_86(struct se_cmd *cmd, unsigned char *buf) | |||
422 | buf[5] = 0x07; | 417 | buf[5] = 0x07; |
423 | 418 | ||
424 | /* If WriteCache emulation is enabled, set V_SUP */ | 419 | /* If WriteCache emulation is enabled, set V_SUP */ |
425 | if (cmd->se_dev->se_sub_dev->se_dev_attrib.emulate_write_cache > 0) | 420 | if (cmd->se_dev->dev_attrib.emulate_write_cache > 0) |
426 | buf[6] = 0x01; | 421 | buf[6] = 0x01; |
427 | return 0; | 422 | return 0; |
428 | } | 423 | } |
@@ -439,7 +434,7 @@ static int spc_emulate_evpd_b0(struct se_cmd *cmd, unsigned char *buf) | |||
439 | * emulate_tpu=1 or emulate_tpws=1 we will be expect a | 434 | * emulate_tpu=1 or emulate_tpws=1 we will be expect a |
440 | * different page length for Thin Provisioning. | 435 | * different page length for Thin Provisioning. |
441 | */ | 436 | */ |
442 | if (dev->se_sub_dev->se_dev_attrib.emulate_tpu || dev->se_sub_dev->se_dev_attrib.emulate_tpws) | 437 | if (dev->dev_attrib.emulate_tpu || dev->dev_attrib.emulate_tpws) |
443 | have_tp = 1; | 438 | have_tp = 1; |
444 | 439 | ||
445 | buf[0] = dev->transport->get_device_type(dev); | 440 | buf[0] = dev->transport->get_device_type(dev); |
@@ -456,14 +451,14 @@ static int spc_emulate_evpd_b0(struct se_cmd *cmd, unsigned char *buf) | |||
456 | /* | 451 | /* |
457 | * Set MAXIMUM TRANSFER LENGTH | 452 | * Set MAXIMUM TRANSFER LENGTH |
458 | */ | 453 | */ |
459 | max_sectors = min(dev->se_sub_dev->se_dev_attrib.fabric_max_sectors, | 454 | max_sectors = min(dev->dev_attrib.fabric_max_sectors, |
460 | dev->se_sub_dev->se_dev_attrib.hw_max_sectors); | 455 | dev->dev_attrib.hw_max_sectors); |
461 | put_unaligned_be32(max_sectors, &buf[8]); | 456 | put_unaligned_be32(max_sectors, &buf[8]); |
462 | 457 | ||
463 | /* | 458 | /* |
464 | * Set OPTIMAL TRANSFER LENGTH | 459 | * Set OPTIMAL TRANSFER LENGTH |
465 | */ | 460 | */ |
466 | put_unaligned_be32(dev->se_sub_dev->se_dev_attrib.optimal_sectors, &buf[12]); | 461 | put_unaligned_be32(dev->dev_attrib.optimal_sectors, &buf[12]); |
467 | 462 | ||
468 | /* | 463 | /* |
469 | * Exit now if we don't support TP. | 464 | * Exit now if we don't support TP. |
@@ -474,25 +469,25 @@ static int spc_emulate_evpd_b0(struct se_cmd *cmd, unsigned char *buf) | |||
474 | /* | 469 | /* |
475 | * Set MAXIMUM UNMAP LBA COUNT | 470 | * Set MAXIMUM UNMAP LBA COUNT |
476 | */ | 471 | */ |
477 | put_unaligned_be32(dev->se_sub_dev->se_dev_attrib.max_unmap_lba_count, &buf[20]); | 472 | put_unaligned_be32(dev->dev_attrib.max_unmap_lba_count, &buf[20]); |
478 | 473 | ||
479 | /* | 474 | /* |
480 | * Set MAXIMUM UNMAP BLOCK DESCRIPTOR COUNT | 475 | * Set MAXIMUM UNMAP BLOCK DESCRIPTOR COUNT |
481 | */ | 476 | */ |
482 | put_unaligned_be32(dev->se_sub_dev->se_dev_attrib.max_unmap_block_desc_count, | 477 | put_unaligned_be32(dev->dev_attrib.max_unmap_block_desc_count, |
483 | &buf[24]); | 478 | &buf[24]); |
484 | 479 | ||
485 | /* | 480 | /* |
486 | * Set OPTIMAL UNMAP GRANULARITY | 481 | * Set OPTIMAL UNMAP GRANULARITY |
487 | */ | 482 | */ |
488 | put_unaligned_be32(dev->se_sub_dev->se_dev_attrib.unmap_granularity, &buf[28]); | 483 | put_unaligned_be32(dev->dev_attrib.unmap_granularity, &buf[28]); |
489 | 484 | ||
490 | /* | 485 | /* |
491 | * UNMAP GRANULARITY ALIGNMENT | 486 | * UNMAP GRANULARITY ALIGNMENT |
492 | */ | 487 | */ |
493 | put_unaligned_be32(dev->se_sub_dev->se_dev_attrib.unmap_granularity_alignment, | 488 | put_unaligned_be32(dev->dev_attrib.unmap_granularity_alignment, |
494 | &buf[32]); | 489 | &buf[32]); |
495 | if (dev->se_sub_dev->se_dev_attrib.unmap_granularity_alignment != 0) | 490 | if (dev->dev_attrib.unmap_granularity_alignment != 0) |
496 | buf[32] |= 0x80; /* Set the UGAVALID bit */ | 491 | buf[32] |= 0x80; /* Set the UGAVALID bit */ |
497 | 492 | ||
498 | return 0; | 493 | return 0; |
@@ -505,7 +500,7 @@ static int spc_emulate_evpd_b1(struct se_cmd *cmd, unsigned char *buf) | |||
505 | 500 | ||
506 | buf[0] = dev->transport->get_device_type(dev); | 501 | buf[0] = dev->transport->get_device_type(dev); |
507 | buf[3] = 0x3c; | 502 | buf[3] = 0x3c; |
508 | buf[5] = dev->se_sub_dev->se_dev_attrib.is_nonrot ? 1 : 0; | 503 | buf[5] = dev->dev_attrib.is_nonrot ? 1 : 0; |
509 | 504 | ||
510 | return 0; | 505 | return 0; |
511 | } | 506 | } |
@@ -546,7 +541,7 @@ static int spc_emulate_evpd_b2(struct se_cmd *cmd, unsigned char *buf) | |||
546 | * the UNMAP command (see 5.25). A TPU bit set to zero indicates | 541 | * the UNMAP command (see 5.25). A TPU bit set to zero indicates |
547 | * that the device server does not support the UNMAP command. | 542 | * that the device server does not support the UNMAP command. |
548 | */ | 543 | */ |
549 | if (dev->se_sub_dev->se_dev_attrib.emulate_tpu != 0) | 544 | if (dev->dev_attrib.emulate_tpu != 0) |
550 | buf[5] = 0x80; | 545 | buf[5] = 0x80; |
551 | 546 | ||
552 | /* | 547 | /* |
@@ -555,7 +550,7 @@ static int spc_emulate_evpd_b2(struct se_cmd *cmd, unsigned char *buf) | |||
555 | * A TPWS bit set to zero indicates that the device server does not | 550 | * A TPWS bit set to zero indicates that the device server does not |
556 | * support the use of the WRITE SAME (16) command to unmap LBAs. | 551 | * support the use of the WRITE SAME (16) command to unmap LBAs. |
557 | */ | 552 | */ |
558 | if (dev->se_sub_dev->se_dev_attrib.emulate_tpws != 0) | 553 | if (dev->dev_attrib.emulate_tpws != 0) |
559 | buf[5] |= 0x40; | 554 | buf[5] |= 0x40; |
560 | 555 | ||
561 | return 0; | 556 | return 0; |
@@ -586,8 +581,7 @@ static int spc_emulate_evpd_00(struct se_cmd *cmd, unsigned char *buf) | |||
586 | * Registered Extended LUN WWN has been set via ConfigFS | 581 | * Registered Extended LUN WWN has been set via ConfigFS |
587 | * during device creation/restart. | 582 | * during device creation/restart. |
588 | */ | 583 | */ |
589 | if (cmd->se_dev->se_sub_dev->su_dev_flags & | 584 | if (cmd->se_dev->dev_flags & DF_EMULATED_VPD_UNIT_SERIAL) { |
590 | SDF_EMULATED_VPD_UNIT_SERIAL) { | ||
591 | buf[3] = ARRAY_SIZE(evpd_handlers); | 585 | buf[3] = ARRAY_SIZE(evpd_handlers); |
592 | for (p = 0; p < ARRAY_SIZE(evpd_handlers); ++p) | 586 | for (p = 0; p < ARRAY_SIZE(evpd_handlers); ++p) |
593 | buf[p + 4] = evpd_handlers[p].page; | 587 | buf[p + 4] = evpd_handlers[p].page; |
@@ -690,7 +684,7 @@ static int spc_modesense_control(struct se_device *dev, unsigned char *p) | |||
690 | * command sequence order shall be explicitly handled by the application client | 684 | * command sequence order shall be explicitly handled by the application client |
691 | * through the selection of appropriate ommands and task attributes. | 685 | * through the selection of appropriate ommands and task attributes. |
692 | */ | 686 | */ |
693 | p[3] = (dev->se_sub_dev->se_dev_attrib.emulate_rest_reord == 1) ? 0x00 : 0x10; | 687 | p[3] = (dev->dev_attrib.emulate_rest_reord == 1) ? 0x00 : 0x10; |
694 | /* | 688 | /* |
695 | * From spc4r17, section 7.4.6 Control mode Page | 689 | * From spc4r17, section 7.4.6 Control mode Page |
696 | * | 690 | * |
@@ -720,8 +714,8 @@ static int spc_modesense_control(struct se_device *dev, unsigned char *p) | |||
720 | * for a BUSY, TASK SET FULL, or RESERVATION CONFLICT status regardless | 714 | * for a BUSY, TASK SET FULL, or RESERVATION CONFLICT status regardless |
721 | * to the number of commands completed with one of those status codes. | 715 | * to the number of commands completed with one of those status codes. |
722 | */ | 716 | */ |
723 | p[4] = (dev->se_sub_dev->se_dev_attrib.emulate_ua_intlck_ctrl == 2) ? 0x30 : | 717 | p[4] = (dev->dev_attrib.emulate_ua_intlck_ctrl == 2) ? 0x30 : |
724 | (dev->se_sub_dev->se_dev_attrib.emulate_ua_intlck_ctrl == 1) ? 0x20 : 0x00; | 718 | (dev->dev_attrib.emulate_ua_intlck_ctrl == 1) ? 0x20 : 0x00; |
725 | /* | 719 | /* |
726 | * From spc4r17, section 7.4.6 Control mode Page | 720 | * From spc4r17, section 7.4.6 Control mode Page |
727 | * | 721 | * |
@@ -734,7 +728,7 @@ static int spc_modesense_control(struct se_device *dev, unsigned char *p) | |||
734 | * which the command was received shall be completed with TASK ABORTED | 728 | * which the command was received shall be completed with TASK ABORTED |
735 | * status (see SAM-4). | 729 | * status (see SAM-4). |
736 | */ | 730 | */ |
737 | p[5] = (dev->se_sub_dev->se_dev_attrib.emulate_tas) ? 0x40 : 0x00; | 731 | p[5] = (dev->dev_attrib.emulate_tas) ? 0x40 : 0x00; |
738 | p[8] = 0xff; | 732 | p[8] = 0xff; |
739 | p[9] = 0xff; | 733 | p[9] = 0xff; |
740 | p[11] = 30; | 734 | p[11] = 30; |
@@ -746,7 +740,7 @@ static int spc_modesense_caching(struct se_device *dev, unsigned char *p) | |||
746 | { | 740 | { |
747 | p[0] = 0x08; | 741 | p[0] = 0x08; |
748 | p[1] = 0x12; | 742 | p[1] = 0x12; |
749 | if (dev->se_sub_dev->se_dev_attrib.emulate_write_cache > 0) | 743 | if (dev->dev_attrib.emulate_write_cache > 0) |
750 | p[2] = 0x04; /* Write Cache Enable */ | 744 | p[2] = 0x04; /* Write Cache Enable */ |
751 | p[12] = 0x20; /* Disabled Read Ahead */ | 745 | p[12] = 0x20; /* Disabled Read Ahead */ |
752 | 746 | ||
@@ -826,8 +820,8 @@ static int spc_emulate_modesense(struct se_cmd *cmd) | |||
826 | (cmd->se_deve->lun_flags & TRANSPORT_LUNFLAGS_READ_ONLY))) | 820 | (cmd->se_deve->lun_flags & TRANSPORT_LUNFLAGS_READ_ONLY))) |
827 | spc_modesense_write_protect(&buf[3], type); | 821 | spc_modesense_write_protect(&buf[3], type); |
828 | 822 | ||
829 | if ((dev->se_sub_dev->se_dev_attrib.emulate_write_cache > 0) && | 823 | if ((dev->dev_attrib.emulate_write_cache > 0) && |
830 | (dev->se_sub_dev->se_dev_attrib.emulate_fua_write > 0)) | 824 | (dev->dev_attrib.emulate_fua_write > 0)) |
831 | spc_modesense_dpofua(&buf[3], type); | 825 | spc_modesense_dpofua(&buf[3], type); |
832 | } else { | 826 | } else { |
833 | offset -= 1; | 827 | offset -= 1; |
@@ -839,8 +833,8 @@ static int spc_emulate_modesense(struct se_cmd *cmd) | |||
839 | (cmd->se_deve->lun_flags & TRANSPORT_LUNFLAGS_READ_ONLY))) | 833 | (cmd->se_deve->lun_flags & TRANSPORT_LUNFLAGS_READ_ONLY))) |
840 | spc_modesense_write_protect(&buf[2], type); | 834 | spc_modesense_write_protect(&buf[2], type); |
841 | 835 | ||
842 | if ((dev->se_sub_dev->se_dev_attrib.emulate_write_cache > 0) && | 836 | if ((dev->dev_attrib.emulate_write_cache > 0) && |
843 | (dev->se_sub_dev->se_dev_attrib.emulate_fua_write > 0)) | 837 | (dev->dev_attrib.emulate_fua_write > 0)) |
844 | spc_modesense_dpofua(&buf[2], type); | 838 | spc_modesense_dpofua(&buf[2], type); |
845 | } | 839 | } |
846 | 840 | ||
@@ -923,7 +917,6 @@ static int spc_emulate_testunitready(struct se_cmd *cmd) | |||
923 | int spc_parse_cdb(struct se_cmd *cmd, unsigned int *size) | 917 | int spc_parse_cdb(struct se_cmd *cmd, unsigned int *size) |
924 | { | 918 | { |
925 | struct se_device *dev = cmd->se_dev; | 919 | struct se_device *dev = cmd->se_dev; |
926 | struct se_subsystem_dev *su_dev = dev->se_sub_dev; | ||
927 | unsigned char *cdb = cmd->t_task_cdb; | 920 | unsigned char *cdb = cmd->t_task_cdb; |
928 | 921 | ||
929 | switch (cdb[0]) { | 922 | switch (cdb[0]) { |
@@ -946,12 +939,12 @@ int spc_parse_cdb(struct se_cmd *cmd, unsigned int *size) | |||
946 | *size = (cdb[7] << 8) + cdb[8]; | 939 | *size = (cdb[7] << 8) + cdb[8]; |
947 | break; | 940 | break; |
948 | case PERSISTENT_RESERVE_IN: | 941 | case PERSISTENT_RESERVE_IN: |
949 | if (su_dev->t10_pr.res_type == SPC3_PERSISTENT_RESERVATIONS) | 942 | if (dev->t10_pr.res_type == SPC3_PERSISTENT_RESERVATIONS) |
950 | cmd->execute_cmd = target_scsi3_emulate_pr_in; | 943 | cmd->execute_cmd = target_scsi3_emulate_pr_in; |
951 | *size = (cdb[7] << 8) + cdb[8]; | 944 | *size = (cdb[7] << 8) + cdb[8]; |
952 | break; | 945 | break; |
953 | case PERSISTENT_RESERVE_OUT: | 946 | case PERSISTENT_RESERVE_OUT: |
954 | if (su_dev->t10_pr.res_type == SPC3_PERSISTENT_RESERVATIONS) | 947 | if (dev->t10_pr.res_type == SPC3_PERSISTENT_RESERVATIONS) |
955 | cmd->execute_cmd = target_scsi3_emulate_pr_out; | 948 | cmd->execute_cmd = target_scsi3_emulate_pr_out; |
956 | *size = (cdb[7] << 8) + cdb[8]; | 949 | *size = (cdb[7] << 8) + cdb[8]; |
957 | break; | 950 | break; |
@@ -962,7 +955,7 @@ int spc_parse_cdb(struct se_cmd *cmd, unsigned int *size) | |||
962 | else | 955 | else |
963 | *size = cmd->data_length; | 956 | *size = cmd->data_length; |
964 | 957 | ||
965 | if (su_dev->t10_pr.res_type != SPC_PASSTHROUGH) | 958 | if (dev->t10_pr.res_type != SPC_PASSTHROUGH) |
966 | cmd->execute_cmd = target_scsi2_reservation_release; | 959 | cmd->execute_cmd = target_scsi2_reservation_release; |
967 | break; | 960 | break; |
968 | case RESERVE: | 961 | case RESERVE: |
@@ -983,7 +976,7 @@ int spc_parse_cdb(struct se_cmd *cmd, unsigned int *size) | |||
983 | * is running in SPC_PASSTHROUGH, and wants reservations | 976 | * is running in SPC_PASSTHROUGH, and wants reservations |
984 | * emulation disabled. | 977 | * emulation disabled. |
985 | */ | 978 | */ |
986 | if (su_dev->t10_pr.res_type != SPC_PASSTHROUGH) | 979 | if (dev->t10_pr.res_type != SPC_PASSTHROUGH) |
987 | cmd->execute_cmd = target_scsi2_reservation_reserve; | 980 | cmd->execute_cmd = target_scsi2_reservation_reserve; |
988 | break; | 981 | break; |
989 | case REQUEST_SENSE: | 982 | case REQUEST_SENSE: |
@@ -1040,7 +1033,7 @@ int spc_parse_cdb(struct se_cmd *cmd, unsigned int *size) | |||
1040 | * Check for emulated MI_REPORT_TARGET_PGS | 1033 | * Check for emulated MI_REPORT_TARGET_PGS |
1041 | */ | 1034 | */ |
1042 | if ((cdb[1] & 0x1f) == MI_REPORT_TARGET_PGS && | 1035 | if ((cdb[1] & 0x1f) == MI_REPORT_TARGET_PGS && |
1043 | su_dev->t10_alua.alua_type == SPC3_ALUA_EMULATED) { | 1036 | dev->t10_alua.alua_type == SPC3_ALUA_EMULATED) { |
1044 | cmd->execute_cmd = | 1037 | cmd->execute_cmd = |
1045 | target_emulate_report_target_port_groups; | 1038 | target_emulate_report_target_port_groups; |
1046 | } | 1039 | } |
@@ -1059,7 +1052,7 @@ int spc_parse_cdb(struct se_cmd *cmd, unsigned int *size) | |||
1059 | * Check for emulated MO_SET_TARGET_PGS. | 1052 | * Check for emulated MO_SET_TARGET_PGS. |
1060 | */ | 1053 | */ |
1061 | if (cdb[1] == MO_SET_TARGET_PGS && | 1054 | if (cdb[1] == MO_SET_TARGET_PGS && |
1062 | su_dev->t10_alua.alua_type == SPC3_ALUA_EMULATED) { | 1055 | dev->t10_alua.alua_type == SPC3_ALUA_EMULATED) { |
1063 | cmd->execute_cmd = | 1056 | cmd->execute_cmd = |
1064 | target_emulate_set_target_port_groups; | 1057 | target_emulate_set_target_port_groups; |
1065 | } | 1058 | } |