From 058b13081ee5ebb419c966e3ca26796962acf350 Mon Sep 17 00:00:00 2001 From: Shuhei Matsumoto Date: Thu, 3 Oct 2019 09:16:25 +0900 Subject: [PATCH] lib/iscsi: Move get_scsi_task_from_itt/ttt() down in the file Move get_scsi_task_from_ttt() and get_scsi_task_from_itt() down in the file close to the location that uses them. Signed-off-by: Shuhei Matsumoto Change-Id: I5218eac3fda85e238d40eed7282d126ebe81c16b Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470267 Tested-by: SPDK CI Jenkins Reviewed-by: Changpeng Liu Reviewed-by: Jim Harris --- lib/iscsi/iscsi.c | 82 +++++++++++++++++++++++------------------------ 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/lib/iscsi/iscsi.c b/lib/iscsi/iscsi.c index 907d0f953c..62ec7304ff 100644 --- a/lib/iscsi/iscsi.c +++ b/lib/iscsi/iscsi.c @@ -3060,47 +3060,6 @@ void spdk_clear_all_transfer_task(struct spdk_iscsi_conn *conn, start_queued_transfer_tasks(conn); } -/* This function returns the spdk_scsi_task by searching the snack list via - * task transfertag and the pdu's opcode - */ -static struct spdk_iscsi_task * -get_scsi_task_from_ttt(struct spdk_iscsi_conn *conn, uint32_t transfer_tag) -{ - struct spdk_iscsi_pdu *pdu; - struct iscsi_bhs_data_in *datain_bhs; - - TAILQ_FOREACH(pdu, &conn->snack_pdu_list, tailq) { - if (pdu->bhs.opcode == ISCSI_OP_SCSI_DATAIN) { - datain_bhs = (struct iscsi_bhs_data_in *)&pdu->bhs; - if (from_be32(&datain_bhs->ttt) == transfer_tag) { - return pdu->task; - } - } - } - - return NULL; -} - -/* This function returns the spdk_scsi_task by searching the snack list via - * initiator task tag and the pdu's opcode - */ -static struct spdk_iscsi_task * -get_scsi_task_from_itt(struct spdk_iscsi_conn *conn, - uint32_t task_tag, enum iscsi_op opcode) -{ - struct spdk_iscsi_pdu *pdu; - - TAILQ_FOREACH(pdu, &conn->snack_pdu_list, tailq) { - if (pdu->bhs.opcode == opcode && - pdu->task != NULL && - pdu->task->tag == task_tag) { - return pdu->task; - } - } - - return NULL; -} - static int iscsi_send_datain(struct spdk_iscsi_conn *conn, struct spdk_iscsi_task *task, int datain_flag, @@ -4140,6 +4099,47 @@ iscsi_op_nopout(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) return 0; } +/* This function returns the spdk_scsi_task by searching the snack list via + * task transfertag and the pdu's opcode + */ +static struct spdk_iscsi_task * +get_scsi_task_from_ttt(struct spdk_iscsi_conn *conn, uint32_t transfer_tag) +{ + struct spdk_iscsi_pdu *pdu; + struct iscsi_bhs_data_in *datain_bhs; + + TAILQ_FOREACH(pdu, &conn->snack_pdu_list, tailq) { + if (pdu->bhs.opcode == ISCSI_OP_SCSI_DATAIN) { + datain_bhs = (struct iscsi_bhs_data_in *)&pdu->bhs; + if (from_be32(&datain_bhs->ttt) == transfer_tag) { + return pdu->task; + } + } + } + + return NULL; +} + +/* This function returns the spdk_scsi_task by searching the snack list via + * initiator task tag and the pdu's opcode + */ +static struct spdk_iscsi_task * +get_scsi_task_from_itt(struct spdk_iscsi_conn *conn, + uint32_t task_tag, enum iscsi_op opcode) +{ + struct spdk_iscsi_pdu *pdu; + + TAILQ_FOREACH(pdu, &conn->snack_pdu_list, tailq) { + if (pdu->bhs.opcode == opcode && + pdu->task != NULL && + pdu->task->tag == task_tag) { + return pdu->task; + } + } + + return NULL; +} + /* This function is used to handle the r2t snack */ static int iscsi_handle_r2t_snack(struct spdk_iscsi_conn *conn,