diff options
author | Sagi Grimberg <sagig@mellanox.com> | 2015-01-26 05:49:05 -0500 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2015-02-04 13:55:33 -0500 |
commit | c1e34b64044318dde74a4cec24a91ff6415f1c48 (patch) | |
tree | dfe7ec5ff63a5abdb800bb90e6fee41b9dbacaad /include | |
parent | 631af550621071d56abe2edbb63d9afd4f4dafcf (diff) |
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 'include')
-rw-r--r-- | include/target/iscsi/iscsi_target_core.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/target/iscsi/iscsi_target_core.h b/include/target/iscsi/iscsi_target_core.h index 09a522bae222..5f41a17bdafd 100644 --- a/include/target/iscsi/iscsi_target_core.h +++ b/include/target/iscsi/iscsi_target_core.h | |||
@@ -880,4 +880,17 @@ struct iscsit_global { | |||
880 | struct iscsi_portal_group *discovery_tpg; | 880 | struct iscsi_portal_group *discovery_tpg; |
881 | }; | 881 | }; |
882 | 882 | ||
883 | static inline u32 session_get_next_ttt(struct iscsi_session *session) | ||
884 | { | ||
885 | u32 ttt; | ||
886 | |||
887 | spin_lock_bh(&session->ttt_lock); | ||
888 | ttt = session->targ_xfer_tag++; | ||
889 | if (ttt == 0xFFFFFFFF) | ||
890 | ttt = session->targ_xfer_tag++; | ||
891 | spin_unlock_bh(&session->ttt_lock); | ||
892 | |||
893 | return ttt; | ||
894 | } | ||
895 | |||
883 | #endif /* ISCSI_TARGET_CORE_H */ | 896 | #endif /* ISCSI_TARGET_CORE_H */ |