]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
msg/async/rdma: move C_handle_connection to RDMAConnectionSocketImpl.cc 34780/head
authorliupengs <liupeng37@baidu.com>
Sun, 1 Mar 2020 05:04:37 +0000 (13:04 +0800)
committerVicente Cheng <freeze.bilsted@gmail.com>
Tue, 28 Apr 2020 02:55:21 +0000 (02:55 +0000)
Signed-off-by: Peng Liu <liupeng37@baidu.com>
(cherry picked from commit 9fbe5bc75496ab58d075b724078979e30063b623)

Conflicts:
src/msg/async/rdma/RDMAConnectedSocketImpl.cc
  - use the constructor of RDMAConnectedSocketImpl in nautilus

src/msg/async/rdma/RDMAConnectedSocketImpl.cc
src/msg/async/rdma/RDMAStack.h

index a2c072a035ed308bb41efc3d45064e08953dbb18..89be742811c5a00a7c2389173e701f199ddb808c 100644 (file)
@@ -29,6 +29,19 @@ class C_handle_connection_established : public EventCallback {
   }
 };
 
+class C_handle_connection_read : public EventCallback {
+  RDMAConnectedSocketImpl *csi;
+  bool active = true;
+ public:
+  explicit C_handle_connection_read(RDMAConnectedSocketImpl *w): csi(w) {}
+  void do_request(uint64_t fd) final {
+    if (active)
+      csi->handle_connection();
+  }
+  void close() {
+    active = false;
+  }
+};
 
 #define dout_subsys ceph_subsys_ms
 #undef dout_prefix
@@ -38,7 +51,7 @@ RDMAConnectedSocketImpl::RDMAConnectedSocketImpl(CephContext *cct, Infiniband* i
                                                 RDMAWorker *w)
   : cct(cct), connected(0), error(0), infiniband(ib),
     dispatcher(s), worker(w), lock("RDMAConnectedSocketImpl::lock"),
-    is_server(false), con_handler(new C_handle_connection(this)),
+    is_server(false), read_handler(new C_handle_connection_read(this)),
     established_handler(new C_handle_connection_established(this)),
     active(false), pending(false)
 {
@@ -241,7 +254,7 @@ int RDMAConnectedSocketImpl::handle_connection_established(bool need_set_fault)
     }
     return r;
   }
-  worker->center.create_file_event(tcp_fd, EVENT_READABLE, con_handler);
+  worker->center.create_file_event(tcp_fd, EVENT_READABLE, read_handler);
   ldout(cct, 20) << __func__ << " finish " << dendl;
   return 0;
 }
@@ -657,13 +670,13 @@ void RDMAConnectedSocketImpl::fin() {
 }
 
 void RDMAConnectedSocketImpl::cleanup() {
-  if (con_handler && tcp_fd >= 0) {
-    (static_cast<C_handle_connection*>(con_handler))->close();
+  if (read_handler && tcp_fd >= 0) {
+    (static_cast<C_handle_connection_read*>(read_handler))->close();
     worker->center.submit_to(worker->center.get_id(), [this]() {
       worker->center.delete_file_event(tcp_fd, EVENT_READABLE | EVENT_WRITABLE);
     }, false);
-    delete con_handler;
-    con_handler = nullptr;
+    delete read_handler;
+    read_handler = nullptr;
   }
   if (established_handler) {
     (static_cast<C_handle_connection_established*>(established_handler))->close();
@@ -714,7 +727,7 @@ void RDMAConnectedSocketImpl::set_accept_fd(int sd)
   tcp_fd = sd;
   is_server = true;
   worker->center.submit_to(worker->center.get_id(), [this]() {
-                          worker->center.create_file_event(tcp_fd, EVENT_READABLE, con_handler);
+                          worker->center.create_file_event(tcp_fd, EVENT_READABLE, read_handler);
                           }, true);
 }
 
index 3b6ed4e038c1657f3d5aaa0d683425a24e4ae636..e4d34ee079ec38e5aaeaa8745df7d12d6c1e0634 100644 (file)
@@ -196,7 +196,7 @@ class RDMAConnectedSocketImpl : public ConnectedSocketImpl {
   Mutex lock;
   std::vector<ibv_wc> wc;
   bool is_server;
-  EventCallbackRef con_handler;
+  EventCallbackRef read_handler;
   EventCallbackRef established_handler;
   int tcp_fd = -1;
   bool active;// qp is active ?
@@ -237,21 +237,6 @@ class RDMAConnectedSocketImpl : public ConnectedSocketImpl {
   void set_pending(bool val) {pending = val;}
   void post_chunks_to_rq(int num);
   void update_post_backlog();
-
-  class C_handle_connection : public EventCallback {
-    RDMAConnectedSocketImpl *csi;
-    bool active;
-   public:
-    explicit C_handle_connection(RDMAConnectedSocketImpl *w): csi(w), active(true) {}
-    void do_request(uint64_t fd) {
-      if (active)
-        csi->handle_connection();
-    }
-    void close() {
-      active = false;
-    }
-  };
-  
 };
 
 enum RDMA_CM_STATUS {