scsi: move bytes_completed to iSCSI task

Change-Id: Iff345f555f94a34fa4a6f86bc11efea704e39735
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2017-05-03 14:46:35 -07:00
parent 7e7ed7ec10
commit 2621c7bdc4
4 changed files with 11 additions and 10 deletions

View File

@ -109,8 +109,6 @@ struct spdk_scsi_task {
uint32_t ref;
uint32_t transfer_len;
uint32_t dxfer_dir;
/* Only valid for Read/Write */
uint32_t bytes_completed;
uint32_t length;
/**

View File

@ -872,9 +872,9 @@ process_completed_read_subtask_list(struct spdk_iscsi_conn *conn,
while (!TAILQ_EMPTY(&primary->subtask_list)) {
tmp = TAILQ_FIRST(&primary->subtask_list);
if (tmp->scsi.offset == primary->scsi.bytes_completed) {
if (tmp->scsi.offset == primary->bytes_completed) {
TAILQ_REMOVE(&primary->subtask_list, tmp, subtask_link);
primary->scsi.bytes_completed += tmp->scsi.length;
primary->bytes_completed += tmp->scsi.length;
spdk_iscsi_task_response(conn, tmp);
spdk_iscsi_task_put(tmp);
} else {
@ -892,7 +892,7 @@ process_read_task_completion(struct spdk_iscsi_conn *conn,
bool flag = false;
if ((task != primary) &&
(task->scsi.offset != primary->scsi.bytes_completed)) {
(task->scsi.offset != primary->bytes_completed)) {
TAILQ_FOREACH(tmp, &primary->subtask_list, link) {
if (task->scsi.offset < tmp->scsi.offset) {
TAILQ_INSERT_BEFORE(tmp, task, subtask_link);
@ -906,7 +906,7 @@ process_read_task_completion(struct spdk_iscsi_conn *conn,
return;
}
primary->scsi.bytes_completed += task->scsi.length;
primary->bytes_completed += task->scsi.length;
spdk_iscsi_task_response(conn, task);
if ((task != primary) ||
@ -931,7 +931,7 @@ void process_task_completion(void *arg1, void *arg2)
if (spdk_iscsi_task_is_read(primary)) {
process_read_task_completion(conn, task, primary);
} else {
primary->scsi.bytes_completed += task->scsi.length;
primary->bytes_completed += task->scsi.length;
if ((task != primary) &&
(task->scsi.status != SPDK_SCSI_STATUS_GOOD)) {
memcpy(primary->scsi.sense_data, task->scsi.sense_data,
@ -940,7 +940,7 @@ void process_task_completion(void *arg1, void *arg2)
primary->scsi.status = task->scsi.status;
}
if (primary->scsi.bytes_completed == primary->scsi.transfer_len) {
if (primary->bytes_completed == primary->scsi.transfer_len) {
spdk_del_transfer_task(conn, primary->tag);
spdk_iscsi_task_response(conn, primary);
/*

View File

@ -2784,7 +2784,7 @@ spdk_iscsi_transfer_in(struct spdk_iscsi_conn *conn,
case SPDK_SCSI_STATUS_INTERMEDIATE_CONDITION_MET:
/* The last pdu in all data-in pdus */
if ((offset + len) == transfer_len &&
(primary->scsi.bytes_completed ==
(primary->bytes_completed ==
primary->scsi.transfer_len)) {
datain_flag |= ISCSI_DATAIN_STATUS;
sent_status = 1;
@ -3137,7 +3137,7 @@ void spdk_iscsi_task_response(struct spdk_iscsi_conn *conn,
return;
}
if (primary->scsi.bytes_completed != primary->scsi.transfer_len)
if (primary->bytes_completed != primary->scsi.transfer_len)
return;
}

View File

@ -46,6 +46,9 @@ struct spdk_iscsi_task {
uint32_t desired_data_transfer_length;
/* Only valid for Read/Write */
uint32_t bytes_completed;
uint32_t data_out_cnt;
/*