Message ID | 1520685125-63426-1-git-send-email-cgxu519@gmx.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Sat, Mar 10, 2018 at 1:32 PM, Chengguang Xu <cgxu519@gmx.com> wrote: > 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> > --- > fs/ceph/cache.c | 2 +- > net/ceph/crypto.c | 6 ++++-- > net/ceph/debugfs.c | 7 ++----- > net/ceph/messenger.c | 2 +- > net/ceph/osd_client.c | 6 ++---- > 5 files changed, 10 insertions(+), 13 deletions(-) > > diff --git a/fs/ceph/cache.c b/fs/ceph/cache.c > index a3ab265..9e22886 100644 > --- a/fs/ceph/cache.c > +++ b/fs/ceph/cache.c > @@ -71,7 +71,7 @@ static uint16_t ceph_fscache_session_get_key(const void *cookie_netfs_data, > .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); > } > diff --git a/net/ceph/crypto.c b/net/ceph/crypto.c > index bf9d079..02172c4 100644 > --- a/net/ceph/crypto.c > +++ b/net/ceph/crypto.c > @@ -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); > } > diff --git a/net/ceph/debugfs.c b/net/ceph/debugfs.c > index 1eef680..92fe675 100644 > --- a/net/ceph/debugfs.c > +++ b/net/ceph/debugfs.c > @@ -389,7 +389,7 @@ static int client_options_show(struct seq_file *s, void *p) > 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) > @@ -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; > } > @@ -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); > diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c > index 8a4d375..33661cb 100644 > --- a/net/ceph/messenger.c > +++ b/net/ceph/messenger.c > @@ -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; > diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c > index 2814dba..62642196 100644 > --- a/net/ceph/osd_client.c > +++ b/net/ceph/osd_client.c > @@ -5065,7 +5065,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); > @@ -5076,15 +5076,13 @@ int ceph_osdc_setup(void) > > return ceph_osd_request_cache ? 0 : -ENOMEM; > } > -EXPORT_SYMBOL(ceph_osdc_setup); > > -void ceph_osdc_cleanup(void) > +void __exit ceph_osdc_cleanup(void) Hi Chengguang, Applied without this __exit change. It's only because ceph_osdc_setup() is the last init step were you able to do this. If a new step is added to init_ceph_lib(), we would need to turn ceph_osdc_cleanup() back into a normal function. Thanks, Ilya -- To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
> Sent: Wednesday, March 14, 2018 at 1:47 AM > From: "Ilya Dryomov" <idryomov@gmail.com> > To: "Chengguang Xu" <cgxu519@gmx.com> > Cc: "Yan, Zheng" <zyan@redhat.com>, "Ceph Development" <ceph-devel@vger.kernel.org> > Subject: Re: [PATCH] ceph, libceph: add __init attribution to init funcitons > > On Sat, Mar 10, 2018 at 1:32 PM, Chengguang Xu <cgxu519@gmx.com> wrote: > > 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> > > --- > > fs/ceph/cache.c | 2 +- > > net/ceph/crypto.c | 6 ++++-- > > net/ceph/debugfs.c | 7 ++----- > > net/ceph/messenger.c | 2 +- > > net/ceph/osd_client.c | 6 ++---- > > 5 files changed, 10 insertions(+), 13 deletions(-) > > > > diff --git a/fs/ceph/cache.c b/fs/ceph/cache.c > > index a3ab265..9e22886 100644 > > --- a/fs/ceph/cache.c > > +++ b/fs/ceph/cache.c > > @@ -71,7 +71,7 @@ static uint16_t ceph_fscache_session_get_key(const void *cookie_netfs_data, > > .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); > > } > > diff --git a/net/ceph/crypto.c b/net/ceph/crypto.c > > index bf9d079..02172c4 100644 > > --- a/net/ceph/crypto.c > > +++ b/net/ceph/crypto.c > > @@ -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); > > } > > diff --git a/net/ceph/debugfs.c b/net/ceph/debugfs.c > > index 1eef680..92fe675 100644 > > --- a/net/ceph/debugfs.c > > +++ b/net/ceph/debugfs.c > > @@ -389,7 +389,7 @@ static int client_options_show(struct seq_file *s, void *p) > > 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) > > @@ -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; > > } > > @@ -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); > > diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c > > index 8a4d375..33661cb 100644 > > --- a/net/ceph/messenger.c > > +++ b/net/ceph/messenger.c > > @@ -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; > > diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c > > index 2814dba..62642196 100644 > > --- a/net/ceph/osd_client.c > > +++ b/net/ceph/osd_client.c > > @@ -5065,7 +5065,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); > > @@ -5076,15 +5076,13 @@ int ceph_osdc_setup(void) > > > > return ceph_osd_request_cache ? 0 : -ENOMEM; > > } > > -EXPORT_SYMBOL(ceph_osdc_setup); > > > > -void ceph_osdc_cleanup(void) > > +void __exit ceph_osdc_cleanup(void) > > Hi Chengguang, > > Applied without this __exit change. > > It's only because ceph_osdc_setup() is the last init step were you able > to do this. If a new step is added to init_ceph_lib(), we would need to > turn ceph_osdc_cleanup() back into a normal function. Okay, Thanks for your kind explanation. Thanks, Chengguang. -- To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/fs/ceph/cache.c b/fs/ceph/cache.c index a3ab265..9e22886 100644 --- a/fs/ceph/cache.c +++ b/fs/ceph/cache.c @@ -71,7 +71,7 @@ static uint16_t ceph_fscache_session_get_key(const void *cookie_netfs_data, .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); } diff --git a/net/ceph/crypto.c b/net/ceph/crypto.c index bf9d079..02172c4 100644 --- a/net/ceph/crypto.c +++ b/net/ceph/crypto.c @@ -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); } diff --git a/net/ceph/debugfs.c b/net/ceph/debugfs.c index 1eef680..92fe675 100644 --- a/net/ceph/debugfs.c +++ b/net/ceph/debugfs.c @@ -389,7 +389,7 @@ static int client_options_show(struct seq_file *s, void *p) 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) @@ -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; } @@ -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); diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index 8a4d375..33661cb 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c @@ -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; diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index 2814dba..62642196 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c @@ -5065,7 +5065,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); @@ -5076,15 +5076,13 @@ int ceph_osdc_setup(void) return ceph_osd_request_cache ? 0 : -ENOMEM; } -EXPORT_SYMBOL(ceph_osdc_setup); -void ceph_osdc_cleanup(void) +void __exit 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
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> --- fs/ceph/cache.c | 2 +- net/ceph/crypto.c | 6 ++++-- net/ceph/debugfs.c | 7 ++----- net/ceph/messenger.c | 2 +- net/ceph/osd_client.c | 6 ++---- 5 files changed, 10 insertions(+), 13 deletions(-)