aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/ceph/mds_client.c2
-rw-r--r--include/linux/ceph/libceph.h2
-rw-r--r--include/linux/ceph/messenger.h9
-rw-r--r--net/ceph/ceph_common.c18
-rw-r--r--net/ceph/messenger.c30
-rw-r--r--net/ceph/mon_client.c6
-rw-r--r--net/ceph/osd_client.c4
7 files changed, 26 insertions, 45 deletions
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index 200bc87eceb1..ad30261cd4c0 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -394,7 +394,7 @@ static struct ceph_mds_session *register_session(struct ceph_mds_client *mdsc,
394 s->s_seq = 0; 394 s->s_seq = 0;
395 mutex_init(&s->s_mutex); 395 mutex_init(&s->s_mutex);
396 396
397 ceph_con_init(mdsc->fsc->client->msgr, &s->s_con); 397 ceph_con_init(&mdsc->fsc->client->msgr, &s->s_con);
398 s->s_con.private = s; 398 s->s_con.private = s;
399 s->s_con.ops = &mds_con_ops; 399 s->s_con.ops = &mds_con_ops;
400 s->s_con.peer_name.type = CEPH_ENTITY_TYPE_MDS; 400 s->s_con.peer_name.type = CEPH_ENTITY_TYPE_MDS;
diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h
index 92eef7c3d3c5..927361c4b0a8 100644
--- a/include/linux/ceph/libceph.h
+++ b/include/linux/ceph/libceph.h
@@ -131,7 +131,7 @@ struct ceph_client {
131 u32 supported_features; 131 u32 supported_features;
132 u32 required_features; 132 u32 required_features;
133 133
134 struct ceph_messenger *msgr; /* messenger instance */ 134 struct ceph_messenger msgr; /* messenger instance */
135 struct ceph_mon_client monc; 135 struct ceph_mon_client monc;
136 struct ceph_osd_client osdc; 136 struct ceph_osd_client osdc;
137 137
diff --git a/include/linux/ceph/messenger.h b/include/linux/ceph/messenger.h
index 74f6c9bd8074..3fbd4be804ed 100644
--- a/include/linux/ceph/messenger.h
+++ b/include/linux/ceph/messenger.h
@@ -211,10 +211,11 @@ extern int ceph_msgr_init(void);
211extern void ceph_msgr_exit(void); 211extern void ceph_msgr_exit(void);
212extern void ceph_msgr_flush(void); 212extern void ceph_msgr_flush(void);
213 213
214extern struct ceph_messenger *ceph_messenger_create( 214extern void ceph_messenger_init(struct ceph_messenger *msgr,
215 struct ceph_entity_addr *myaddr, 215 struct ceph_entity_addr *myaddr,
216 u32 features, u32 required); 216 u32 supported_features,
217extern void ceph_messenger_destroy(struct ceph_messenger *); 217 u32 required_features,
218 bool nocrc);
218 219
219extern void ceph_con_init(struct ceph_messenger *msgr, 220extern void ceph_con_init(struct ceph_messenger *msgr,
220 struct ceph_connection *con); 221 struct ceph_connection *con);
diff --git a/net/ceph/ceph_common.c b/net/ceph/ceph_common.c
index cc913193d992..2de3ea1bbd64 100644
--- a/net/ceph/ceph_common.c
+++ b/net/ceph/ceph_common.c
@@ -468,19 +468,15 @@ struct ceph_client *ceph_create_client(struct ceph_options *opt, void *private,
468 /* msgr */ 468 /* msgr */
469 if (ceph_test_opt(client, MYIP)) 469 if (ceph_test_opt(client, MYIP))
470 myaddr = &client->options->my_addr; 470 myaddr = &client->options->my_addr;
471 client->msgr = ceph_messenger_create(myaddr, 471 ceph_messenger_init(&client->msgr, myaddr,
472 client->supported_features, 472 client->supported_features,
473 client->required_features); 473 client->required_features,
474 if (IS_ERR(client->msgr)) { 474 ceph_test_opt(client, NOCRC));
475 err = PTR_ERR(client->msgr);
476 goto fail;
477 }
478 client->msgr->nocrc = ceph_test_opt(client, NOCRC);
479 475
480 /* subsystems */ 476 /* subsystems */
481 err = ceph_monc_init(&client->monc, client); 477 err = ceph_monc_init(&client->monc, client);
482 if (err < 0) 478 if (err < 0)
483 goto fail_msgr; 479 goto fail;
484 err = ceph_osdc_init(&client->osdc, client); 480 err = ceph_osdc_init(&client->osdc, client);
485 if (err < 0) 481 if (err < 0)
486 goto fail_monc; 482 goto fail_monc;
@@ -489,8 +485,6 @@ struct ceph_client *ceph_create_client(struct ceph_options *opt, void *private,
489 485
490fail_monc: 486fail_monc:
491 ceph_monc_stop(&client->monc); 487 ceph_monc_stop(&client->monc);
492fail_msgr:
493 ceph_messenger_destroy(client->msgr);
494fail: 488fail:
495 kfree(client); 489 kfree(client);
496 return ERR_PTR(err); 490 return ERR_PTR(err);
@@ -515,8 +509,6 @@ void ceph_destroy_client(struct ceph_client *client)
515 509
516 ceph_debugfs_client_cleanup(client); 510 ceph_debugfs_client_cleanup(client);
517 511
518 ceph_messenger_destroy(client->msgr);
519
520 ceph_destroy_options(client->options); 512 ceph_destroy_options(client->options);
521 513
522 kfree(client); 514 kfree(client);
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{
diff --git a/net/ceph/mon_client.c b/net/ceph/mon_client.c
index 1845cde26227..704dc95dc620 100644
--- a/net/ceph/mon_client.c
+++ b/net/ceph/mon_client.c
@@ -763,7 +763,7 @@ int ceph_monc_init(struct ceph_mon_client *monc, struct ceph_client *cl)
763 monc->con = kmalloc(sizeof(*monc->con), GFP_KERNEL); 763 monc->con = kmalloc(sizeof(*monc->con), GFP_KERNEL);
764 if (!monc->con) 764 if (!monc->con)
765 goto out_monmap; 765 goto out_monmap;
766 ceph_con_init(monc->client->msgr, monc->con); 766 ceph_con_init(&monc->client->msgr, monc->con);
767 monc->con->private = monc; 767 monc->con->private = monc;
768 monc->con->ops = &mon_con_ops; 768 monc->con->ops = &mon_con_ops;
769 769
@@ -880,8 +880,8 @@ static void handle_auth_reply(struct ceph_mon_client *monc,
880 } else if (!was_auth && monc->auth->ops->is_authenticated(monc->auth)) { 880 } else if (!was_auth && monc->auth->ops->is_authenticated(monc->auth)) {
881 dout("authenticated, starting session\n"); 881 dout("authenticated, starting session\n");
882 882
883 monc->client->msgr->inst.name.type = CEPH_ENTITY_TYPE_CLIENT; 883 monc->client->msgr.inst.name.type = CEPH_ENTITY_TYPE_CLIENT;
884 monc->client->msgr->inst.name.num = 884 monc->client->msgr.inst.name.num =
885 cpu_to_le64(monc->auth->global_id); 885 cpu_to_le64(monc->auth->global_id);
886 886
887 __send_subscribe(monc); 887 __send_subscribe(monc);
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index b098e7b591f0..cca4c7f1c780 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -639,7 +639,7 @@ static struct ceph_osd *create_osd(struct ceph_osd_client *osdc)
639 INIT_LIST_HEAD(&osd->o_osd_lru); 639 INIT_LIST_HEAD(&osd->o_osd_lru);
640 osd->o_incarnation = 1; 640 osd->o_incarnation = 1;
641 641
642 ceph_con_init(osdc->client->msgr, &osd->o_con); 642 ceph_con_init(&osdc->client->msgr, &osd->o_con);
643 osd->o_con.private = osd; 643 osd->o_con.private = osd;
644 osd->o_con.ops = &osd_con_ops; 644 osd->o_con.ops = &osd_con_ops;
645 osd->o_con.peer_name.type = CEPH_ENTITY_TYPE_OSD; 645 osd->o_con.peer_name.type = CEPH_ENTITY_TYPE_OSD;
@@ -1391,7 +1391,7 @@ void ceph_osdc_handle_map(struct ceph_osd_client *osdc, struct ceph_msg *msg)
1391 epoch, maplen); 1391 epoch, maplen);
1392 newmap = osdmap_apply_incremental(&p, next, 1392 newmap = osdmap_apply_incremental(&p, next,
1393 osdc->osdmap, 1393 osdc->osdmap,
1394 osdc->client->msgr); 1394 &osdc->client->msgr);
1395 if (IS_ERR(newmap)) { 1395 if (IS_ERR(newmap)) {
1396 err = PTR_ERR(newmap); 1396 err = PTR_ERR(newmap);
1397 goto bad; 1397 goto bad;