aboutsummaryrefslogtreecommitdiffstats
path: root/net/ceph/messenger.c
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2012-05-27 00:26:43 -0400
committerAlex Elder <elder@dreamhost.com>2012-06-01 09:37:56 -0400
commit15d9882c336db2db73ccf9871ae2398e452f694c (patch)
treecfa0c726a69b68f51b344d50114a2961019c1231 /net/ceph/messenger.c
parente22004235a900213625acd6583ac913d5a30c155 (diff)
libceph: embed ceph messenger structure in ceph_client
A ceph client has a pointer to a ceph messenger structure in it. There is always exactly one ceph messenger for a ceph client, so there is no need to allocate it separate from the ceph client structure. Switch the ceph_client structure to embed its ceph_messenger structure. Signed-off-by: Alex Elder <elder@inktank.com> Reviewed-by: Yehuda Sadeh <yehuda@inktank.com> Reviewed-by: Sage Weil <sage@inktank.com>
Diffstat (limited to 'net/ceph/messenger.c')
-rw-r--r--net/ceph/messenger.c30
1 files changed, 9 insertions, 21 deletions
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index 2ca491fc50e2..d8423a3f6698 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -2245,18 +2245,14 @@ out:
2245 2245
2246 2246
2247/* 2247/*
2248 * create a new messenger instance 2248 * initialize a new messenger instance
2249 */ 2249 */
2250struct ceph_messenger *ceph_messenger_create(struct ceph_entity_addr *myaddr, 2250void ceph_messenger_init(struct ceph_messenger *msgr,
2251 u32 supported_features, 2251 struct ceph_entity_addr *myaddr,
2252 u32 required_features) 2252 u32 supported_features,
2253 u32 required_features,
2254 bool nocrc)
2253{ 2255{
2254 struct ceph_messenger *msgr;
2255
2256 msgr = kzalloc(sizeof(*msgr), GFP_KERNEL);
2257 if (msgr == NULL)
2258 return ERR_PTR(-ENOMEM);
2259
2260 msgr->supported_features = supported_features; 2256 msgr->supported_features = supported_features;
2261 msgr->required_features = required_features; 2257 msgr->required_features = required_features;
2262 2258
@@ -2269,19 +2265,11 @@ struct ceph_messenger *ceph_messenger_create(struct ceph_entity_addr *myaddr,
2269 msgr->inst.addr.type = 0; 2265 msgr->inst.addr.type = 0;
2270 get_random_bytes(&msgr->inst.addr.nonce, sizeof(msgr->inst.addr.nonce)); 2266 get_random_bytes(&msgr->inst.addr.nonce, sizeof(msgr->inst.addr.nonce));
2271 encode_my_addr(msgr); 2267 encode_my_addr(msgr);
2268 msgr->nocrc = nocrc;
2272 2269
2273 dout("messenger_create %p\n", msgr); 2270 dout("%s %p\n", __func__, msgr);
2274 return msgr;
2275}
2276EXPORT_SYMBOL(ceph_messenger_create);
2277
2278void ceph_messenger_destroy(struct ceph_messenger *msgr)
2279{
2280 dout("destroy %p\n", msgr);
2281 kfree(msgr);
2282 dout("destroyed messenger %p\n", msgr);
2283} 2271}
2284EXPORT_SYMBOL(ceph_messenger_destroy); 2272EXPORT_SYMBOL(ceph_messenger_init);
2285 2273
2286static void clear_standby(struct ceph_connection *con) 2274static void clear_standby(struct ceph_connection *con)
2287{ 2275{