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>
This commit is contained in:
@@ -468,19 +468,15 @@ struct ceph_client *ceph_create_client(struct ceph_options *opt, void *private,
|
||||
/* msgr */
|
||||
if (ceph_test_opt(client, MYIP))
|
||||
myaddr = &client->options->my_addr;
|
||||
client->msgr = ceph_messenger_create(myaddr,
|
||||
client->supported_features,
|
||||
client->required_features);
|
||||
if (IS_ERR(client->msgr)) {
|
||||
err = PTR_ERR(client->msgr);
|
||||
goto fail;
|
||||
}
|
||||
client->msgr->nocrc = ceph_test_opt(client, NOCRC);
|
||||
ceph_messenger_init(&client->msgr, myaddr,
|
||||
client->supported_features,
|
||||
client->required_features,
|
||||
ceph_test_opt(client, NOCRC));
|
||||
|
||||
/* subsystems */
|
||||
err = ceph_monc_init(&client->monc, client);
|
||||
if (err < 0)
|
||||
goto fail_msgr;
|
||||
goto fail;
|
||||
err = ceph_osdc_init(&client->osdc, client);
|
||||
if (err < 0)
|
||||
goto fail_monc;
|
||||
@@ -489,8 +485,6 @@ struct ceph_client *ceph_create_client(struct ceph_options *opt, void *private,
|
||||
|
||||
fail_monc:
|
||||
ceph_monc_stop(&client->monc);
|
||||
fail_msgr:
|
||||
ceph_messenger_destroy(client->msgr);
|
||||
fail:
|
||||
kfree(client);
|
||||
return ERR_PTR(err);
|
||||
@@ -515,8 +509,6 @@ void ceph_destroy_client(struct ceph_client *client)
|
||||
|
||||
ceph_debugfs_client_cleanup(client);
|
||||
|
||||
ceph_messenger_destroy(client->msgr);
|
||||
|
||||
ceph_destroy_options(client->options);
|
||||
|
||||
kfree(client);
|
||||
|
Reference in New Issue
Block a user