Skip to content

Commit

Permalink
libceph, ceph: add __init attribution to init funcitons
Browse files Browse the repository at this point in the history
Add __init attribution to the functions which are called only once
during initiating/registering operations and deleting unnecessary
symbol exports.

Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
Reviewed-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
  • Loading branch information
Chengguang Xu authored and Ilya Dryomov committed Apr 2, 2018
1 parent 51b10f3 commit 57a35df
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 14 deletions.
2 changes: 1 addition & 1 deletion fs/ceph/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ static const struct fscache_cookie_def ceph_fscache_fsid_object_def = {
.get_key = ceph_fscache_session_get_key,
};

int ceph_fscache_register(void)
int __init ceph_fscache_register(void)
{
return fscache_register_netfs(&ceph_cache_netfs);
}
Expand Down
6 changes: 4 additions & 2 deletions net/ceph/crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -347,10 +347,12 @@ struct key_type key_type_ceph = {
.destroy = ceph_key_destroy,
};

int ceph_crypto_init(void) {
int __init ceph_crypto_init(void)
{
return register_key_type(&key_type_ceph);
}

void ceph_crypto_shutdown(void) {
void ceph_crypto_shutdown(void)
{
unregister_key_type(&key_type_ceph);
}
7 changes: 2 additions & 5 deletions net/ceph/debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ CEPH_DEFINE_SHOW_FUNC(monc_show)
CEPH_DEFINE_SHOW_FUNC(osdc_show)
CEPH_DEFINE_SHOW_FUNC(client_options_show)

int ceph_debugfs_init(void)
int __init ceph_debugfs_init(void)
{
ceph_debugfs_dir = debugfs_create_dir("ceph", NULL);
if (!ceph_debugfs_dir)
Expand Down Expand Up @@ -477,7 +477,7 @@ void ceph_debugfs_client_cleanup(struct ceph_client *client)

#else /* CONFIG_DEBUG_FS */

int ceph_debugfs_init(void)
int __init ceph_debugfs_init(void)
{
return 0;
}
Expand All @@ -496,6 +496,3 @@ void ceph_debugfs_client_cleanup(struct ceph_client *client)
}

#endif /* CONFIG_DEBUG_FS */

EXPORT_SYMBOL(ceph_debugfs_init);
EXPORT_SYMBOL(ceph_debugfs_cleanup);
4 changes: 1 addition & 3 deletions net/ceph/messenger.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ static void _ceph_msgr_exit(void)
ceph_msgr_slab_exit();
}

int ceph_msgr_init(void)
int __init ceph_msgr_init(void)
{
if (ceph_msgr_slab_init())
return -ENOMEM;
Expand All @@ -299,15 +299,13 @@ int ceph_msgr_init(void)

return -ENOMEM;
}
EXPORT_SYMBOL(ceph_msgr_init);

void ceph_msgr_exit(void)
{
BUG_ON(ceph_msgr_wq == NULL);

_ceph_msgr_exit();
}
EXPORT_SYMBOL(ceph_msgr_exit);

void ceph_msgr_flush(void)
{
Expand Down
4 changes: 1 addition & 3 deletions net/ceph/osd_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -5106,7 +5106,7 @@ int ceph_osdc_writepages(struct ceph_osd_client *osdc, struct ceph_vino vino,
}
EXPORT_SYMBOL(ceph_osdc_writepages);

int ceph_osdc_setup(void)
int __init ceph_osdc_setup(void)
{
size_t size = sizeof(struct ceph_osd_request) +
CEPH_OSD_SLAB_OPS * sizeof(struct ceph_osd_req_op);
Expand All @@ -5117,15 +5117,13 @@ int ceph_osdc_setup(void)

return ceph_osd_request_cache ? 0 : -ENOMEM;
}
EXPORT_SYMBOL(ceph_osdc_setup);

void ceph_osdc_cleanup(void)
{
BUG_ON(!ceph_osd_request_cache);
kmem_cache_destroy(ceph_osd_request_cache);
ceph_osd_request_cache = NULL;
}
EXPORT_SYMBOL(ceph_osdc_cleanup);

/*
* handle incoming message
Expand Down

0 comments on commit 57a35df

Please sign in to comment.