From: Changcheng Liu Date: Tue, 27 Aug 2019 07:58:57 +0000 (+0800) Subject: msg/async/rdma: complete get_qp_lockless to get get qp X-Git-Tag: v15.1.0~1481^2~16 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=cc08b02046ce1243926c2d716281566bd0a70402;p=ceph.git msg/async/rdma: complete get_qp_lockless to get get qp Need get_qp_lockless to get the QueuePair when lock is locked. Signed-off-by: Changcheng Liu --- diff --git a/src/msg/async/rdma/RDMAStack.cc b/src/msg/async/rdma/RDMAStack.cc index 8051687ec96..d04249fb4a8 100644 --- a/src/msg/async/rdma/RDMAStack.cc +++ b/src/msg/async/rdma/RDMAStack.cc @@ -375,9 +375,8 @@ RDMAConnectedSocketImpl* RDMADispatcher::get_conn_lockless(uint32_t qp) return it->second.second; } -Infiniband::QueuePair* RDMADispatcher::get_qp(uint32_t qp) +Infiniband::QueuePair* RDMADispatcher::get_qp_lockless(uint32_t qp) { - std::lock_guard l{lock}; // Try to find the QP in qp_conns firstly. auto it = qp_conns.find(qp); if (it != qp_conns.end()) @@ -391,6 +390,12 @@ Infiniband::QueuePair* RDMADispatcher::get_qp(uint32_t qp) return nullptr; } +Infiniband::QueuePair* RDMADispatcher::get_qp(uint32_t qp) +{ + std::lock_guard l{lock}; + return get_qp_lockless(qp); +} + void RDMADispatcher::erase_qpn_lockless(uint32_t qpn) { auto it = qp_conns.find(qpn); diff --git a/src/msg/async/rdma/RDMAStack.h b/src/msg/async/rdma/RDMAStack.h index 3272592e5cd..f553098a60f 100644 --- a/src/msg/async/rdma/RDMAStack.h +++ b/src/msg/async/rdma/RDMAStack.h @@ -109,6 +109,7 @@ class RDMADispatcher { ++num_pending_workers; } RDMAConnectedSocketImpl* get_conn_lockless(uint32_t qp); + QueuePair* get_qp_lockless(uint32_t qp); QueuePair* get_qp(uint32_t qp); void erase_qpn_lockless(uint32_t qpn); void erase_qpn(uint32_t qpn);