int count = 0; // digit count
int off = 0;
+ memset(&a, 0, sizeof(a));
+
while (1) {
// parse the #.
int val = 0;
* 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;
receiver: mask against ~PAGE_MASK */
struct ceph_entity_inst src, orig_src;
- __le32 dst_erank;
+ __le32 reserved;
__le32 crc; /* header crc32c */
} __attribute__ ((packed));
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;
entity_addr_t SimpleMessenger::Endpoint::get_myaddr()
{
entity_addr_t a = rank->rank_addr;
- a.erank = 0;
return a;
}
}
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()) {
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;
}
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 )) {
}
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);
__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;
}
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;
}
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);
}
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; }
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;
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);