]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msg, ceph_osd: Support feature bits for all message type's local connection
authorDavid Zafman <dzafman@redhat.com>
Tue, 16 Jun 2015 00:09:04 +0000 (17:09 -0700)
committerDavid Zafman <dzafman@redhat.com>
Sat, 20 Jun 2015 00:00:03 +0000 (17:00 -0700)
Signed-off-by: David Zafman <dzafman@redhat.com>
src/ceph_osd.cc
src/msg/Messenger.cc
src/msg/Messenger.h
src/msg/async/AsyncMessenger.cc
src/msg/async/AsyncMessenger.h
src/msg/simple/SimpleMessenger.cc
src/msg/simple/SimpleMessenger.h
src/msg/xio/XioMessenger.cc
src/msg/xio/XioMessenger.h

index 8a7e0c294180bd411245a83ef1875b832823a5f5..04276091b3269e1d2c9527c3d9ebd9d7d304bd0b 100644 (file)
@@ -413,7 +413,7 @@ int main(int argc, const char **argv)
                                           getpid());
   Messenger *ms_cluster = Messenger::create(g_ceph_context, g_conf->ms_type,
                                            entity_name_t::OSD(whoami), "cluster",
-                                           getpid());
+                                           getpid(), CEPH_FEATURES_ALL);
   Messenger *ms_hbclient = Messenger::create(g_ceph_context, g_conf->ms_type,
                                             entity_name_t::OSD(whoami), "hbclient",
                                             getpid());
index b63950e0a624a1a15786da71303dd8537e018f5f..43e66c985f7c071626d41120eaa186cf21fd2784 100644 (file)
 
 Messenger *Messenger::create(CephContext *cct, const string &type,
                             entity_name_t name, string lname,
-                            uint64_t nonce)
+                            uint64_t nonce, uint64_t features)
 {
   int r = -1;
   if (type == "random")
     r = rand() % 2; // random does not include xio
   if (r == 0 || type == "simple")
-    return new SimpleMessenger(cct, name, lname, nonce);
+    return new SimpleMessenger(cct, name, lname, nonce, features);
   else if ((r == 1 || type == "async") &&
           cct->check_experimental_feature_enabled("ms-type-async"))
-    return new AsyncMessenger(cct, name, lname, nonce);
+    return new AsyncMessenger(cct, name, lname, nonce, features);
 #ifdef HAVE_XIO
   else if ((type == "xio") &&
           cct->check_experimental_feature_enabled("ms-type-xio"))
-    return new XioMessenger(cct, name, lname, nonce);
+    return new XioMessenger(cct, name, lname, nonce, features);
 #endif
   lderr(cct) << "unrecognized ms_type '" << type << "'" << dendl;
   return NULL;
index 436e6f59ccbb4c316164dc11ef59a347107a7df6..0f7fa24d2f42be44ace913e626e49a0fece00aca 100644 (file)
@@ -151,12 +151,14 @@ public:
    * @param name entity name to register
    * @param lname logical name of the messenger in this process (e.g., "client")
    * @param nonce nonce value to uniquely identify this instance on the current host
+   * @param features bits for the local connection
    */
   static Messenger *create(CephContext *cct,
                            const string &type,
                            entity_name_t name,
                           string lname,
-                           uint64_t nonce);
+                           uint64_t nonce,
+                          uint64_t features = 0);
 
   /**
    * @defgroup Accessors
index c9086957269d9930e14d731ea2832a9144225b3d..208a1d1ffdf307aed8a53ad7d66b9aea22473934 100644 (file)
@@ -381,7 +381,7 @@ void WorkerPool::barrier()
  */
 
 AsyncMessenger::AsyncMessenger(CephContext *cct, entity_name_t name,
-                               string mname, uint64_t _nonce)
+                               string mname, uint64_t _nonce, uint64_t features)
   : SimplePolicyMessenger(cct, name,mname, _nonce),
     processor(this, cct, _nonce),
     lock("AsyncMessenger::lock"),
@@ -393,6 +393,7 @@ AsyncMessenger::AsyncMessenger(CephContext *cct, entity_name_t name,
   cct->lookup_or_create_singleton_object<WorkerPool>(pool, WorkerPool::name);
   Worker *w = pool->get_worker();
   local_connection = new AsyncConnection(cct, this, &w->center, w->get_perf_counter());
+  local_features = features;
   init_local_connection();
 }
 
index a61485bb44f183e1b49073d0a12d03832d597824..fdbc1c5fbd10933783d7ed587fcb1b02501c955e 100644 (file)
@@ -174,7 +174,7 @@ public:
    * be a value that will be repeated if the daemon restarts.
    */
   AsyncMessenger(CephContext *cct, entity_name_t name,
-                 string mname, uint64_t _nonce);
+                 string mname, uint64_t _nonce, uint64_t features);
 
   /**
    * Destroy the AsyncMessenger. Pretty simple since all the work is done
@@ -396,6 +396,7 @@ private:
     assert(lock.is_locked());
     local_connection->peer_addr = my_inst.addr;
     local_connection->peer_type = my_inst.name.type();
+    local_connection->set_features(local_features);
     ms_deliver_handle_fast_connect(local_connection.get());
   }
 
@@ -403,6 +404,7 @@ public:
 
   /// con used for sending messages to ourselves
   ConnectionRef local_connection;
+  uint64_t local_features;
 
   /**
    * @defgroup AsyncMessenger internals
index 38b5d846a2cc7dc563e5bbc31cc722032cf0f8b3..be868b1e9323a7238f379efb22992f237ad7c598 100644 (file)
@@ -38,7 +38,7 @@ static ostream& _prefix(std::ostream *_dout, SimpleMessenger *msgr) {
  */
 
 SimpleMessenger::SimpleMessenger(CephContext *cct, entity_name_t name,
-                                string mname, uint64_t _nonce)
+                                string mname, uint64_t _nonce, uint64_t features)
   : SimplePolicyMessenger(cct, name,mname, _nonce),
     accepter(this, _nonce),
     dispatch_queue(cct, this),
@@ -54,6 +54,7 @@ SimpleMessenger::SimpleMessenger(CephContext *cct, entity_name_t name,
     local_connection(new PipeConnection(cct, this))
 {
   ceph_spin_init(&global_seq_lock);
+  local_features = features;
   init_local_connection();
 }
 
@@ -710,5 +711,6 @@ void SimpleMessenger::init_local_connection()
 {
   local_connection->peer_addr = my_inst.addr;
   local_connection->peer_type = my_inst.name.type();
+  local_connection->set_features(local_features);
   ms_deliver_handle_fast_connect(local_connection.get());
 }
index f8b8a2a8939131ce91a5b2ea94134a0a8f412dde..c05ccc6712b0ced68863bbd5f8326127ee03a52a 100644 (file)
@@ -79,9 +79,10 @@ public:
    * @param name The name to assign ourselves
    * _nonce A unique ID to use for this SimpleMessenger. It should not
    * be a value that will be repeated if the daemon restarts.
+   * features The local features bits for the local_connection
    */
   SimpleMessenger(CephContext *cct, entity_name_t name,
-                 string mname, uint64_t _nonce);
+                 string mname, uint64_t _nonce, uint64_t features);
 
   /**
    * Destroy the SimpleMessenger. Pretty simple since all the work is done
@@ -331,6 +332,7 @@ public:
 
   /// con used for sending messages to ourselves
   ConnectionRef local_connection;
+  uint64_t local_features;
 
   /**
    * @defgroup SimpleMessenger internals
@@ -369,7 +371,7 @@ public:
   int get_proto_version(int peer_type, bool connect);
 
   /**
-   * Fill in the address and peer type for the local connection, which
+   * Fill in the features, address and peer type for the local connection, which
    * is used for delivering messages back to ourself.
    */
   void init_local_connection();
index deb3e4251eebb50e9a2d96ddb0c8d345c1f0c9fc..cd502cae255cbac07a6ab481a845df6c1c7b595c 100644 (file)
@@ -251,7 +251,7 @@ static string xio_uri_from_entity(const string &type,
 /* XioMessenger */
 XioMessenger::XioMessenger(CephContext *cct, entity_name_t name,
                           string mname, uint64_t _nonce,
-                          DispatchStrategy *ds)
+                          DispatchStrategy *ds, uint64_t features)
   : SimplePolicyMessenger(cct, name, mname, _nonce),
     nsessions(0),
     shutdown_called(false),
@@ -379,6 +379,8 @@ XioMessenger::XioMessenger(CephContext *cct, entity_name_t name,
   /* update class instance count */
   nInstances.inc();
 
+  loop_con.set_features(features);
+
 } /* ctor */
 
 int XioMessenger::pool_hint(uint32_t dsize) {
index 3814eccd092f71cda214cdf7c9199830112b70fc..e1bfe9c334b8e89a71dd34228938205bdfaad6b0 100644 (file)
@@ -54,7 +54,7 @@ private:
 public:
   XioMessenger(CephContext *cct, entity_name_t name,
               string mname, uint64_t nonce,
-              DispatchStrategy* ds = new QueueStrategy(1));
+              DispatchStrategy* ds = new QueueStrategy(1), uint64_t features);
 
   virtual ~XioMessenger();