iscsi: Use iscsi_submit_write_subtask() for immediate data

This clean up will make the following patches easier.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I1ad288ec16aec69a168e0f3019b68e11132b65c9
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9707
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Shuhei Matsumoto 2021-09-29 13:59:33 +09:00 committed by Tomasz Zawadzki
parent f72cab94dd
commit a9be1b9b7b

View File

@ -3290,8 +3290,6 @@ iscsi_pdu_payload_op_scsi_write(struct spdk_iscsi_conn *conn, struct spdk_iscsi_
struct spdk_iscsi_pdu *pdu;
struct iscsi_bhs_scsi_req *reqh;
uint32_t transfer_len;
uint32_t scsi_data_len;
struct spdk_iscsi_task *subtask;
int rc;
pdu = iscsi_task_get_pdu(task);
@ -3299,12 +3297,6 @@ iscsi_pdu_payload_op_scsi_write(struct spdk_iscsi_conn *conn, struct spdk_iscsi_
transfer_len = task->scsi.transfer_len;
if (spdk_likely(!pdu->dif_insert_or_strip)) {
scsi_data_len = pdu->data_segment_len;
} else {
scsi_data_len = pdu->data_buf_len;
}
if (reqh->final_bit &&
pdu->data_segment_len < transfer_len) {
/* needs R2T */
@ -3318,23 +3310,22 @@ iscsi_pdu_payload_op_scsi_write(struct spdk_iscsi_conn *conn, struct spdk_iscsi_
/* Non-immediate writes */
if (pdu->data_segment_len != 0) {
/* we are doing the first partial write task */
subtask = iscsi_task_get(conn, task, iscsi_task_cpl);
assert(subtask != NULL);
spdk_scsi_task_set_data(&subtask->scsi, pdu->data, scsi_data_len);
subtask->scsi.length = pdu->data_segment_len;
iscsi_task_associate_pdu(subtask, pdu);
task->current_data_offset = pdu->data_segment_len;
iscsi_queue_task(conn, subtask);
rc = iscsi_submit_write_subtask(conn, task, pdu, pdu->mobj[0]);
if (rc < 0) {
iscsi_task_put(task);
return SPDK_ISCSI_CONNECTION_FATAL;
}
}
return 0;
}
if (pdu->data_segment_len == transfer_len) {
/* we are doing small writes with no R2T */
spdk_scsi_task_set_data(&task->scsi, pdu->data, scsi_data_len);
if (spdk_likely(!pdu->dif_insert_or_strip)) {
spdk_scsi_task_set_data(&task->scsi, pdu->data, pdu->data_segment_len);
} else {
spdk_scsi_task_set_data(&task->scsi, pdu->data, pdu->data_buf_len);
}
task->scsi.length = transfer_len;
}