Skip to content

Commit

Permalink
iscsi: Move up iscsi_submit_write_subtask() in a file
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Shuhei Matsumoto authored and jimharris committed Nov 11, 2021
1 parent eb739d0 commit fe08d83
Showing 1 changed file with 27 additions and 27 deletions.
54 changes: 27 additions & 27 deletions lib/iscsi/iscsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)
{
Expand Down

0 comments on commit fe08d83

Please sign in to comment.