]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msgr: remove erank
authorSage Weil <sage@newdream.net>
Fri, 8 Jan 2010 00:10:23 +0000 (16:10 -0800)
committerSage Weil <sage@newdream.net>
Fri, 8 Jan 2010 00:10:23 +0000 (16:10 -0800)
Obsolete, now that we have only a single entity per SimpleMessenger
instance.  Avoid changing protocol by making it a reserved (and ignored)
field.

src/config.cc
src/include/msgr.h
src/msg/SimpleMessenger.cc
src/msg/msg_types.h
src/osd/OSDMap.h

index 375662e24a1dc0f2ee9ffad6ef6c6d65441015a1..124b80818f474db730a8a8bc5bfdbf1802b9302a 100644 (file)
@@ -187,6 +187,8 @@ bool parse_ip_port(const char *s, entity_addr_t& a, const char **end)
   int count = 0; // digit count
   int off = 0;
 
+  memset(&a, 0, sizeof(a));
+
   while (1) {
     // parse the #.
     int val = 0;
index be83f93182ee8040d37b158964c5059f760f0955..40b6189aa9e3497240f9efe0d5ebfa0ff2ff31da 100644 (file)
@@ -61,24 +61,10 @@ extern const char *ceph_entity_type_name(int type);
  * entity_addr -- network address
  */
 struct ceph_entity_addr {
-       __le32 erank;  /* entity's rank in process */
-       __le32 nonce;  /* unique id for process (e.g. pid) */
+       __le64 nonce;  /* unique id for process (e.g. pid) */
        struct sockaddr_storage in_addr;
 } __attribute__ ((packed));
 
-static inline bool ceph_entity_addr_is_local(const struct ceph_entity_addr *a,
-                                            const struct ceph_entity_addr *b)
-{
-       return a->nonce == b->nonce &&
-               memcmp(&a->in_addr, &b->in_addr, sizeof(a->in_addr)) == 0;
-}
-
-static inline bool ceph_entity_addr_equal(const struct ceph_entity_addr *a,
-                                         const struct ceph_entity_addr *b)
-{
-       return memcmp(a, b, sizeof(*a)) == 0;
-}
-
 struct ceph_entity_inst {
        struct ceph_entity_name name;
        struct ceph_entity_addr addr;
@@ -147,7 +133,7 @@ struct ceph_msg_header {
                             receiver: mask against ~PAGE_MASK */
 
        struct ceph_entity_inst src, orig_src;
-       __le32 dst_erank;
+       __le32 reserved;
        __le32 crc;       /* header crc32c */
 } __attribute__ ((packed));
 
index 15f50054891f4bc43366ef74388d07dcc14a55fd..85a0ad05c40a16d37bb94754cebe6a40910e57aa 100644 (file)
@@ -141,7 +141,6 @@ int SimpleMessenger::Accepter::bind(int64_t force_nonce)
     else
       rank->rank_addr.nonce = getpid(); // FIXME: pid might not be best choice here.
   }
-  rank->rank_addr.erank = 0;
 
   dout(1) << "accepter.bind rank_addr is " << rank->rank_addr << " need_addr=" << rank->need_addr << dendl;
   rank->did_bind = true;
@@ -470,7 +469,6 @@ void SimpleMessenger::Endpoint::mark_down(entity_addr_t a)
 entity_addr_t SimpleMessenger::Endpoint::get_myaddr()
 {
   entity_addr_t a = rank->rank_addr;
-  a.erank = 0;
   return a;  
 }
 
@@ -969,7 +967,7 @@ int SimpleMessenger::Pipe::connect()
   }
 
   dout(20) << "connect read peer addr " << paddr << " on socket " << sd << dendl;
-  if (!peer_addr.is_local_to(paddr)) {
+  if (peer_addr != paddr) {
     if (paddr.is_blank_addr() &&
        peer_addr.get_port() == paddr.get_port() &&
        peer_addr.get_nonce() == paddr.get_nonce()) {
@@ -2271,24 +2269,23 @@ void SimpleMessenger::unregister_entity(Endpoint *msgr)
 void SimpleMessenger::submit_message(Message *m, const entity_inst_t& dest, bool lazy)
 {
   const entity_addr_t& dest_addr = dest.addr;
-  m->get_header().dst_erank = dest_addr.erank;
 
   assert(m->nref.test() == 0);
 
   // lookup
   entity_addr_t dest_proc_addr = dest_addr;
-  dest_proc_addr.erank = 0;
+
 
   lock.Lock();
   {
     // local?
-    if (rank_addr.is_local_to(dest_addr)) {
-      if (dest_addr.get_erank() == 0 && local_endpoint) {
+    if (rank_addr == dest_addr) {
+      if (local_endpoint) {
         // local
         dout(20) << "submit_message " << *m << " local" << dendl;
        dispatch_queue.local_delivery(m, m->get_priority());
       } else {
-        derr(0) << "submit_message " << *m << " " << dest_addr << " local but wrong erank? dropping." << dendl;
+        derr(0) << "submit_message " << *m << " " << dest_addr << " local but no local endpoint, dropping." << dendl;
         assert(0);  // hmpf, this is probably mds->mon beacon from newsyn.
        delete m;
       }
@@ -2337,7 +2334,7 @@ void SimpleMessenger::send_keepalive(const entity_inst_t& dest)
   lock.Lock();
   {
     // local?
-    if (!rank_addr.is_local_to(dest_addr)) {
+    if (rank_addr != dest_addr) {
       // remote.
       Pipe *pipe = 0;
       if (rank_pipe.count( dest_proc_addr )) {
index dde038540c64647fecb3188acc995a6c11abead1..cd4b1dd1342a804d9cc5983a9b2c1e939031590e 100644 (file)
@@ -129,15 +129,13 @@ static inline void decode(sockaddr_storage& a, bufferlist::iterator& bl) {
 }
 
 struct entity_addr_t {
-  __u32 erank;
-  __u32 nonce;
+  __u64 nonce;
   sockaddr_storage addr;
 
-  entity_addr_t() : erank(0), nonce(0) { 
+  entity_addr_t() : nonce(0) { 
     memset(&addr, 0, sizeof(addr));
   }
   entity_addr_t(const ceph_entity_addr &o) {
-    erank = o.erank;
     nonce = o.nonce;
     addr = o.in_addr;
     addr.ss_family = ntohs(addr.ss_family);
@@ -146,9 +144,6 @@ struct entity_addr_t {
   __u32 get_nonce() const { return nonce; }
   void set_nonce(__u32 n) { nonce = n; }
   
-  __u32 get_erank() const { return erank; }
-  void set_erank(__u32 r) { erank = r; }
-
   sockaddr_storage &ss_addr() {
     return addr;
   }
@@ -191,17 +186,12 @@ struct entity_addr_t {
 
   operator ceph_entity_addr() const {
     ceph_entity_addr a;
-    a.erank = erank;
     a.nonce = nonce;
     a.in_addr = addr;
     a.in_addr.ss_family = htons(addr.ss_family);
     return a;
   }
 
-  bool is_local_to(const entity_addr_t &o) const {
-    return nonce == o.nonce &&
-      memcmp(&addr, &o.addr, sizeof(addr)) == 0;
-  }
   bool is_same_host(const entity_addr_t &o) const {
     if (addr.ss_family != o.addr.ss_family)
       return false;
@@ -233,12 +223,10 @@ struct entity_addr_t {
   }
 
   void encode(bufferlist& bl) const {
-    ::encode(erank, bl);
     ::encode(nonce, bl);
     ::encode(addr, bl);
   }
   void decode(bufferlist::iterator& bl) {
-    ::decode(erank, bl);
     ::decode(nonce, bl);
     ::decode(addr, bl);
   }
@@ -247,7 +235,7 @@ WRITE_CLASS_ENCODER(entity_addr_t)
 
 inline ostream& operator<<(ostream& out, const entity_addr_t &addr)
 {
-  return out << addr.addr << '/' << addr.nonce << '/' << addr.erank;
+  return out << addr.addr << '/' << addr.nonce;
 }
 
 inline bool operator==(const entity_addr_t& a, const entity_addr_t& b) { return memcmp(&a, &b, sizeof(a)) == 0; }
index 2da8e4d214cdac95248731a36f13576a626564d1..6acd9aa03124be15a13b188222394776daf317a8 100644 (file)
@@ -502,7 +502,7 @@ private:
       if (inc.new_hb_up.empty()) {
        //this is a backward-compatibility hack
        osd_hb_addr[i->first] = i->second;
-       osd_hb_addr[i->first].erank = osd_hb_addr[i->first].erank + 1;
+       //osd_hb_addr[i->first].erank = osd_hb_addr[i->first].erank + 1;
       }
       else osd_hb_addr[i->first] = inc.new_hb_up[i->first];
       osd_info[i->first].up_from = epoch;
@@ -623,7 +623,7 @@ private:
       osd_hb_addr.resize(osd_addr.size());
       for (unsigned i=0; i<osd_addr.size(); i++) {
        osd_hb_addr[i] = osd_addr[i];
-       osd_hb_addr[i].erank = osd_hb_addr[i].erank + 1;
+       //osd_hb_addr[i].erank = osd_hb_addr[i].erank + 1;
       }
     }
     ::decode(osd_info, p);