Cleanup: rename to payload_* the PDU variables used to track writing to socket
This commit is contained in:
@@ -224,9 +224,9 @@ struct iscsi_pdu {
|
||||
struct iscsi_data outdata; /* Header for PDU to send */
|
||||
size_t outdata_written; /* How much of the header we have written */
|
||||
|
||||
uint32_t out_offset; /* Offset into data-out iovector */
|
||||
uint32_t out_len; /* Amount of data to sent starting at out_offset */
|
||||
uint32_t out_written; /* Number of bytes written to socket */
|
||||
uint32_t payload_offset; /* Offset of payload data to write */
|
||||
uint32_t payload_len; /* Amount of payload data to write */
|
||||
uint32_t payload_written; /* How much of the payload we have written */
|
||||
|
||||
struct iscsi_data indata;
|
||||
|
||||
|
||||
@@ -344,7 +344,7 @@ try_again:
|
||||
iscsi->statsn++;
|
||||
|
||||
pdu->outdata_written = 0;
|
||||
pdu->out_written = 0;
|
||||
pdu->payload_written = 0;
|
||||
iscsi_add_to_outqueue(iscsi, pdu);
|
||||
}
|
||||
|
||||
|
||||
@@ -121,11 +121,11 @@ iscsi_send_data_out(struct iscsi_context *iscsi, struct iscsi_pdu *cmd_pdu,
|
||||
/* buffer offset */
|
||||
iscsi_pdu_set_bufferoffset(pdu, offset);
|
||||
|
||||
pdu->out_offset = offset;
|
||||
pdu->out_len = len;
|
||||
pdu->payload_offset = offset;
|
||||
pdu->payload_len = len;
|
||||
|
||||
/* update data segment length */
|
||||
scsi_set_uint32(&pdu->outdata.data[4], pdu->out_len);
|
||||
scsi_set_uint32(&pdu->outdata.data[4], pdu->payload_len);
|
||||
|
||||
pdu->callback = cmd_pdu->callback;
|
||||
pdu->private_data = cmd_pdu->private_data;
|
||||
@@ -237,8 +237,8 @@ iscsi_scsi_command_async(struct iscsi_context *iscsi, int lun,
|
||||
pdu->scsi_cbdata.callback = cb;
|
||||
pdu->scsi_cbdata.private_data = private_data;
|
||||
|
||||
pdu->out_offset = 0;
|
||||
pdu->out_len = 0;
|
||||
pdu->payload_offset = 0;
|
||||
pdu->payload_len = 0;
|
||||
|
||||
scsi_set_task_private_ptr(task, &pdu->scsi_cbdata);
|
||||
|
||||
@@ -265,11 +265,11 @@ iscsi_scsi_command_async(struct iscsi_context *iscsi, int lun,
|
||||
len = iscsi->target_max_recv_data_segment_length;
|
||||
}
|
||||
|
||||
pdu->out_offset = 0;
|
||||
pdu->out_len = len;
|
||||
pdu->payload_offset = 0;
|
||||
pdu->payload_len = len;
|
||||
|
||||
/* update data segment length */
|
||||
scsi_set_uint32(&pdu->outdata.data[4], pdu->out_len);
|
||||
scsi_set_uint32(&pdu->outdata.data[4], pdu->payload_len);
|
||||
}
|
||||
/* We have (more) data to send and we are allowed to send
|
||||
* it as unsolicited data-out segments.
|
||||
@@ -277,8 +277,8 @@ iscsi_scsi_command_async(struct iscsi_context *iscsi, int lun,
|
||||
* of data-out further below.
|
||||
*/
|
||||
if (iscsi->use_initial_r2t == ISCSI_INITIAL_R2T_NO
|
||||
&& pdu->out_len < (uint32_t)task->expxferlen
|
||||
&& pdu->out_len < iscsi->first_burst_length) {
|
||||
&& pdu->payload_len < (uint32_t)task->expxferlen
|
||||
&& pdu->payload_len < iscsi->first_burst_length) {
|
||||
/* We have more data to send, and we are allowed to send
|
||||
* unsolicited data, so dont flag this PDU as final.
|
||||
*/
|
||||
@@ -324,11 +324,11 @@ iscsi_scsi_command_async(struct iscsi_context *iscsi, int lun,
|
||||
if (!(flags & ISCSI_PDU_SCSI_FINAL)) {
|
||||
uint32_t len = task->expxferlen;
|
||||
|
||||
if (len + pdu->out_len > iscsi->first_burst_length) {
|
||||
len = iscsi->first_burst_length - pdu->out_len;
|
||||
if (len + pdu->payload_len > iscsi->first_burst_length) {
|
||||
len = iscsi->first_burst_length - pdu->payload_len;
|
||||
}
|
||||
iscsi_send_data_out(iscsi, pdu, 0xffffffff,
|
||||
pdu->out_len, len);
|
||||
pdu->payload_len, len);
|
||||
}
|
||||
|
||||
/* remember cmdsn and itt so we can use task management */
|
||||
|
||||
10
lib/socket.c
10
lib/socket.c
@@ -638,7 +638,7 @@ iscsi_write_to_socket(struct iscsi_context *iscsi)
|
||||
}
|
||||
|
||||
/* Write any iovectors that might have been passed to us */
|
||||
while (pdu->out_written < pdu->out_len) {
|
||||
while (pdu->payload_written < pdu->payload_len) {
|
||||
struct scsi_iovector* iovector_out;
|
||||
|
||||
iovector_out = iscsi_get_scsi_task_iovector_out(iscsi, pdu);
|
||||
@@ -648,8 +648,10 @@ iscsi_write_to_socket(struct iscsi_context *iscsi)
|
||||
return -1;
|
||||
}
|
||||
|
||||
count = iscsi_iovector_readv_writev(iscsi, iovector_out, pdu->out_offset + pdu->out_written, pdu->out_len - pdu->out_written, 1);
|
||||
|
||||
count = iscsi_iovector_readv_writev(iscsi,
|
||||
iovector_out,
|
||||
pdu->payload_offset + pdu->payload_written,
|
||||
pdu->payload_len - pdu->payload_written, 1);
|
||||
if (count == -1) {
|
||||
if (errno == EAGAIN || errno == EWOULDBLOCK) {
|
||||
return 0;
|
||||
@@ -659,7 +661,7 @@ iscsi_write_to_socket(struct iscsi_context *iscsi)
|
||||
return -1;
|
||||
}
|
||||
|
||||
pdu->out_written += count;
|
||||
pdu->payload_written += count;
|
||||
}
|
||||
|
||||
if (pdu->flags & ISCSI_PDU_DELETE_WHEN_SENT) {
|
||||
|
||||
Reference in New Issue
Block a user