]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/msg/async/rdma/RDMAStack.cc
import quincy beta 17.1.0
[ceph.git] / ceph / src / msg / async / rdma / RDMAStack.cc
index 49bafd0b4c3888630600ffe45871e26db311ee46..12db599d684cff59dd04cb35b90e96c214058387 100644 (file)
@@ -23,7 +23,6 @@
 #include "include/compat.h"
 #include "common/Cycles.h"
 #include "common/deleter.h"
-#include "common/Tub.h"
 #include "RDMAStack.h"
 
 #define dout_subsys ceph_subsys_ms
@@ -783,13 +782,6 @@ RDMAStack::RDMAStack(CephContext *cct)
     rdma_dispatcher(std::make_shared<RDMADispatcher>(cct, ib))
 {
   ldout(cct, 20) << __func__ << " constructing RDMAStack..." << dendl;
-
-  unsigned num = get_num_worker();
-  for (unsigned i = 0; i < num; ++i) {
-    RDMAWorker* w = dynamic_cast<RDMAWorker*>(get_worker(i));
-    w->set_dispatcher(rdma_dispatcher);
-    w->set_ib(ib);
-  }
   ldout(cct, 20) << " creating RDMAStack:" << this << " with dispatcher:" << rdma_dispatcher.get() << dendl;
 }
 
@@ -800,10 +792,17 @@ RDMAStack::~RDMAStack()
   }
 }
 
-void RDMAStack::spawn_worker(unsigned i, std::function<void ()> &&func)
+Worker* RDMAStack::create_worker(CephContext *c, unsigned worker_id)
+{
+  auto w = new RDMAWorker(c, worker_id);
+  w->set_dispatcher(rdma_dispatcher);
+  w->set_ib(ib);
+  return w;
+}
+
+void RDMAStack::spawn_worker(std::function<void ()> &&func)
 {
-  threads.resize(i+1);
-  threads[i] = std::thread(func);
+  threads.emplace_back(std::move(func));
 }
 
 void RDMAStack::join_worker(unsigned i)