diff --git a/include/spdk/scsi.h b/include/spdk/scsi.h index 313a3d5b1c..54a4cd30a2 100644 --- a/include/spdk/scsi.h +++ b/include/spdk/scsi.h @@ -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; /** diff --git a/lib/iscsi/conn.c b/lib/iscsi/conn.c index b6910cfd38..5c6c1b5631 100644 --- a/lib/iscsi/conn.c +++ b/lib/iscsi/conn.c @@ -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); /* diff --git a/lib/iscsi/iscsi.c b/lib/iscsi/iscsi.c index 0fd9898401..20473d727a 100644 --- a/lib/iscsi/iscsi.c +++ b/lib/iscsi/iscsi.c @@ -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; } diff --git a/lib/iscsi/task.h b/lib/iscsi/task.h index 4d680c1781..d01a0933bf 100644 --- a/lib/iscsi/task.h +++ b/lib/iscsi/task.h @@ -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; /*