]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
msg/async/rdma: remove redundant code
authorChangcheng Liu <changcheng.liu@aliyun.com>
Wed, 19 Jun 2019 07:53:08 +0000 (15:53 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 23 Aug 2019 06:36:05 +0000 (14:36 +0800)
1. Below three bits are meaningless in pollfd::events field:
   POLLERR, POLLHUP, or POLLNVAL.
2. QueuePair::pd is initialized in the initialize list.
   There's no need to assign same value to it.
3. Remove the never used function Chunk::set_bound
4. Remove the never used function Chunk::set_offset
5. Remove the never used function QueuePair::is_error
6. Remove SimplePolicyMessenger used vars
7. remove socket_fd() interface since it's never used.
   All data write/read is based on ConnectedSocketImpl::fd.
   So, there's no need to expose socket_fd since it's never used.
8. Remove RDMAServerSocketImpl::get_fd which is not used.
   BTW, RDMAServerSocketImpl::fd has the same function as get_fd.

Signed-off-by: Changcheng Liu <changcheng.liu@aliyun.com>
src/msg/SimplePolicyMessenger.h
src/msg/async/AsyncMessenger.cc
src/msg/async/PosixStack.cc
src/msg/async/Stack.h
src/msg/async/dpdk/DPDKStack.h
src/msg/async/rdma/Infiniband.cc
src/msg/async/rdma/Infiniband.h
src/msg/async/rdma/RDMAStack.cc
src/msg/async/rdma/RDMAStack.h

index dc2b3c79222d2482de7229c1e9c269dda39080c6..3b25983a62b79851226afe1b46ba2bfadd8e61dd 100644 (file)
@@ -30,8 +30,7 @@ private:
 
 public:
 
-  SimplePolicyMessenger(CephContext *cct, entity_name_t name,
-                       string mname, uint64_t _nonce)
+  SimplePolicyMessenger(CephContext *cct, entity_name_t name)
     : Messenger(cct, name)
     {
     }
index 6d2a4251cb1ee8d7ad6543b7e9c026e2e6dcd432..47405cf18d8713f5aea2951a7ab0d3faf26e044f 100644 (file)
@@ -276,7 +276,7 @@ class C_handle_reap : public EventCallback {
 
 AsyncMessenger::AsyncMessenger(CephContext *cct, entity_name_t name,
                                const std::string &type, string mname, uint64_t _nonce)
-  : SimplePolicyMessenger(cct, name,mname, _nonce),
+  : SimplePolicyMessenger(cct, name),
     dispatch_queue(cct, this, mname),
     nonce(_nonce)
 {
index 5a364b8fbe09269317226b45c5b49b0f833ab4c7..eb7b343a3677fe61cf372ba3860afd10e3b9749a 100644 (file)
@@ -161,9 +161,6 @@ class PosixConnectedSocketImpl final : public ConnectedSocketImpl {
   int fd() const override {
     return _fd;
   }
-  int socket_fd() const override {
-    return _fd;
-  }
   friend class PosixServerSocketImpl;
   friend class PosixNetworkStack;
 };
index d05f934fd093aba035b43d83d1a363e347555b21..a7430da8735318af8a787a4a3fb6c646715577c1 100644 (file)
@@ -33,7 +33,6 @@ class ConnectedSocketImpl {
   virtual void shutdown() = 0;
   virtual void close() = 0;
   virtual int fd() const = 0;
-  virtual int socket_fd() const = 0;
 };
 
 class ConnectedSocket;
@@ -130,9 +129,6 @@ class ConnectedSocket {
   int fd() const {
     return _csi->fd();
   }
-  int socket_fd() const {
-    return _csi->socket_fd();
-  }
 
   explicit operator bool() const {
     return _csi.get();
index 622ff8a3c6945f314bdcf7a991d18f16cde48c8d..e41a87545220ee81fbd4de4d1c5f19f372646dd6 100644 (file)
@@ -176,10 +176,6 @@ class NativeConnectedSocketImpl : public ConnectedSocketImpl {
   virtual int fd() const override {
     return _conn.fd();
   }
-  virtual int socket_fd() const override {
-    return _conn.fd();
-  }
-
 };
 
 template <typename Protocol>
index 9e27fe72abbde4f4cf7141438f8403d80e001e0e..360f39dd0a9ceeff285bb46590653c08ba1b1cbc 100644 (file)
@@ -180,7 +180,6 @@ Infiniband::QueuePair::QueuePair(
     lderr(cct) << __func__ << " invalid queue pair type" << cpp_strerror(errno) << dendl;
     ceph_abort();
   }
-  pd = infiniband.pd->pd;
 }
 
 int Infiniband::QueuePair::init()
@@ -354,23 +353,6 @@ int Infiniband::QueuePair::get_state() const
   return qpa.qp_state;
 }
 
-/**
- * Return true if the queue pair is in an error state, false otherwise.
- */
-bool Infiniband::QueuePair::is_error() const
-{
-  ibv_qp_attr qpa;
-
-  int r = get_state();
-  if (r) {
-    lderr(cct) << __func__ << " failed to get state: "
-      << cpp_strerror(errno) << dendl;
-    return true;
-  }
-  return qpa.qp_state == IBV_QPS_ERR;
-}
-
-
 Infiniband::CompletionChannel::CompletionChannel(CephContext *c, Infiniband &ib)
   : cct(c), infiniband(ib), channel(NULL), cq(NULL), cq_events_that_need_ack(0)
 {
@@ -509,21 +491,11 @@ Infiniband::MemoryManager::Chunk::~Chunk()
 {
 }
 
-void Infiniband::MemoryManager::Chunk::set_offset(uint32_t o)
-{
-  offset = o;
-}
-
 uint32_t Infiniband::MemoryManager::Chunk::get_offset()
 {
   return offset;
 }
 
-void Infiniband::MemoryManager::Chunk::set_bound(uint32_t b)
-{
-  bound = b;
-}
-
 uint32_t Infiniband::MemoryManager::Chunk::get_size() const
 {
   return bound - offset;
index 09c58241a556e99d85f70b69eb2b4e20dfc25eee..d47f914e1c241b4d35b7f25a5d30b1bf60664333 100644 (file)
@@ -206,9 +206,7 @@ class Infiniband {
       Chunk(ibv_mr* m, uint32_t bytes, char* buffer, uint32_t offset = 0, uint32_t bound = 0, uint32_t lkey = 0);
       ~Chunk();
 
-      void set_offset(uint32_t o);
       uint32_t get_offset();
-      void set_bound(uint32_t b);
       uint32_t get_size() const;
       void prepare_read(uint32_t b);
       uint32_t get_bound();
@@ -476,10 +474,6 @@ class Infiniband {
      * Get the state of a QueuePair.
      */
     int get_state() const;
-    /**
-     * Return true if the queue pair is in an error state, false otherwise.
-     */
-    bool is_error() const;
     void add_tx_wr(uint32_t amt) { tx_wr_inflight += amt; }
     void dec_tx_wr(uint32_t amt) { tx_wr_inflight -= amt; }
     uint32_t get_tx_wr() const { return tx_wr_inflight; }
index 82533c83a2981500a6bd3fd0a3298358cfa59039..254f45f2a6c9918304f528a9eddc44d14c78ebe7 100644 (file)
@@ -315,10 +315,10 @@ void RDMADispatcher::polling()
 
         struct pollfd channel_poll[2];
         channel_poll[0].fd = tx_cc->get_fd();
-        channel_poll[0].events = POLLIN | POLLERR | POLLNVAL | POLLHUP;
+        channel_poll[0].events = POLLIN;
         channel_poll[0].revents = 0;
         channel_poll[1].fd = rx_cc->get_fd();
-        channel_poll[1].events = POLLIN | POLLERR | POLLNVAL | POLLHUP;
+        channel_poll[1].events = POLLIN;
         channel_poll[1].revents = 0;
         r = 0;
         perf_logger->set(l_msgr_rdma_polling, 0);
index 7a83260a54099af80ef9572f84ac28d4e7d5b7a4..1642d17ad4d29b99033b460894cca557a82c8a30 100644 (file)
@@ -228,7 +228,6 @@ class RDMAConnectedSocketImpl : public ConnectedSocketImpl {
   virtual void shutdown() override;
   virtual void close() override;
   virtual int fd() const override { return notify_fd; }
-  virtual int socket_fd() const override { return tcp_fd; }
   void fault();
   const char* get_qp_state() { return Infiniband::qp_state_string(qp->get_state()); }
   ssize_t submit(bool more);
@@ -325,7 +324,6 @@ class RDMAServerSocketImpl : public ServerSocketImpl {
   virtual int accept(ConnectedSocket *s, const SocketOptions &opts, entity_addr_t *out, Worker *w) override;
   virtual void abort_accept() override;
   virtual int fd() const override { return server_setup_socket; }
-  int get_fd() { return server_setup_socket; }
 };
 
 class RDMAIWARPServerSocketImpl : public RDMAServerSocketImpl {