iscsi: Move up iscsi_submit_write_subtask() in a file

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I27cf8f7787a0acbc7142b3c472fe6732c0b8e3a9
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9705
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Shuhei Matsumoto 2021-09-29 12:27:58 +09:00 committed by Jim Harris
parent eb739d0364
commit fe08d83716

View File

@ -3258,6 +3258,33 @@ iscsi_pdu_payload_op_scsi_read(struct spdk_iscsi_conn *conn, struct spdk_iscsi_t
}
}
static int
iscsi_submit_write_subtask(struct spdk_iscsi_conn *conn, struct spdk_iscsi_task *task,
struct spdk_iscsi_pdu *pdu, struct spdk_mobj *mobj)
{
struct spdk_iscsi_task *subtask;
subtask = iscsi_task_get(conn, task, iscsi_task_cpl);
if (subtask == NULL) {
SPDK_ERRLOG("Unable to acquire subtask\n");
return SPDK_ISCSI_CONNECTION_FATAL;
}
subtask->scsi.offset = task->current_data_offset;
subtask->scsi.length = mobj->data_len;
iscsi_task_associate_pdu(subtask, pdu);
task->current_data_offset += mobj->data_len;
if (spdk_likely(!pdu->dif_insert_or_strip)) {
spdk_scsi_task_set_data(&subtask->scsi, mobj->buf, mobj->data_len);
} else {
spdk_scsi_task_set_data(&subtask->scsi, mobj->buf, pdu->data_buf_len);
}
iscsi_queue_task(conn, subtask);
return 0;
}
static int
iscsi_pdu_payload_op_scsi_write(struct spdk_iscsi_conn *conn, struct spdk_iscsi_task *task)
{
@ -4279,33 +4306,6 @@ iscsi_pdu_hdr_op_data(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
return 0;
}
static int
iscsi_submit_write_subtask(struct spdk_iscsi_conn *conn, struct spdk_iscsi_task *task,
struct spdk_iscsi_pdu *pdu, struct spdk_mobj *mobj)
{
struct spdk_iscsi_task *subtask;
subtask = iscsi_task_get(conn, task, iscsi_task_cpl);
if (subtask == NULL) {
SPDK_ERRLOG("Unable to acquire subtask\n");
return SPDK_ISCSI_CONNECTION_FATAL;
}
subtask->scsi.offset = task->current_data_offset;
subtask->scsi.length = mobj->data_len;
iscsi_task_associate_pdu(subtask, pdu);
task->current_data_offset += mobj->data_len;
if (spdk_likely(!pdu->dif_insert_or_strip)) {
spdk_scsi_task_set_data(&subtask->scsi, mobj->buf, mobj->data_len);
} else {
spdk_scsi_task_set_data(&subtask->scsi, mobj->buf, pdu->data_buf_len);
}
iscsi_queue_task(conn, subtask);
return 0;
}
static int
iscsi_pdu_payload_op_data(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
{