mirror of https://gitee.com/openkylin/linux.git
ceph: remove unused erank field
The ceph_entity_addr erank field is obsolete; remove it. Get rid of trivial addr comparison helpers while we're at it. Signed-off-by: Sage Weil <sage@newdream.net>
This commit is contained in:
parent
4baa75ef0e
commit
103e2d3ae5
|
@ -1056,16 +1056,15 @@ static int process_banner(struct ceph_connection *con)
|
||||||
* end may not yet know their ip address, so if it's 0.0.0.0, give
|
* end may not yet know their ip address, so if it's 0.0.0.0, give
|
||||||
* them the benefit of the doubt.
|
* them the benefit of the doubt.
|
||||||
*/
|
*/
|
||||||
if (!ceph_entity_addr_is_local(&con->peer_addr,
|
if (memcmp(&con->peer_addr, &con->actual_peer_addr,
|
||||||
&con->actual_peer_addr) &&
|
sizeof(con->peer_addr)) != 0 &&
|
||||||
!(addr_is_blank(&con->actual_peer_addr.in_addr) &&
|
!(addr_is_blank(&con->actual_peer_addr.in_addr) &&
|
||||||
con->actual_peer_addr.nonce == con->peer_addr.nonce)) {
|
con->actual_peer_addr.nonce == con->peer_addr.nonce)) {
|
||||||
pr_warning("wrong peer, want %s/%d, "
|
pr_warning("wrong peer, want %s/%lld, got %s/%lld\n",
|
||||||
"got %s/%d\n",
|
pr_addr(&con->peer_addr.in_addr),
|
||||||
pr_addr(&con->peer_addr.in_addr),
|
le64_to_cpu(con->peer_addr.nonce),
|
||||||
con->peer_addr.nonce,
|
pr_addr(&con->actual_peer_addr.in_addr),
|
||||||
pr_addr(&con->actual_peer_addr.in_addr),
|
le64_to_cpu(con->actual_peer_addr.nonce));
|
||||||
con->actual_peer_addr.nonce);
|
|
||||||
con->error_msg = "wrong peer at address";
|
con->error_msg = "wrong peer at address";
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -1934,8 +1933,7 @@ struct ceph_messenger *ceph_messenger_create(struct ceph_entity_addr *myaddr)
|
||||||
msgr->inst.addr = *myaddr;
|
msgr->inst.addr = *myaddr;
|
||||||
|
|
||||||
/* select a random nonce */
|
/* select a random nonce */
|
||||||
get_random_bytes(&msgr->inst.addr.nonce,
|
get_random_bytes(&msgr->inst.addr.nonce, sizeof(msgr->inst.addr.nonce));
|
||||||
sizeof(msgr->inst.addr.nonce));
|
|
||||||
encode_my_addr(msgr);
|
encode_my_addr(msgr);
|
||||||
|
|
||||||
dout("messenger_create %p\n", msgr);
|
dout("messenger_create %p\n", msgr);
|
||||||
|
@ -1966,7 +1964,6 @@ void ceph_con_send(struct ceph_connection *con, struct ceph_msg *msg)
|
||||||
msg->hdr.src.name = con->msgr->inst.name;
|
msg->hdr.src.name = con->msgr->inst.name;
|
||||||
msg->hdr.src.addr = con->msgr->my_enc_addr;
|
msg->hdr.src.addr = con->msgr->my_enc_addr;
|
||||||
msg->hdr.orig_src = msg->hdr.src;
|
msg->hdr.orig_src = msg->hdr.src;
|
||||||
msg->hdr.dst_erank = con->peer_addr.erank;
|
|
||||||
|
|
||||||
/* queue */
|
/* queue */
|
||||||
mutex_lock(&con->mutex);
|
mutex_lock(&con->mutex);
|
||||||
|
|
|
@ -88,7 +88,7 @@ int ceph_monmap_contains(struct ceph_monmap *m, struct ceph_entity_addr *addr)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < m->num_mon; i++)
|
for (i = 0; i < m->num_mon; i++)
|
||||||
if (ceph_entity_addr_equal(addr, &m->mon_inst[i].addr))
|
if (memcmp(addr, &m->mon_inst[i].addr, sizeof(*addr)) == 0)
|
||||||
return 1;
|
return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -503,7 +503,6 @@ static int build_initial_monmap(struct ceph_mon_client *monc)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
for (i = 0; i < num_mon; i++) {
|
for (i = 0; i < num_mon; i++) {
|
||||||
monc->monmap->mon_inst[i].addr = mon_addr[i];
|
monc->monmap->mon_inst[i].addr = mon_addr[i];
|
||||||
monc->monmap->mon_inst[i].addr.erank = 0;
|
|
||||||
monc->monmap->mon_inst[i].addr.nonce = 0;
|
monc->monmap->mon_inst[i].addr.nonce = 0;
|
||||||
monc->monmap->mon_inst[i].name.type =
|
monc->monmap->mon_inst[i].name.type =
|
||||||
CEPH_ENTITY_TYPE_MON;
|
CEPH_ENTITY_TYPE_MON;
|
||||||
|
|
|
@ -61,24 +61,10 @@ extern const char *ceph_entity_type_name(int type);
|
||||||
* entity_addr -- network address
|
* entity_addr -- network address
|
||||||
*/
|
*/
|
||||||
struct ceph_entity_addr {
|
struct ceph_entity_addr {
|
||||||
__le32 erank; /* entity's rank in process */
|
__le64 nonce; /* unique id for process (e.g. pid) */
|
||||||
__le32 nonce; /* unique id for process (e.g. pid) */
|
|
||||||
struct sockaddr_storage in_addr;
|
struct sockaddr_storage in_addr;
|
||||||
} __attribute__ ((packed));
|
} __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_inst {
|
||||||
struct ceph_entity_name name;
|
struct ceph_entity_name name;
|
||||||
struct ceph_entity_addr addr;
|
struct ceph_entity_addr addr;
|
||||||
|
@ -147,7 +133,7 @@ struct ceph_msg_header {
|
||||||
receiver: mask against ~PAGE_MASK */
|
receiver: mask against ~PAGE_MASK */
|
||||||
|
|
||||||
struct ceph_entity_inst src, orig_src;
|
struct ceph_entity_inst src, orig_src;
|
||||||
__le32 dst_erank;
|
__le32 reserved;
|
||||||
__le32 crc; /* header crc32c */
|
__le32 crc; /* header crc32c */
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
|
|
|
@ -821,9 +821,10 @@ static void kick_requests(struct ceph_osd_client *osdc,
|
||||||
|
|
||||||
n = rb_next(p);
|
n = rb_next(p);
|
||||||
if (!ceph_osd_is_up(osdc->osdmap, osd->o_osd) ||
|
if (!ceph_osd_is_up(osdc->osdmap, osd->o_osd) ||
|
||||||
!ceph_entity_addr_equal(&osd->o_con.peer_addr,
|
memcmp(&osd->o_con.peer_addr,
|
||||||
ceph_osd_addr(osdc->osdmap,
|
ceph_osd_addr(osdc->osdmap,
|
||||||
osd->o_osd)))
|
osd->o_osd),
|
||||||
|
sizeof(struct ceph_entity_addr)) != 0)
|
||||||
reset_osd(osdc, osd);
|
reset_osd(osdc, osd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue