summaryrefslogtreecommitdiff
path: root/drivers/target/iscsi/iscsi_target_util.c
diff options
context:
space:
mode:
authorSagi Grimberg <sagig@mellanox.com>2015-01-26 13:49:05 +0300
committerNicholas Bellinger <nab@linux-iscsi.org>2015-02-04 21:55:33 +0300
commitc1e34b64044318dde74a4cec24a91ff6415f1c48 (patch)
treedfe7ec5ff63a5abdb800bb90e6fee41b9dbacaad /drivers/target/iscsi/iscsi_target_util.c
parent631af550621071d56abe2edbb63d9afd4f4dafcf (diff)
downloadlinux-c1e34b64044318dde74a4cec24a91ff6415f1c48.tar.xz
iscsi-target: Introduce session_get_next_ttt
Reduce code duplication. Signed-off-by: Sagi Grimberg <sagig@mellanox.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target/iscsi/iscsi_target_util.c')
-rw-r--r--drivers/target/iscsi/iscsi_target_util.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/drivers/target/iscsi/iscsi_target_util.c b/drivers/target/iscsi/iscsi_target_util.c
index 70f57c192415..c211d3f2726c 100644
--- a/drivers/target/iscsi/iscsi_target_util.c
+++ b/drivers/target/iscsi/iscsi_target_util.c
@@ -939,13 +939,8 @@ static int iscsit_add_nopin(struct iscsi_conn *conn, int want_response)
state = (want_response) ? ISTATE_SEND_NOPIN_WANT_RESPONSE :
ISTATE_SEND_NOPIN_NO_RESPONSE;
cmd->init_task_tag = RESERVED_ITT;
- spin_lock_bh(&conn->sess->ttt_lock);
- cmd->targ_xfer_tag = (want_response) ? conn->sess->targ_xfer_tag++ :
- 0xFFFFFFFF;
- if (want_response && (cmd->targ_xfer_tag == 0xFFFFFFFF))
- cmd->targ_xfer_tag = conn->sess->targ_xfer_tag++;
- spin_unlock_bh(&conn->sess->ttt_lock);
-
+ cmd->targ_xfer_tag = (want_response) ?
+ session_get_next_ttt(conn->sess) : 0xFFFFFFFF;
spin_lock_bh(&conn->cmd_lock);
list_add_tail(&cmd->i_conn_node, &conn->conn_cmd_list);
spin_unlock_bh(&conn->cmd_lock);