lib/iscsi: Remove the "spdk_" prefix from internal APIs declared in task.h

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I746660725f013df93b56ea89d11783ee5c568609
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1884
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Seth Howell <seth.howell@intel.com>
This commit is contained in:
Shuhei Matsumoto 2020-04-16 05:30:47 +09:00 committed by Tomasz Zawadzki
parent be05a8208d
commit 356cb2332c
9 changed files with 123 additions and 123 deletions

View File

@ -325,7 +325,7 @@ spdk_iscsi_conn_free_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pd
pdu->cb_fn = NULL;
if (pdu->task) {
spdk_iscsi_task_put(pdu->task);
iscsi_task_put(pdu->task);
}
spdk_put_pdu(pdu);
@ -346,7 +346,7 @@ iscsi_conn_free_tasks(struct spdk_iscsi_conn *conn)
TAILQ_FOREACH_SAFE(iscsi_task, &conn->queued_datain_tasks, link, tmp_iscsi_task) {
if (!iscsi_task->is_queued) {
TAILQ_REMOVE(&conn->queued_datain_tasks, iscsi_task, link);
spdk_iscsi_task_put(iscsi_task);
iscsi_task_put(iscsi_task);
}
}
@ -730,7 +730,7 @@ spdk_iscsi_conn_destruct(struct spdk_iscsi_conn *conn)
break;
default:
SPDK_ERRLOG("unexpected opcode %x\n", opcode);
spdk_iscsi_task_put(task);
iscsi_task_put(task);
break;
}
}
@ -981,7 +981,7 @@ _iscsi_conn_abort_queued_datain_task(struct spdk_iscsi_conn *conn,
/* Stop split and abort read I/O for remaining data. */
if (task->current_datain_offset < task->scsi.transfer_len) {
remaining_size = task->scsi.transfer_len - task->current_datain_offset;
subtask = spdk_iscsi_task_get(conn, task, spdk_iscsi_task_cpl);
subtask = iscsi_task_get(conn, task, spdk_iscsi_task_cpl);
assert(subtask != NULL);
subtask->scsi.offset = task->current_datain_offset;
subtask->scsi.length = remaining_size;
@ -1026,7 +1026,7 @@ spdk_iscsi_conn_abort_queued_datain_tasks(struct spdk_iscsi_conn *conn,
int rc;
TAILQ_FOREACH_SAFE(task, &conn->queued_datain_tasks, link, task_tmp) {
pdu_tmp = spdk_iscsi_task_get_pdu(task);
pdu_tmp = iscsi_task_get_pdu(task);
if ((lun == NULL || lun == task->scsi.lun) &&
(pdu == NULL || (spdk_sn32_lt(pdu_tmp->cmd_sn, pdu->cmd_sn)))) {
rc = _iscsi_conn_abort_queued_datain_task(conn, task);
@ -1053,7 +1053,7 @@ spdk_iscsi_conn_handle_queued_datain_tasks(struct spdk_iscsi_conn *conn)
uint32_t remaining_size = 0;
remaining_size = task->scsi.transfer_len - task->current_datain_offset;
subtask = spdk_iscsi_task_get(conn, task, spdk_iscsi_task_cpl);
subtask = iscsi_task_get(conn, task, spdk_iscsi_task_cpl);
assert(subtask != NULL);
subtask->scsi.offset = task->current_datain_offset;
spdk_scsi_task_set_data(&subtask->scsi, NULL, 0);
@ -1083,10 +1083,10 @@ spdk_iscsi_conn_handle_queued_datain_tasks(struct spdk_iscsi_conn *conn)
void
spdk_iscsi_task_mgmt_cpl(struct spdk_scsi_task *scsi_task)
{
struct spdk_iscsi_task *task = spdk_iscsi_task_from_scsi_task(scsi_task);
struct spdk_iscsi_task *task = iscsi_task_from_scsi_task(scsi_task);
spdk_iscsi_task_mgmt_response(task->conn, task);
spdk_iscsi_task_put(task);
iscsi_task_put(task);
}
static void
@ -1119,14 +1119,14 @@ process_completed_read_subtask_list(struct spdk_iscsi_conn *conn,
TAILQ_REMOVE(&primary->subtask_list, subtask, subtask_link);
primary->bytes_completed += subtask->scsi.length;
spdk_iscsi_task_response(conn, subtask);
spdk_iscsi_task_put(subtask);
iscsi_task_put(subtask);
} else {
break;
}
}
if (primary->bytes_completed == primary->scsi.transfer_len) {
spdk_iscsi_task_put(primary);
iscsi_task_put(primary);
}
}
@ -1161,7 +1161,7 @@ process_read_task_completion(struct spdk_iscsi_conn *conn,
/* For non split read I/O */
assert(primary->bytes_completed == task->scsi.transfer_len);
spdk_iscsi_task_response(conn, task);
spdk_iscsi_task_put(task);
iscsi_task_put(task);
} else {
if (task->scsi.offset != primary->bytes_completed) {
TAILQ_FOREACH(tmp, &primary->subtask_list, subtask_link) {
@ -1226,29 +1226,29 @@ process_non_read_task_completion(struct spdk_iscsi_conn *conn,
spdk_iscsi_task_response(conn, primary);
TAILQ_REMOVE(&conn->active_r2t_tasks, primary, link);
primary->is_r2t_active = false;
spdk_iscsi_task_put(primary);
iscsi_task_put(primary);
}
} else {
spdk_iscsi_task_response(conn, task);
}
}
spdk_iscsi_task_put(task);
iscsi_task_put(task);
}
void
spdk_iscsi_task_cpl(struct spdk_scsi_task *scsi_task)
{
struct spdk_iscsi_task *primary;
struct spdk_iscsi_task *task = spdk_iscsi_task_from_scsi_task(scsi_task);
struct spdk_iscsi_task *task = iscsi_task_from_scsi_task(scsi_task);
struct spdk_iscsi_conn *conn = task->conn;
struct spdk_iscsi_pdu *pdu = task->pdu;
spdk_trace_record(TRACE_ISCSI_TASK_DONE, conn->id, 0, (uintptr_t)task, 0);
task->is_queued = false;
primary = spdk_iscsi_task_get_primary(task);
primary = iscsi_task_get_primary(task);
if (spdk_iscsi_task_is_read(primary)) {
if (iscsi_task_is_read(primary)) {
process_read_task_completion(conn, task, primary);
} else {
process_non_read_task_completion(conn, task, primary);

View File

@ -2743,7 +2743,7 @@ add_transfer_task(struct spdk_iscsi_conn *conn, struct spdk_iscsi_task *task)
int data_out_req;
transfer_len = task->scsi.transfer_len;
data_len = spdk_iscsi_task_get_pdu(task)->data_segment_len;
data_len = iscsi_task_get_pdu(task)->data_segment_len;
max_burst_len = conn->sess->MaxBurstLength;
segment_len = SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH;
data_out_req = 1 + (transfer_len - data_len - 1) / segment_len;
@ -2854,7 +2854,7 @@ del_connection_queued_task(struct spdk_iscsi_conn *conn, void *tailq,
head = (struct queued_tasks *)tailq;
TAILQ_FOREACH_SAFE(task, head, link, task_tmp) {
pdu_tmp = spdk_iscsi_task_get_pdu(task);
pdu_tmp = iscsi_task_get_pdu(task);
if ((lun == NULL || lun == task->scsi.lun) &&
(pdu == NULL || spdk_sn32_lt(pdu_tmp->cmd_sn, pdu->cmd_sn))) {
TAILQ_REMOVE(head, task, link);
@ -2863,7 +2863,7 @@ del_connection_queued_task(struct spdk_iscsi_conn *conn, void *tailq,
spdk_scsi_task_process_null_lun(&task->scsi);
spdk_iscsi_task_response(conn, task);
}
spdk_iscsi_task_put(task);
iscsi_task_put(task);
}
}
}
@ -2879,7 +2879,7 @@ void spdk_clear_all_transfer_task(struct spdk_iscsi_conn *conn,
pending_r2t = conn->pending_r2t;
for (i = 0; i < pending_r2t; i++) {
task = conn->outstanding_r2t_tasks[i];
pdu_tmp = spdk_iscsi_task_get_pdu(task);
pdu_tmp = iscsi_task_get_pdu(task);
if ((lun == NULL || lun == task->scsi.lun) &&
(pdu == NULL || spdk_sn32_lt(pdu_tmp->cmd_sn, pdu->cmd_sn))) {
conn->outstanding_r2t_tasks[i] = NULL;
@ -2946,7 +2946,7 @@ iscsi_send_datain(struct spdk_iscsi_conn *conn,
struct spdk_iscsi_task *primary;
struct spdk_scsi_lun *lun_dev;
primary = spdk_iscsi_task_get_primary(task);
primary = iscsi_task_get_primary(task);
/* DATA PDU */
rsp_pdu = spdk_get_pdu(conn);
@ -3003,7 +3003,7 @@ iscsi_send_datain(struct spdk_iscsi_conn *conn,
conn->StatSN++;
}
if (F_bit && S_bit && !spdk_iscsi_task_is_immediate(primary)) {
if (F_bit && S_bit && !iscsi_task_is_immediate(primary)) {
conn->sess->MaxCmdSN++;
}
@ -3057,7 +3057,7 @@ iscsi_transfer_in(struct spdk_iscsi_conn *conn, struct spdk_iscsi_task *task)
uint32_t sequence_end;
struct spdk_iscsi_task *primary;
primary = spdk_iscsi_task_get_primary(task);
primary = iscsi_task_get_primary(task);
segment_len = conn->MaxRecvDataSegmentLength;
data_len = task->scsi.data_transferred;
transfer_len = task->scsi.length;
@ -3143,14 +3143,14 @@ void spdk_iscsi_task_response(struct spdk_iscsi_conn *conn,
int rc;
struct spdk_iscsi_task *primary;
primary = spdk_iscsi_task_get_primary(task);
primary = iscsi_task_get_primary(task);
transfer_len = primary->scsi.transfer_len;
task_tag = task->tag;
/* transfer data from logical unit */
/* (direction is view of initiator side) */
if (spdk_iscsi_task_is_read(primary)) {
if (iscsi_task_is_read(primary)) {
rc = iscsi_transfer_in(conn, task);
if (rc > 0) {
/* sent status by last DATAIN PDU */
@ -3221,7 +3221,7 @@ void spdk_iscsi_task_response(struct spdk_iscsi_conn *conn,
to_be32(&rsph->stat_sn, conn->StatSN);
conn->StatSN++;
if (!spdk_iscsi_task_is_immediate(primary)) {
if (!iscsi_task_is_immediate(primary)) {
conn->sess->MaxCmdSN++;
}
@ -3245,13 +3245,13 @@ iscsi_compare_pdu_bhs_within_existed_r2t_tasks(struct spdk_iscsi_conn *conn,
struct spdk_iscsi_task *task;
TAILQ_FOREACH(task, &conn->active_r2t_tasks, link) {
if (!memcmp(&pdu->bhs, spdk_iscsi_task_get_bhs(task), ISCSI_BHS_LEN)) {
if (!memcmp(&pdu->bhs, iscsi_task_get_bhs(task), ISCSI_BHS_LEN)) {
return true;
}
}
TAILQ_FOREACH(task, &conn->queued_r2t_tasks, link) {
if (!memcmp(&pdu->bhs, spdk_iscsi_task_get_bhs(task), ISCSI_BHS_LEN)) {
if (!memcmp(&pdu->bhs, iscsi_task_get_bhs(task), ISCSI_BHS_LEN)) {
return true;
}
}
@ -3297,7 +3297,7 @@ iscsi_pdu_payload_op_scsi_write(struct spdk_iscsi_conn *conn, struct spdk_iscsi_
uint32_t scsi_data_len;
int rc;
pdu = spdk_iscsi_task_get_pdu(task);
pdu = iscsi_task_get_pdu(task);
reqh = (struct iscsi_bhs_scsi_req *)&pdu->bhs;
transfer_len = task->scsi.transfer_len;
@ -3314,7 +3314,7 @@ iscsi_pdu_payload_op_scsi_write(struct spdk_iscsi_conn *conn, struct spdk_iscsi_
rc = add_transfer_task(conn, task);
if (rc < 0) {
SPDK_ERRLOG("add_transfer_task() failed\n");
spdk_iscsi_task_put(task);
iscsi_task_put(task);
return SPDK_ISCSI_CONNECTION_FATAL;
}
@ -3368,13 +3368,13 @@ iscsi_pdu_hdr_op_scsi(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
SPDK_LOGDUMP(SPDK_LOG_ISCSI, "CDB", cdb, 16);
task = spdk_iscsi_task_get(conn, NULL, spdk_iscsi_task_cpl);
task = iscsi_task_get(conn, NULL, spdk_iscsi_task_cpl);
if (!task) {
SPDK_ERRLOG("Unable to acquire task\n");
return SPDK_ISCSI_CONNECTION_FATAL;
}
spdk_iscsi_task_associate_pdu(task, pdu);
iscsi_task_associate_pdu(task, pdu);
lun_i = spdk_scsi_lun_id_fmt_to_int(lun);
task->lun_id = lun_i;
dev = conn->dev;
@ -3382,7 +3382,7 @@ iscsi_pdu_hdr_op_scsi(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
if ((R_bit != 0) && (W_bit != 0)) {
SPDK_ERRLOG("Bidirectional CDB is not supported\n");
spdk_iscsi_task_put(task);
iscsi_task_put(task);
return SPDK_ISCSI_CONNECTION_FATAL;
}
@ -3409,28 +3409,28 @@ iscsi_pdu_hdr_op_scsi(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
if ((conn->sess->ErrorRecoveryLevel >= 1) &&
(iscsi_compare_pdu_bhs_within_existed_r2t_tasks(conn, pdu))) {
spdk_iscsi_task_response(conn, task);
spdk_iscsi_task_put(task);
iscsi_task_put(task);
return 0;
}
if (pdu->data_segment_len > spdk_get_max_immediate_data_size()) {
SPDK_ERRLOG("data segment len(=%zu) > immediate data len(=%"PRIu32")\n",
pdu->data_segment_len, spdk_get_max_immediate_data_size());
spdk_iscsi_task_put(task);
iscsi_task_put(task);
return iscsi_reject(conn, pdu, ISCSI_REASON_PROTOCOL_ERROR);
}
if (pdu->data_segment_len > transfer_len) {
SPDK_ERRLOG("data segment len(=%zu) > task transfer len(=%d)\n",
pdu->data_segment_len, transfer_len);
spdk_iscsi_task_put(task);
iscsi_task_put(task);
return iscsi_reject(conn, pdu, ISCSI_REASON_PROTOCOL_ERROR);
}
/* check the ImmediateData and also pdu->data_segment_len */
if ((!conn->sess->ImmediateData && (pdu->data_segment_len > 0)) ||
(pdu->data_segment_len > conn->sess->FirstBurstLength)) {
spdk_iscsi_task_put(task);
iscsi_task_put(task);
return iscsi_reject(conn, pdu, ISCSI_REASON_PROTOCOL_ERROR);
}
@ -3441,7 +3441,7 @@ iscsi_pdu_hdr_op_scsi(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
/* neither R nor W bit set */
task->scsi.dxfer_dir = SPDK_SCSI_DIR_NONE;
if (transfer_len > 0) {
spdk_iscsi_task_put(task);
iscsi_task_put(task);
SPDK_ERRLOG("Reject scsi cmd with EDTL > 0 but (R | W) == 0\n");
return iscsi_reject(conn, pdu, ISCSI_REASON_INVALID_PDU_FIELD);
}
@ -3478,7 +3478,7 @@ iscsi_pdu_payload_op_scsi(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *p
return 0;
default:
assert(false);
spdk_iscsi_task_put(task);
iscsi_task_put(task);
break;
}
@ -3491,7 +3491,7 @@ abort_transfer_task_in_task_mgmt_resp(struct spdk_iscsi_conn *conn,
{
struct spdk_iscsi_pdu *pdu;
pdu = spdk_iscsi_task_get_pdu(task);
pdu = iscsi_task_get_pdu(task);
switch (task->scsi.function) {
/* abort task identified by Reference Task Tag field */
@ -3578,7 +3578,7 @@ iscsi_queue_mgmt_task(struct spdk_iscsi_conn *conn, struct spdk_iscsi_task *task
if (lun == NULL) {
task->scsi.response = SPDK_SCSI_TASK_MGMT_RESP_INVALID_LUN;
spdk_iscsi_task_mgmt_response(conn, task);
spdk_iscsi_task_put(task);
iscsi_task_put(task);
return;
}
@ -3665,13 +3665,13 @@ iscsi_pdu_hdr_op_task(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
lun_i = spdk_scsi_lun_id_fmt_to_int(lun);
dev = conn->dev;
task = spdk_iscsi_task_get(conn, NULL, spdk_iscsi_task_mgmt_cpl);
task = iscsi_task_get(conn, NULL, spdk_iscsi_task_mgmt_cpl);
if (!task) {
SPDK_ERRLOG("Unable to acquire task\n");
return SPDK_ISCSI_CONNECTION_FATAL;
}
spdk_iscsi_task_associate_pdu(task, pdu);
iscsi_task_associate_pdu(task, pdu);
task->scsi.target_port = conn->target_port;
task->scsi.initiator_port = conn->initiator_port;
task->tag = task_tag;
@ -3681,7 +3681,7 @@ iscsi_pdu_hdr_op_task(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
if (task->scsi.lun == NULL) {
task->scsi.response = SPDK_SCSI_TASK_MGMT_RESP_INVALID_LUN;
spdk_iscsi_task_mgmt_response(conn, task);
spdk_iscsi_task_put(task);
iscsi_task_put(task);
return 0;
}
@ -3759,7 +3759,7 @@ iscsi_pdu_hdr_op_task(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
}
spdk_iscsi_task_mgmt_response(conn, task);
spdk_iscsi_task_put(task);
iscsi_task_put(task);
return 0;
}
@ -3984,7 +3984,7 @@ iscsi_handle_recovery_datain(struct spdk_iscsi_conn *conn,
struct iscsi_bhs_data_in *datain_header;
uint32_t last_statsn;
task = spdk_iscsi_task_get_primary(task);
task = iscsi_task_get_primary(task);
SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "iscsi_handle_recovery_datain\n");
@ -4115,7 +4115,7 @@ iscsi_handle_data_ack(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
goto reject_return;
}
primary = spdk_iscsi_task_get_primary(task);
primary = iscsi_task_get_primary(task);
if ((run_length != 0) || (beg_run < primary->acked_data_sn)) {
SPDK_ERRLOG("TTT: 0x%08x Data ACK SNACK BegRUN: %d is less than "
"the next expected acked DataSN: %d\n",
@ -4306,14 +4306,14 @@ iscsi_pdu_hdr_op_data(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
task->current_r2t_length = 0;
}
subtask = spdk_iscsi_task_get(conn, task, spdk_iscsi_task_cpl);
subtask = iscsi_task_get(conn, task, spdk_iscsi_task_cpl);
if (subtask == NULL) {
SPDK_ERRLOG("Unable to acquire subtask\n");
return SPDK_ISCSI_CONNECTION_FATAL;
}
subtask->scsi.offset = buffer_offset;
subtask->scsi.length = pdu->data_segment_len;
spdk_iscsi_task_associate_pdu(subtask, pdu);
iscsi_task_associate_pdu(subtask, pdu);
if (task->next_expected_r2t_offset == transfer_len) {
task->acked_r2tsn++;

View File

@ -40,7 +40,7 @@
static void
iscsi_task_free(struct spdk_scsi_task *scsi_task)
{
struct spdk_iscsi_task *task = spdk_iscsi_task_from_scsi_task(scsi_task);
struct spdk_iscsi_task *task = iscsi_task_from_scsi_task(scsi_task);
if (task->parent) {
if (task->scsi.dxfer_dir == SPDK_SCSI_DIR_FROM_DEV) {
@ -52,15 +52,15 @@ iscsi_task_free(struct spdk_scsi_task *scsi_task)
task->parent = NULL;
}
spdk_iscsi_task_disassociate_pdu(task);
iscsi_task_disassociate_pdu(task);
assert(task->conn->pending_task_cnt > 0);
task->conn->pending_task_cnt--;
spdk_mempool_put(g_iscsi.task_pool, (void *)task);
}
struct spdk_iscsi_task *
spdk_iscsi_task_get(struct spdk_iscsi_conn *conn, struct spdk_iscsi_task *parent,
spdk_scsi_task_cpl cpl_fn)
iscsi_task_get(struct spdk_iscsi_conn *conn, struct spdk_iscsi_task *parent,
spdk_scsi_task_cpl cpl_fn)
{
struct spdk_iscsi_task *task;

View File

@ -108,75 +108,75 @@ struct spdk_iscsi_task {
};
static inline void
spdk_iscsi_task_put(struct spdk_iscsi_task *task)
iscsi_task_put(struct spdk_iscsi_task *task)
{
spdk_scsi_task_put(&task->scsi);
}
static inline struct spdk_iscsi_pdu *
spdk_iscsi_task_get_pdu(struct spdk_iscsi_task *task)
iscsi_task_get_pdu(struct spdk_iscsi_task *task)
{
return task->pdu;
}
static inline void
spdk_iscsi_task_set_pdu(struct spdk_iscsi_task *task, struct spdk_iscsi_pdu *pdu)
iscsi_task_set_pdu(struct spdk_iscsi_task *task, struct spdk_iscsi_pdu *pdu)
{
task->pdu = pdu;
}
static inline struct iscsi_bhs *
spdk_iscsi_task_get_bhs(struct spdk_iscsi_task *task)
iscsi_task_get_bhs(struct spdk_iscsi_task *task)
{
return &spdk_iscsi_task_get_pdu(task)->bhs;
return &iscsi_task_get_pdu(task)->bhs;
}
static inline void
spdk_iscsi_task_associate_pdu(struct spdk_iscsi_task *task, struct spdk_iscsi_pdu *pdu)
iscsi_task_associate_pdu(struct spdk_iscsi_task *task, struct spdk_iscsi_pdu *pdu)
{
spdk_iscsi_task_set_pdu(task, pdu);
iscsi_task_set_pdu(task, pdu);
pdu->ref++;
}
static inline void
spdk_iscsi_task_disassociate_pdu(struct spdk_iscsi_task *task)
iscsi_task_disassociate_pdu(struct spdk_iscsi_task *task)
{
if (spdk_iscsi_task_get_pdu(task)) {
spdk_put_pdu(spdk_iscsi_task_get_pdu(task));
spdk_iscsi_task_set_pdu(task, NULL);
if (iscsi_task_get_pdu(task)) {
spdk_put_pdu(iscsi_task_get_pdu(task));
iscsi_task_set_pdu(task, NULL);
}
}
static inline int
spdk_iscsi_task_is_immediate(struct spdk_iscsi_task *task)
iscsi_task_is_immediate(struct spdk_iscsi_task *task)
{
struct iscsi_bhs_scsi_req *scsi_req;
scsi_req = (struct iscsi_bhs_scsi_req *)spdk_iscsi_task_get_bhs(task);
scsi_req = (struct iscsi_bhs_scsi_req *)iscsi_task_get_bhs(task);
return (scsi_req->immediate == 1);
}
static inline int
spdk_iscsi_task_is_read(struct spdk_iscsi_task *task)
iscsi_task_is_read(struct spdk_iscsi_task *task)
{
struct iscsi_bhs_scsi_req *scsi_req;
scsi_req = (struct iscsi_bhs_scsi_req *)spdk_iscsi_task_get_bhs(task);
scsi_req = (struct iscsi_bhs_scsi_req *)iscsi_task_get_bhs(task);
return (scsi_req->read_bit == 1);
}
struct spdk_iscsi_task *spdk_iscsi_task_get(struct spdk_iscsi_conn *conn,
struct spdk_iscsi_task *parent,
spdk_scsi_task_cpl cpl_fn);
struct spdk_iscsi_task *iscsi_task_get(struct spdk_iscsi_conn *conn,
struct spdk_iscsi_task *parent,
spdk_scsi_task_cpl cpl_fn);
static inline struct spdk_iscsi_task *
spdk_iscsi_task_from_scsi_task(struct spdk_scsi_task *task)
iscsi_task_from_scsi_task(struct spdk_scsi_task *task)
{
return SPDK_CONTAINEROF(task, struct spdk_iscsi_task, scsi);
}
static inline struct spdk_iscsi_task *
spdk_iscsi_task_get_primary(struct spdk_iscsi_task *task)
iscsi_task_get_primary(struct spdk_iscsi_task *task)
{
if (task->parent) {
return task->parent;

View File

@ -1337,7 +1337,7 @@ spdk_iscsi_tgt_node_cleanup_luns(struct spdk_iscsi_conn *conn,
}
/* we create a fake management task per LUN to cleanup */
task = spdk_iscsi_task_get(conn, NULL, spdk_iscsi_task_mgmt_cpl);
task = iscsi_task_get(conn, NULL, spdk_iscsi_task_mgmt_cpl);
if (!task) {
SPDK_ERRLOG("Unable to acquire task\n");
return -1;

View File

@ -198,19 +198,19 @@ spdk_get_pdu(struct spdk_iscsi_conn *conn)
static void
iscsi_task_free(struct spdk_scsi_task *scsi_task)
{
struct spdk_iscsi_task *task = spdk_iscsi_task_from_scsi_task(scsi_task);
struct spdk_iscsi_task *task = iscsi_task_from_scsi_task(scsi_task);
assert(task->parent == NULL);
spdk_iscsi_task_disassociate_pdu(task);
iscsi_task_disassociate_pdu(task);
assert(task->conn->pending_task_cnt > 0);
task->conn->pending_task_cnt--;
free(task);
}
struct spdk_iscsi_task *
spdk_iscsi_task_get(struct spdk_iscsi_conn *conn, struct spdk_iscsi_task *parent,
spdk_scsi_task_cpl cpl_fn)
iscsi_task_get(struct spdk_iscsi_conn *conn, struct spdk_iscsi_task *parent,
spdk_scsi_task_cpl cpl_fn)
{
struct spdk_iscsi_task *task;

View File

@ -30,9 +30,9 @@ static bool g_task_pool_is_empty = false;
static bool g_pdu_pool_is_empty = false;
struct spdk_iscsi_task *
spdk_iscsi_task_get(struct spdk_iscsi_conn *conn,
struct spdk_iscsi_task *parent,
spdk_scsi_task_cpl cpl_fn)
iscsi_task_get(struct spdk_iscsi_conn *conn,
struct spdk_iscsi_task *parent,
spdk_scsi_task_cpl cpl_fn)
{
struct spdk_iscsi_task *task;
@ -171,7 +171,7 @@ spdk_iscsi_task_cpl(struct spdk_scsi_task *scsi_task)
struct spdk_iscsi_task *iscsi_task;
if (scsi_task != NULL) {
iscsi_task = spdk_iscsi_task_from_scsi_task(scsi_task);
iscsi_task = iscsi_task_from_scsi_task(scsi_task);
if (iscsi_task->parent && (iscsi_task->scsi.dxfer_dir == SPDK_SCSI_DIR_FROM_DEV)) {
assert(iscsi_task->conn->data_in_cnt > 0);
iscsi_task->conn->data_in_cnt--;

View File

@ -103,9 +103,9 @@ DEFINE_STUB(spdk_sock_group_remove_sock, int,
(struct spdk_sock_group *group, struct spdk_sock *sock), 0);
struct spdk_iscsi_task *
spdk_iscsi_task_get(struct spdk_iscsi_conn *conn,
struct spdk_iscsi_task *parent,
spdk_scsi_task_cpl cpl_fn)
iscsi_task_get(struct spdk_iscsi_conn *conn,
struct spdk_iscsi_task *parent,
spdk_scsi_task_cpl cpl_fn)
{
struct spdk_iscsi_task *task;
@ -140,7 +140,7 @@ spdk_scsi_task_put(struct spdk_scsi_task *scsi_task)
CU_ASSERT(scsi_task->ref > 0);
scsi_task->ref--;
task = spdk_iscsi_task_from_scsi_task(scsi_task);
task = iscsi_task_from_scsi_task(scsi_task);
if (task->parent) {
spdk_scsi_task_put(&task->parent->scsi);
}
@ -288,7 +288,7 @@ read_task_split_in_order_case(void)
SPDK_CU_ASSERT_FATAL(!TAILQ_EMPTY(&g_ut_read_tasks));
TAILQ_FOREACH(task, &g_ut_read_tasks, link) {
CU_ASSERT(&primary == spdk_iscsi_task_get_primary(task));
CU_ASSERT(&primary == iscsi_task_get_primary(task));
process_read_task_completion(NULL, task, &primary);
}
@ -319,7 +319,7 @@ read_task_split_reverse_order_case(void)
SPDK_CU_ASSERT_FATAL(!TAILQ_EMPTY(&g_ut_read_tasks));
TAILQ_FOREACH_REVERSE(task, &g_ut_read_tasks, read_tasks_head, link) {
CU_ASSERT(&primary == spdk_iscsi_task_get_primary(task));
CU_ASSERT(&primary == iscsi_task_get_primary(task));
process_read_task_completion(NULL, task, &primary);
}
@ -792,7 +792,7 @@ abort_queued_datain_tasks_test(void)
task1.current_datain_offset = 0;
task1.scsi.transfer_len = 512;
task1.scsi.lun = &lun1;
spdk_iscsi_task_set_pdu(&task1, &pdu1);
iscsi_task_set_pdu(&task1, &pdu1);
TAILQ_INSERT_TAIL(&conn.queued_datain_tasks, &task1, link);
pdu2.cmd_sn = alloc_cmd_sn;
@ -803,7 +803,7 @@ abort_queued_datain_tasks_test(void)
task2.current_datain_offset = 0;
task2.scsi.transfer_len = 512;
task2.scsi.lun = &lun2;
spdk_iscsi_task_set_pdu(&task2, &pdu2);
iscsi_task_set_pdu(&task2, &pdu2);
TAILQ_INSERT_TAIL(&conn.queued_datain_tasks, &task2, link);
mgmt_pdu1.cmd_sn = alloc_cmd_sn;
@ -817,7 +817,7 @@ abort_queued_datain_tasks_test(void)
task3.current_datain_offset = 0;
task3.scsi.transfer_len = 512;
task3.scsi.lun = &lun1;
spdk_iscsi_task_set_pdu(&task3, &pdu3);
iscsi_task_set_pdu(&task3, &pdu3);
TAILQ_INSERT_TAIL(&conn.queued_datain_tasks, &task3, link);
pdu4.cmd_sn = alloc_cmd_sn;
@ -828,7 +828,7 @@ abort_queued_datain_tasks_test(void)
task4.current_datain_offset = 0;
task4.scsi.transfer_len = 512;
task4.scsi.lun = &lun2;
spdk_iscsi_task_set_pdu(&task4, &pdu4);
iscsi_task_set_pdu(&task4, &pdu4);
TAILQ_INSERT_TAIL(&conn.queued_datain_tasks, &task4, link);
pdu5.cmd_sn = alloc_cmd_sn;
@ -839,7 +839,7 @@ abort_queued_datain_tasks_test(void)
task5.current_datain_offset = 0;
task5.scsi.transfer_len = 512;
task5.scsi.lun = &lun1;
spdk_iscsi_task_set_pdu(&task5, &pdu5);
iscsi_task_set_pdu(&task5, &pdu5);
TAILQ_INSERT_TAIL(&conn.queued_datain_tasks, &task5, link);
mgmt_pdu2.cmd_sn = alloc_cmd_sn;
@ -853,7 +853,7 @@ abort_queued_datain_tasks_test(void)
task6.current_datain_offset = 0;
task6.scsi.transfer_len = 512;
task6.scsi.lun = &lun2;
spdk_iscsi_task_set_pdu(&task6, &pdu6);
iscsi_task_set_pdu(&task6, &pdu6);
TAILQ_INSERT_TAIL(&conn.queued_datain_tasks, &task6, link);
rc = spdk_iscsi_conn_abort_queued_datain_tasks(&conn, &lun1, &mgmt_pdu1);

View File

@ -338,8 +338,8 @@ maxburstlength_test(void)
CU_ASSERT(rc == SPDK_ISCSI_CONNECTION_FATAL);
SPDK_CU_ASSERT_FATAL(response_pdu->task != NULL);
spdk_iscsi_task_disassociate_pdu(response_pdu->task);
spdk_iscsi_task_put(response_pdu->task);
iscsi_task_disassociate_pdu(response_pdu->task);
iscsi_task_put(response_pdu->task);
spdk_put_pdu(response_pdu);
r2t_pdu = TAILQ_FIRST(&g_write_pdu_list);
@ -378,7 +378,7 @@ underflow_for_read_transfer_test(void)
scsi_req = (struct iscsi_bhs_scsi_req *)&pdu->bhs;
scsi_req->read_bit = 1;
spdk_iscsi_task_set_pdu(&task, pdu);
iscsi_task_set_pdu(&task, pdu);
task.parent = NULL;
task.scsi.iovs = &task.scsi.iov;
@ -441,7 +441,7 @@ underflow_for_zero_read_transfer_test(void)
scsi_req = (struct iscsi_bhs_scsi_req *)&pdu->bhs;
scsi_req->read_bit = 1;
spdk_iscsi_task_set_pdu(&task, pdu);
iscsi_task_set_pdu(&task, pdu);
task.parent = NULL;
task.scsi.length = 512;
@ -506,7 +506,7 @@ underflow_for_request_sense_test(void)
scsi_req = (struct iscsi_bhs_scsi_req *)&pdu1->bhs;
scsi_req->read_bit = 1;
spdk_iscsi_task_set_pdu(&task, pdu1);
iscsi_task_set_pdu(&task, pdu1);
task.parent = NULL;
task.scsi.iovs = &task.scsi.iov;
@ -596,7 +596,7 @@ underflow_for_check_condition_test(void)
scsi_req = (struct iscsi_bhs_scsi_req *)&pdu->bhs;
scsi_req->read_bit = 1;
spdk_iscsi_task_set_pdu(&task, pdu);
iscsi_task_set_pdu(&task, pdu);
task.parent = NULL;
task.scsi.iovs = &task.scsi.iov;
@ -659,7 +659,7 @@ add_transfer_task_test(void)
pdu->data_segment_len = SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH; /* 64K */
task.scsi.transfer_len = 16 * 1024 * 1024;
spdk_iscsi_task_set_pdu(&task, pdu);
iscsi_task_set_pdu(&task, pdu);
/* The following tests if the task is queued because R2T tasks are full. */
conn.pending_r2t = DEFAULT_MAXR2T;
@ -736,7 +736,7 @@ get_transfer_task_test(void)
pdu1->data_segment_len = SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH;
task1.scsi.transfer_len = SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH;
spdk_iscsi_task_set_pdu(&task1, pdu1);
iscsi_task_set_pdu(&task1, pdu1);
rc = add_transfer_task(&conn, &task1);
CU_ASSERT(rc == 0);
@ -746,7 +746,7 @@ get_transfer_task_test(void)
pdu2->data_segment_len = SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH;
task2.scsi.transfer_len = SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH;
spdk_iscsi_task_set_pdu(&task2, pdu2);
iscsi_task_set_pdu(&task2, pdu2);
rc = add_transfer_task(&conn, &task2);
CU_ASSERT(rc == 0);
@ -793,7 +793,7 @@ del_transfer_task_test(void)
pdu1->data_segment_len = SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH;
task1.scsi.transfer_len = SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH;
spdk_iscsi_task_set_pdu(&task1, pdu1);
iscsi_task_set_pdu(&task1, pdu1);
task1.tag = 11;
rc = add_transfer_task(&conn, &task1);
@ -804,7 +804,7 @@ del_transfer_task_test(void)
pdu2->data_segment_len = SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH;
task2.scsi.transfer_len = SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH;
spdk_iscsi_task_set_pdu(&task2, pdu2);
iscsi_task_set_pdu(&task2, pdu2);
task2.tag = 12;
rc = add_transfer_task(&conn, &task2);
@ -815,7 +815,7 @@ del_transfer_task_test(void)
pdu3->data_segment_len = SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH;
task3.scsi.transfer_len = SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH;
spdk_iscsi_task_set_pdu(&task3, pdu3);
iscsi_task_set_pdu(&task3, pdu3);
task3.tag = 13;
rc = add_transfer_task(&conn, &task3);
@ -826,7 +826,7 @@ del_transfer_task_test(void)
pdu4->data_segment_len = SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH;
task4.scsi.transfer_len = SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH;
spdk_iscsi_task_set_pdu(&task4, pdu4);
iscsi_task_set_pdu(&task4, pdu4);
task4.tag = 14;
rc = add_transfer_task(&conn, &task4);
@ -837,7 +837,7 @@ del_transfer_task_test(void)
pdu5->data_segment_len = SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH;
task5.scsi.transfer_len = SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH;
spdk_iscsi_task_set_pdu(&task5, pdu5);
iscsi_task_set_pdu(&task5, pdu5);
task5.tag = 15;
rc = add_transfer_task(&conn, &task5);
@ -904,7 +904,7 @@ clear_all_transfer_tasks_test(void)
alloc_cmd_sn = 10;
task1 = spdk_iscsi_task_get(&conn, NULL, NULL);
task1 = iscsi_task_get(&conn, NULL, NULL);
SPDK_CU_ASSERT_FATAL(task1 != NULL);
pdu1 = spdk_get_pdu(&conn);
SPDK_CU_ASSERT_FATAL(pdu1 != NULL);
@ -914,7 +914,7 @@ clear_all_transfer_tasks_test(void)
alloc_cmd_sn++;
task1->scsi.transfer_len = SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH;
task1->scsi.lun = &lun1;
spdk_iscsi_task_set_pdu(task1, pdu1);
iscsi_task_set_pdu(task1, pdu1);
rc = add_transfer_task(&conn, task1);
CU_ASSERT(rc == 0);
@ -925,7 +925,7 @@ clear_all_transfer_tasks_test(void)
mgmt_pdu1->cmd_sn = alloc_cmd_sn;
alloc_cmd_sn++;
task2 = spdk_iscsi_task_get(&conn, NULL, NULL);
task2 = iscsi_task_get(&conn, NULL, NULL);
SPDK_CU_ASSERT_FATAL(task2 != NULL);
pdu2 = spdk_get_pdu(&conn);
SPDK_CU_ASSERT_FATAL(pdu2 != NULL);
@ -935,12 +935,12 @@ clear_all_transfer_tasks_test(void)
alloc_cmd_sn++;
task2->scsi.transfer_len = SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH;
task2->scsi.lun = &lun1;
spdk_iscsi_task_set_pdu(task2, pdu2);
iscsi_task_set_pdu(task2, pdu2);
rc = add_transfer_task(&conn, task2);
CU_ASSERT(rc == 0);
task3 = spdk_iscsi_task_get(&conn, NULL, NULL);
task3 = iscsi_task_get(&conn, NULL, NULL);
SPDK_CU_ASSERT_FATAL(task3 != NULL);
pdu3 = spdk_get_pdu(&conn);
SPDK_CU_ASSERT_FATAL(pdu3 != NULL);
@ -950,12 +950,12 @@ clear_all_transfer_tasks_test(void)
alloc_cmd_sn++;
task3->scsi.transfer_len = SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH;
task3->scsi.lun = &lun1;
spdk_iscsi_task_set_pdu(task3, pdu3);
iscsi_task_set_pdu(task3, pdu3);
rc = add_transfer_task(&conn, task3);
CU_ASSERT(rc == 0);
task4 = spdk_iscsi_task_get(&conn, NULL, NULL);
task4 = iscsi_task_get(&conn, NULL, NULL);
SPDK_CU_ASSERT_FATAL(task4 != NULL);
pdu4 = spdk_get_pdu(&conn);
SPDK_CU_ASSERT_FATAL(pdu4 != NULL);
@ -965,12 +965,12 @@ clear_all_transfer_tasks_test(void)
alloc_cmd_sn++;
task4->scsi.transfer_len = SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH;
task4->scsi.lun = &lun2;
spdk_iscsi_task_set_pdu(task4, pdu4);
iscsi_task_set_pdu(task4, pdu4);
rc = add_transfer_task(&conn, task4);
CU_ASSERT(rc == 0);
task5 = spdk_iscsi_task_get(&conn, NULL, NULL);
task5 = iscsi_task_get(&conn, NULL, NULL);
SPDK_CU_ASSERT_FATAL(task5 != NULL);
pdu5 = spdk_get_pdu(&conn);
SPDK_CU_ASSERT_FATAL(pdu5 != NULL);
@ -980,7 +980,7 @@ clear_all_transfer_tasks_test(void)
alloc_cmd_sn++;
task5->scsi.transfer_len = SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH;
task5->scsi.lun = &lun2;
spdk_iscsi_task_set_pdu(task5, pdu5);
iscsi_task_set_pdu(task5, pdu5);
rc = add_transfer_task(&conn, task5);
CU_ASSERT(rc == 0);
@ -991,7 +991,7 @@ clear_all_transfer_tasks_test(void)
mgmt_pdu2->cmd_sn = alloc_cmd_sn;
alloc_cmd_sn++;
task6 = spdk_iscsi_task_get(&conn, NULL, NULL);
task6 = iscsi_task_get(&conn, NULL, NULL);
SPDK_CU_ASSERT_FATAL(task6 != NULL);
pdu6 = spdk_get_pdu(&conn);
SPDK_CU_ASSERT_FATAL(pdu6 != NULL);
@ -1001,7 +1001,7 @@ clear_all_transfer_tasks_test(void)
alloc_cmd_sn++;
task5->scsi.transfer_len = SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH;
task6->scsi.lun = &lun2;
spdk_iscsi_task_set_pdu(task6, pdu6);
iscsi_task_set_pdu(task6, pdu6);
rc = add_transfer_task(&conn, task6);
CU_ASSERT(rc == 0);
@ -1548,7 +1548,7 @@ check_scsi_task(struct spdk_iscsi_pdu *pdu, enum spdk_scsi_data_dir dir)
CU_ASSERT(task->pdu == pdu);
CU_ASSERT(task->scsi.dxfer_dir == dir);
spdk_iscsi_task_put(task);
iscsi_task_put(task);
pdu->task = NULL;
}
@ -1937,7 +1937,7 @@ pdu_hdr_op_data_test(void)
rc = iscsi_pdu_hdr_op_data(&conn, &pdu);
CU_ASSERT(rc == 0);
CU_ASSERT(pdu.task != NULL);
spdk_iscsi_task_put(pdu.task);
iscsi_task_put(pdu.task);
pdu.task = NULL;
/* Case 11 - SCSI Data-Out PDU is correct and processed. Created task is held
@ -1952,7 +1952,7 @@ pdu_hdr_op_data_test(void)
CU_ASSERT(rc == 0);
CU_ASSERT(pdu.task != NULL);
check_iscsi_r2t(pdu.task, pdu.data_segment_len * 4);
spdk_iscsi_task_put(pdu.task);
iscsi_task_put(pdu.task);
/* Case 12 - Task pool is empty. */
to_be32(&data_reqh->data_sn, primary.r2t_datasn);