diff options
author | Sage Weil <sage@newdream.net> | 2010-01-07 19:12:36 -0500 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2010-01-14 15:23:38 -0500 |
commit | 103e2d3ae57d38d18aaac1b327266c1407499ac1 (patch) | |
tree | 9e46032de5680bd987e8fdd16753856e496812e6 /fs/ceph | |
parent | 4baa75ef0ed29adae03fcbbaa9aca1511a5a8cc9 (diff) |
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>
Diffstat (limited to 'fs/ceph')
-rw-r--r-- | fs/ceph/messenger.c | 19 | ||||
-rw-r--r-- | fs/ceph/mon_client.c | 3 | ||||
-rw-r--r-- | fs/ceph/msgr.h | 18 | ||||
-rw-r--r-- | fs/ceph/osd_client.c | 7 |
4 files changed, 15 insertions, 32 deletions
diff --git a/fs/ceph/messenger.c b/fs/ceph/messenger.c index c1106e8360f0..1360708d7505 100644 --- a/fs/ceph/messenger.c +++ b/fs/ceph/messenger.c | |||
@@ -1056,16 +1056,15 @@ static int process_banner(struct ceph_connection *con) | |||
1056 | * end may not yet know their ip address, so if it's 0.0.0.0, give | 1056 | * end may not yet know their ip address, so if it's 0.0.0.0, give |
1057 | * them the benefit of the doubt. | 1057 | * them the benefit of the doubt. |
1058 | */ | 1058 | */ |
1059 | if (!ceph_entity_addr_is_local(&con->peer_addr, | 1059 | if (memcmp(&con->peer_addr, &con->actual_peer_addr, |
1060 | &con->actual_peer_addr) && | 1060 | sizeof(con->peer_addr)) != 0 && |
1061 | !(addr_is_blank(&con->actual_peer_addr.in_addr) && | 1061 | !(addr_is_blank(&con->actual_peer_addr.in_addr) && |
1062 | con->actual_peer_addr.nonce == con->peer_addr.nonce)) { | 1062 | con->actual_peer_addr.nonce == con->peer_addr.nonce)) { |
1063 | pr_warning("wrong peer, want %s/%d, " | 1063 | pr_warning("wrong peer, want %s/%lld, got %s/%lld\n", |
1064 | "got %s/%d\n", | 1064 | pr_addr(&con->peer_addr.in_addr), |
1065 | pr_addr(&con->peer_addr.in_addr), | 1065 | le64_to_cpu(con->peer_addr.nonce), |
1066 | con->peer_addr.nonce, | 1066 | pr_addr(&con->actual_peer_addr.in_addr), |
1067 | pr_addr(&con->actual_peer_addr.in_addr), | 1067 | le64_to_cpu(con->actual_peer_addr.nonce)); |
1068 | con->actual_peer_addr.nonce); | ||
1069 | con->error_msg = "wrong peer at address"; | 1068 | con->error_msg = "wrong peer at address"; |
1070 | return -1; | 1069 | return -1; |
1071 | } | 1070 | } |
@@ -1934,8 +1933,7 @@ struct ceph_messenger *ceph_messenger_create(struct ceph_entity_addr *myaddr) | |||
1934 | msgr->inst.addr = *myaddr; | 1933 | msgr->inst.addr = *myaddr; |
1935 | 1934 | ||
1936 | /* select a random nonce */ | 1935 | /* select a random nonce */ |
1937 | get_random_bytes(&msgr->inst.addr.nonce, | 1936 | get_random_bytes(&msgr->inst.addr.nonce, sizeof(msgr->inst.addr.nonce)); |
1938 | sizeof(msgr->inst.addr.nonce)); | ||
1939 | encode_my_addr(msgr); | 1937 | encode_my_addr(msgr); |
1940 | 1938 | ||
1941 | dout("messenger_create %p\n", msgr); | 1939 | dout("messenger_create %p\n", msgr); |
@@ -1966,7 +1964,6 @@ void ceph_con_send(struct ceph_connection *con, struct ceph_msg *msg) | |||
1966 | msg->hdr.src.name = con->msgr->inst.name; | 1964 | msg->hdr.src.name = con->msgr->inst.name; |
1967 | msg->hdr.src.addr = con->msgr->my_enc_addr; | 1965 | msg->hdr.src.addr = con->msgr->my_enc_addr; |
1968 | msg->hdr.orig_src = msg->hdr.src; | 1966 | msg->hdr.orig_src = msg->hdr.src; |
1969 | msg->hdr.dst_erank = con->peer_addr.erank; | ||
1970 | 1967 | ||
1971 | /* queue */ | 1968 | /* queue */ |
1972 | mutex_lock(&con->mutex); | 1969 | mutex_lock(&con->mutex); |
diff --git a/fs/ceph/mon_client.c b/fs/ceph/mon_client.c index bb94006fc686..223e8bc207e3 100644 --- a/fs/ceph/mon_client.c +++ b/fs/ceph/mon_client.c | |||
@@ -88,7 +88,7 @@ int ceph_monmap_contains(struct ceph_monmap *m, struct ceph_entity_addr *addr) | |||
88 | int i; | 88 | int i; |
89 | 89 | ||
90 | for (i = 0; i < m->num_mon; i++) | 90 | for (i = 0; i < m->num_mon; i++) |
91 | if (ceph_entity_addr_equal(addr, &m->mon_inst[i].addr)) | 91 | if (memcmp(addr, &m->mon_inst[i].addr, sizeof(*addr)) == 0) |
92 | return 1; | 92 | return 1; |
93 | return 0; | 93 | return 0; |
94 | } | 94 | } |
@@ -503,7 +503,6 @@ static int build_initial_monmap(struct ceph_mon_client *monc) | |||
503 | return -ENOMEM; | 503 | return -ENOMEM; |
504 | for (i = 0; i < num_mon; i++) { | 504 | for (i = 0; i < num_mon; i++) { |
505 | monc->monmap->mon_inst[i].addr = mon_addr[i]; | 505 | monc->monmap->mon_inst[i].addr = mon_addr[i]; |
506 | monc->monmap->mon_inst[i].addr.erank = 0; | ||
507 | monc->monmap->mon_inst[i].addr.nonce = 0; | 506 | monc->monmap->mon_inst[i].addr.nonce = 0; |
508 | monc->monmap->mon_inst[i].name.type = | 507 | monc->monmap->mon_inst[i].name.type = |
509 | CEPH_ENTITY_TYPE_MON; | 508 | CEPH_ENTITY_TYPE_MON; |
diff --git a/fs/ceph/msgr.h b/fs/ceph/msgr.h index be83f93182ee..40b6189aa9e3 100644 --- a/fs/ceph/msgr.h +++ b/fs/ceph/msgr.h | |||
@@ -61,24 +61,10 @@ extern const char *ceph_entity_type_name(int type); | |||
61 | * entity_addr -- network address | 61 | * entity_addr -- network address |
62 | */ | 62 | */ |
63 | struct ceph_entity_addr { | 63 | struct ceph_entity_addr { |
64 | __le32 erank; /* entity's rank in process */ | 64 | __le64 nonce; /* unique id for process (e.g. pid) */ |
65 | __le32 nonce; /* unique id for process (e.g. pid) */ | ||
66 | struct sockaddr_storage in_addr; | 65 | struct sockaddr_storage in_addr; |
67 | } __attribute__ ((packed)); | 66 | } __attribute__ ((packed)); |
68 | 67 | ||
69 | static inline bool ceph_entity_addr_is_local(const struct ceph_entity_addr *a, | ||
70 | const struct ceph_entity_addr *b) | ||
71 | { | ||
72 | return a->nonce == b->nonce && | ||
73 | memcmp(&a->in_addr, &b->in_addr, sizeof(a->in_addr)) == 0; | ||
74 | } | ||
75 | |||
76 | static inline bool ceph_entity_addr_equal(const struct ceph_entity_addr *a, | ||
77 | const struct ceph_entity_addr *b) | ||
78 | { | ||
79 | return memcmp(a, b, sizeof(*a)) == 0; | ||
80 | } | ||
81 | |||
82 | struct ceph_entity_inst { | 68 | struct ceph_entity_inst { |
83 | struct ceph_entity_name name; | 69 | struct ceph_entity_name name; |
84 | struct ceph_entity_addr addr; | 70 | struct ceph_entity_addr addr; |
@@ -147,7 +133,7 @@ struct ceph_msg_header { | |||
147 | receiver: mask against ~PAGE_MASK */ | 133 | receiver: mask against ~PAGE_MASK */ |
148 | 134 | ||
149 | struct ceph_entity_inst src, orig_src; | 135 | struct ceph_entity_inst src, orig_src; |
150 | __le32 dst_erank; | 136 | __le32 reserved; |
151 | __le32 crc; /* header crc32c */ | 137 | __le32 crc; /* header crc32c */ |
152 | } __attribute__ ((packed)); | 138 | } __attribute__ ((packed)); |
153 | 139 | ||
diff --git a/fs/ceph/osd_client.c b/fs/ceph/osd_client.c index a0aac436d5d4..80b868f7a0fc 100644 --- a/fs/ceph/osd_client.c +++ b/fs/ceph/osd_client.c | |||
@@ -821,9 +821,10 @@ static void kick_requests(struct ceph_osd_client *osdc, | |||
821 | 821 | ||
822 | n = rb_next(p); | 822 | n = rb_next(p); |
823 | if (!ceph_osd_is_up(osdc->osdmap, osd->o_osd) || | 823 | if (!ceph_osd_is_up(osdc->osdmap, osd->o_osd) || |
824 | !ceph_entity_addr_equal(&osd->o_con.peer_addr, | 824 | memcmp(&osd->o_con.peer_addr, |
825 | ceph_osd_addr(osdc->osdmap, | 825 | ceph_osd_addr(osdc->osdmap, |
826 | osd->o_osd))) | 826 | osd->o_osd), |
827 | sizeof(struct ceph_entity_addr)) != 0) | ||
827 | reset_osd(osdc, osd); | 828 | reset_osd(osdc, osd); |
828 | } | 829 | } |
829 | } | 830 | } |