aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target/iscsi/iscsi_target.c
diff options
context:
space:
mode:
authorAndy Grover <agrover@redhat.com>2012-04-03 18:51:24 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2012-04-14 20:40:38 -0400
commitebf1d95ca297a06fe760177b614646dcec06abef (patch)
tree6ee7e2c5934ff0e7cd7e30b1e02590d0b4145406 /drivers/target/iscsi/iscsi_target.c
parent065ca1e42ffd74dd03cf60f61cead35934c91ed5 (diff)
target/iscsi: Eliminate iscsi_cmd.data_length
Redundant, just use iscsi_cmd->se_cmd.data_length once se_cmd is initialized, or hdr->data_length before then. Signed-off-by: Andy Grover <agrover@redhat.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target/iscsi/iscsi_target.c')
-rw-r--r--drivers/target/iscsi/iscsi_target.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
index 1b51a3ed17f5..a29a1bb279d5 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -968,7 +968,6 @@ done:
968 buf, conn); 968 buf, conn);
969 969
970 cmd->data_direction = data_direction; 970 cmd->data_direction = data_direction;
971 cmd->data_length = hdr->data_length;
972 iscsi_task_attr = hdr->flags & ISCSI_FLAG_CMD_ATTR_MASK; 971 iscsi_task_attr = hdr->flags & ISCSI_FLAG_CMD_ATTR_MASK;
973 /* 972 /*
974 * Figure out the SAM Task Attribute for the incoming SCSI CDB 973 * Figure out the SAM Task Attribute for the incoming SCSI CDB
@@ -1026,7 +1025,7 @@ done:
1026 * Initialize struct se_cmd descriptor from target_core_mod infrastructure 1025 * Initialize struct se_cmd descriptor from target_core_mod infrastructure
1027 */ 1026 */
1028 transport_init_se_cmd(&cmd->se_cmd, &lio_target_fabric_configfs->tf_ops, 1027 transport_init_se_cmd(&cmd->se_cmd, &lio_target_fabric_configfs->tf_ops,
1029 conn->sess->se_sess, cmd->data_length, cmd->data_direction, 1028 conn->sess->se_sess, hdr->data_length, cmd->data_direction,
1030 sam_task_attr, &cmd->sense_buffer[0]); 1029 sam_task_attr, &cmd->sense_buffer[0]);
1031 1030
1032 pr_debug("Got SCSI Command, ITT: 0x%08x, CmdSN: 0x%08x," 1031 pr_debug("Got SCSI Command, ITT: 0x%08x, CmdSN: 0x%08x,"
@@ -1061,8 +1060,6 @@ done:
1061 */ 1060 */
1062 send_check_condition = 1; 1061 send_check_condition = 1;
1063 } else { 1062 } else {
1064 cmd->data_length = cmd->se_cmd.data_length;
1065
1066 if (iscsit_decide_list_to_build(cmd, payload_length) < 0) 1063 if (iscsit_decide_list_to_build(cmd, payload_length) < 0)
1067 return iscsit_add_reject_from_cmd( 1064 return iscsit_add_reject_from_cmd(
1068 ISCSI_REASON_BOOKMARK_NO_RESOURCES, 1065 ISCSI_REASON_BOOKMARK_NO_RESOURCES,
@@ -1329,10 +1326,10 @@ static int iscsit_handle_data_out(struct iscsi_conn *conn, unsigned char *buf)
1329 se_cmd = &cmd->se_cmd; 1326 se_cmd = &cmd->se_cmd;
1330 iscsit_mod_dataout_timer(cmd); 1327 iscsit_mod_dataout_timer(cmd);
1331 1328
1332 if ((hdr->offset + payload_length) > cmd->data_length) { 1329 if ((hdr->offset + payload_length) > cmd->se_cmd.data_length) {
1333 pr_err("DataOut Offset: %u, Length %u greater than" 1330 pr_err("DataOut Offset: %u, Length %u greater than"
1334 " iSCSI Command EDTL %u, protocol error.\n", 1331 " iSCSI Command EDTL %u, protocol error.\n",
1335 hdr->offset, payload_length, cmd->data_length); 1332 hdr->offset, payload_length, cmd->se_cmd.data_length);
1336 return iscsit_add_reject_from_cmd(ISCSI_REASON_BOOKMARK_INVALID, 1333 return iscsit_add_reject_from_cmd(ISCSI_REASON_BOOKMARK_INVALID,
1337 1, 0, buf, cmd); 1334 1, 0, buf, cmd);
1338 } 1335 }
@@ -2427,7 +2424,7 @@ static int iscsit_handle_immediate_data(
2427 2424
2428 cmd->write_data_done += length; 2425 cmd->write_data_done += length;
2429 2426
2430 if (cmd->write_data_done == cmd->data_length) { 2427 if (cmd->write_data_done == cmd->se_cmd.data_length) {
2431 spin_lock_bh(&cmd->istate_lock); 2428 spin_lock_bh(&cmd->istate_lock);
2432 cmd->cmd_flags |= ICF_GOT_LAST_DATAOUT; 2429 cmd->cmd_flags |= ICF_GOT_LAST_DATAOUT;
2433 cmd->i_state = ISTATE_RECEIVED_LAST_DATAOUT; 2430 cmd->i_state = ISTATE_RECEIVED_LAST_DATAOUT;
@@ -2559,11 +2556,11 @@ static int iscsit_send_data_in(
2559 /* 2556 /*
2560 * Be paranoid and double check the logic for now. 2557 * Be paranoid and double check the logic for now.
2561 */ 2558 */
2562 if ((datain.offset + datain.length) > cmd->data_length) { 2559 if ((datain.offset + datain.length) > cmd->se_cmd.data_length) {
2563 pr_err("Command ITT: 0x%08x, datain.offset: %u and" 2560 pr_err("Command ITT: 0x%08x, datain.offset: %u and"
2564 " datain.length: %u exceeds cmd->data_length: %u\n", 2561 " datain.length: %u exceeds cmd->data_length: %u\n",
2565 cmd->init_task_tag, datain.offset, datain.length, 2562 cmd->init_task_tag, datain.offset, datain.length,
2566 cmd->data_length); 2563 cmd->se_cmd.data_length);
2567 return -1; 2564 return -1;
2568 } 2565 }
2569 2566
@@ -3071,8 +3068,8 @@ int iscsit_build_r2ts_for_cmd(
3071 conn->sess->sess_ops->MaxBurstLength - 3068 conn->sess->sess_ops->MaxBurstLength -
3072 cmd->next_burst_len; 3069 cmd->next_burst_len;
3073 3070
3074 if (new_data_end > cmd->data_length) 3071 if (new_data_end > cmd->se_cmd.data_length)
3075 xfer_len = cmd->data_length - offset; 3072 xfer_len = cmd->se_cmd.data_length - offset;
3076 else 3073 else
3077 xfer_len = 3074 xfer_len =
3078 conn->sess->sess_ops->MaxBurstLength - 3075 conn->sess->sess_ops->MaxBurstLength -
@@ -3081,14 +3078,14 @@ int iscsit_build_r2ts_for_cmd(
3081 int new_data_end = offset + 3078 int new_data_end = offset +
3082 conn->sess->sess_ops->MaxBurstLength; 3079 conn->sess->sess_ops->MaxBurstLength;
3083 3080
3084 if (new_data_end > cmd->data_length) 3081 if (new_data_end > cmd->se_cmd.data_length)
3085 xfer_len = cmd->data_length - offset; 3082 xfer_len = cmd->se_cmd.data_length - offset;
3086 else 3083 else
3087 xfer_len = conn->sess->sess_ops->MaxBurstLength; 3084 xfer_len = conn->sess->sess_ops->MaxBurstLength;
3088 } 3085 }
3089 cmd->r2t_offset += xfer_len; 3086 cmd->r2t_offset += xfer_len;
3090 3087
3091 if (cmd->r2t_offset == cmd->data_length) 3088 if (cmd->r2t_offset == cmd->se_cmd.data_length)
3092 cmd->cmd_flags |= ICF_SENT_LAST_R2T; 3089 cmd->cmd_flags |= ICF_SENT_LAST_R2T;
3093 } else { 3090 } else {
3094 struct iscsi_seq *seq; 3091 struct iscsi_seq *seq;