lib/iscsi: Factor out submitting write subtask for Data-OUT PDU
This will be helpful to simplify the upcoming change. Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: I1f170fe48d2ec1b5ea05da6a8aa3589060c5c32d Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6438 Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
b3a3e78a86
commit
3685228e72
@ -4270,10 +4270,37 @@ 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)
|
||||
{
|
||||
struct spdk_iscsi_task *task, *subtask;
|
||||
struct spdk_iscsi_task *task;
|
||||
struct iscsi_bhs_data_out *reqh;
|
||||
struct spdk_mobj *mobj;
|
||||
uint32_t transfer_tag;
|
||||
@ -4296,25 +4323,7 @@ iscsi_pdu_payload_op_data(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *p
|
||||
mobj = pdu->mobj;
|
||||
assert(mobj != NULL);
|
||||
|
||||
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;
|
||||
return iscsi_submit_write_subtask(conn, task, pdu, mobj);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user