From patchwork Sat Mar 10 12:32:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chengguang Xu X-Patchwork-Id: 10273451 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 75D17605CE for ; Sat, 10 Mar 2018 12:32:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5418129AFE for ; Sat, 10 Mar 2018 12:32:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 488B229B08; Sat, 10 Mar 2018 12:32:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A9E8629AFE for ; Sat, 10 Mar 2018 12:32:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932838AbeCJMcX (ORCPT ); Sat, 10 Mar 2018 07:32:23 -0500 Received: from mout.gmx.net ([212.227.15.19]:44925 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752172AbeCJMcW (ORCPT ); Sat, 10 Mar 2018 07:32:22 -0500 Received: from juanniu018037.ss.mogujie.org ([122.225.81.134]) by mail.gmx.com (mrgmx001 [212.227.17.184]) with ESMTPSA (Nemesis) id 0Meh8S-1fIlAF359k-00OCfm; Sat, 10 Mar 2018 13:32:16 +0100 From: Chengguang Xu To: zyan@redhat.com, idryomov@gmail.com Cc: ceph-devel@vger.kernel.org, Chengguang Xu Subject: [PATCH] ceph, libceph: add __init attribution to init funcitons Date: Sat, 10 Mar 2018 20:32:05 +0800 Message-Id: <1520685125-63426-1-git-send-email-cgxu519@gmx.com> X-Mailer: git-send-email 1.8.3.1 X-Provags-ID: V03:K0:Go9NZcwMzZJL04NvuaWT1b8TipAKHafoxxDaKvXJgLC7CXT0AxU 78/twK7GfrBNdJbAmXZQiv+DTJH/O2jm5UP03uiiPQqvDQB+dGnwF8yzp3PJNMz/HPQ5n00 LqTqYkquJqlmvOwF4taEtjAHiaHugPibuYF2qmMaJCv2rNKDxMM+R7YkerxzZLw+cdAXNR7 k0v6D1gIFkRiPVNHP2fdA== X-UI-Out-Filterresults: notjunk:1; V01:K0:GDRa7KfzjkU=:BN7TmfFCPjCt7x7fnS44kp n+xCtLHoCtOl+TsE7dgKrRuy+hSEmMT6cbDqwhOxMJ6xY3bUvBcOunPVOGlBNDurVLzMZk9uE UNqnMiH2NV75tYeIP2lTMpv9waj8FG6bJBgjlLaEZYduQpsmDK8ATq+d+By+mG4TnZMx16GDE vmpdFLXKOHahH0jH62nRs1UX7l3zgsRxpNiQ/CsO58HD/q+14TaGUMvPDnZG/pTFV1xCeTkx4 o1uCQSPAhFnEwuOQDDVQalGNNvCOtrjLQKyl0lGFLXxpiAVDTVyKBXZVbPN9JoazyxPIDlUS9 Gkh9eMzFfcoADMHYG0XwXvYLcl151kQI9SNPgnk4mLg9T4S0ycJznmJgdjPTBZuquTxOfd+8x Acn/ZURhYUu/F7xCi83Xr7kHekYp1c2TZ8Ra/esyqaYfUTP1Mjg+N7RfKFSMAKO01kTz83icw W1eAoFxTb76s+rh/pYARQsO9h8YTObPGxcvwu7xdj6O+5TKdBC0AcT3EQCffCJjcuIYcnSxyM iOeVSDV2YJAbjb2ZCHH450ZlDSWezYN4PgB2/bFowtEDVlSdTUn9QGwZ9ZgmWkm4QxtJUfait xMDxRIISl+PKjSmjy8ctoPh3M0LePOCkEIs3O/CPqPxaicpotzdeOTF0mRnT6fMk0mEqpCSih lU5rup/OlvDRhq2cO+c34AJDrgOng0nJxayly5EWrkwhkao8/h4fw1ZJDcWXoCWt3ndYBBKDB fNIIreBYWuepazIZnLOF7/j7WH5MWkQd1pT9ufM7FbikBrDkcmovWMRqjB9bYAetjPsPGLCNn 8Duzo2opQZ4IAlY3UbK2aXbF++tng== Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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) { 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