From e0ece89e1ac014a8443fe95860c4a43b88f16f63 Mon Sep 17 00:00:00 2001 From: Frank Zago Date: Thu, 11 Dec 2014 11:49:04 -0500 Subject: [PATCH] LU-5396 obdclass: make some functions static Some functions and variables are only used in their C file, so reduce their scope. This reduces the code size, and fixes sparse warnings such as: warning: symbol 'proc_lnet_routes' was not declared. Should it be static? warning: symbol 'proc_lnet_routers' was not declared. Should it be static? Some prototypes were removed from C files and added to the proper header. Signed-off-by: Frank Zago Change-Id: I35a7ae4d9efd7098d93d3500f4854ef074fce179 Reviewed-on: http://review.whamcloud.com/12220 Reviewed-by: Bob Glossman Reviewed-by: Dmitry Eremin Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/include/lu_object.h | 3 +++ lustre/include/obd_class.h | 8 ++++++++ lustre/obdclass/capa.c | 2 +- lustre/obdclass/cl_internal.h | 3 +++ lustre/obdclass/cl_io.c | 3 --- lustre/obdclass/cl_object.c | 6 +++--- lustre/obdclass/class_obd.c | 16 +++++++--------- lustre/obdclass/genops.c | 15 ++++++++------- lustre/obdclass/linux/linux-module.c | 6 +++--- lustre/obdclass/linux/linux-sysctl.c | 7 ++++--- lustre/obdclass/llog.c | 4 ++-- lustre/obdclass/llog_cat.c | 13 +++++++------ lustre/obdclass/llog_osd.c | 4 ++-- lustre/obdclass/local_storage.c | 28 +++++++++++++++------------- lustre/obdclass/lprocfs_jobstats.c | 4 ++-- lustre/obdclass/lprocfs_status.c | 6 +++--- lustre/obdclass/lprocfs_status_server.c | 14 +++++++------- lustre/obdclass/lu_object.c | 9 ++++----- lustre/obdclass/obd_config.c | 14 ++++++-------- lustre/obdclass/obd_mount.c | 18 +++++++++--------- lustre/obdclass/obd_mount_server.c | 8 ++++---- lustre/obdecho/echo_client.c | 4 ++-- 22 files changed, 103 insertions(+), 92 deletions(-) diff --git a/lustre/include/lu_object.h b/lustre/include/lu_object.h index b312539..17146cf 100644 --- a/lustre/include/lu_object.h +++ b/lustre/include/lu_object.h @@ -1376,5 +1376,8 @@ void lu_buf_realloc(struct lu_buf *buf, size_t size); int lu_buf_check_and_grow(struct lu_buf *buf, size_t len); struct lu_buf *lu_buf_check_and_alloc(struct lu_buf *buf, size_t len); +extern __u32 lu_context_tags_default; +extern __u32 lu_session_tags_default; + /** @} lu */ #endif /* __LUSTRE_LU_OBJECT_H */ diff --git a/lustre/include/obd_class.h b/lustre/include/obd_class.h index 7a76fd5..8141f86 100644 --- a/lustre/include/obd_class.h +++ b/lustre/include/obd_class.h @@ -1895,6 +1895,9 @@ void lustre_deregister_lwp_item(struct obd_export **exp); struct obd_export *lustre_find_lwp_by_index(const char *dev, __u32 idx); int tgt_name2lwp_name(const char *tgt_name, char *lwp_name, int len, __u32 idx); #endif /* HAVE_SERVER_SUPPORT */ +int lustre_register_fs(void); +int lustre_unregister_fs(void); +int lustre_check_exclusion(struct super_block *sb, char *svname); /* sysctl.c */ extern void obd_sysctl_init (void); @@ -1931,4 +1934,9 @@ struct root_squash_info { int server_name2index(const char *svname, __u32 *idx, const char **endptr); +/* linux-module.c */ +extern struct miscdevice obd_psdev; +int class_procfs_init(void); +int class_procfs_clean(void); + #endif /* __LINUX_OBD_CLASS_H */ diff --git a/lustre/obdclass/capa.c b/lustre/obdclass/capa.c index fa2affd..708a6dd 100644 --- a/lustre/obdclass/capa.c +++ b/lustre/obdclass/capa.c @@ -412,7 +412,7 @@ EXPORT_SYMBOL(_debug_capa); */ LU_KEY_INIT_FINI(lu_capainfo, struct lu_capainfo); -struct lu_context_key lu_capainfo_key = { +static struct lu_context_key lu_capainfo_key = { .lct_tags = LCT_SERVER_SESSION, .lct_init = lu_capainfo_key_init, .lct_fini = lu_capainfo_key_fini diff --git a/lustre/obdclass/cl_internal.h b/lustre/obdclass/cl_internal.h index 314c58a..103262b 100644 --- a/lustre/obdclass/cl_internal.h +++ b/lustre/obdclass/cl_internal.h @@ -117,5 +117,8 @@ struct cl_thread_info { }; struct cl_thread_info *cl_env_info(const struct lu_env *env); +void cl_page_disown0(const struct lu_env *env, + struct cl_io *io, struct cl_page *pg); + #endif /* _CL_INTERNAL_H */ diff --git a/lustre/obdclass/cl_io.c b/lustre/obdclass/cl_io.c index 3279a76..3d05da9 100644 --- a/lustre/obdclass/cl_io.c +++ b/lustre/obdclass/cl_io.c @@ -992,9 +992,6 @@ void cl_page_list_splice(struct cl_page_list *list, struct cl_page_list *head) } EXPORT_SYMBOL(cl_page_list_splice); -void cl_page_disown0(const struct lu_env *env, - struct cl_io *io, struct cl_page *pg); - /** * Disowns pages in a queue. */ diff --git a/lustre/obdclass/cl_object.c b/lustre/obdclass/cl_object.c index 97978f8..a3b112f 100644 --- a/lustre/obdclass/cl_object.c +++ b/lustre/obdclass/cl_object.c @@ -58,6 +58,7 @@ #include #include /* for cfs_hash stuff */ #include +#include #include "cl_internal.h" static struct kmem_cache *cl_env_kmem; @@ -65,8 +66,6 @@ static struct kmem_cache *cl_env_kmem; /** Lock class of cl_object_header::coh_attr_guard */ static struct lock_class_key cl_attr_guard_class; -extern __u32 lu_context_tags_default; -extern __u32 lu_session_tags_default; /** * Initialize cl_object_header. */ @@ -386,7 +385,8 @@ void cache_stats_init(struct cache_stats *cs, const char *name) atomic_set(&cs->cs_stats[i], 0); } -int cache_stats_print(const struct cache_stats *cs, struct seq_file *m, int h) +static int cache_stats_print(const struct cache_stats *cs, + struct seq_file *m, int h) { int i; diff --git a/lustre/obdclass/class_obd.c b/lustre/obdclass/class_obd.c index 465c3f3..72e69d5 100644 --- a/lustre/obdclass/class_obd.c +++ b/lustre/obdclass/class_obd.c @@ -58,8 +58,13 @@ EXPORT_SYMBOL(obd_devs); struct list_head obd_types; DEFINE_RWLOCK(obd_dev_lock); -__u64 obd_max_pages = 0; -__u64 obd_max_alloc = 0; +#ifdef LPROCFS +static __u64 obd_max_pages; +static __u64 obd_max_alloc; +#else +__u64 obd_max_pages; +__u64 obd_max_alloc; +#endif static DEFINE_SPINLOCK(obd_updatemax_lock); @@ -429,8 +434,6 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg) RETURN(err); } /* class_handle_ioctl */ -extern struct miscdevice obd_psdev; - #define OBD_INIT_CHECK #ifdef OBD_INIT_CHECK static int obd_init_checks(void) @@ -504,13 +507,9 @@ static int obd_init_checks(void) #define obd_init_checks() do {} while(0) #endif -extern int class_procfs_init(void); -extern int class_procfs_clean(void); - static int __init init_obdclass(void) { int i, err; - int lustre_register_fs(void); for (i = CAPA_SITE_CLIENT; i < CAPA_SITE_MAX; i++) INIT_LIST_HEAD(&capa_list[i]); @@ -648,7 +647,6 @@ EXPORT_SYMBOL(obd_pages_max); * ifdef to the end of the file to cover module and versioning goo.*/ static void cleanup_obdclass(void) { - int lustre_unregister_fs(void); __u64 memory_leaked, pages_leaked; __u64 memory_max, pages_max; ENTRY; diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c index 37c11ad..0cd52c6f 100644 --- a/lustre/obdclass/genops.c +++ b/lustre/obdclass/genops.c @@ -45,14 +45,15 @@ spinlock_t obd_types_lock; -struct kmem_cache *obd_device_cachep; +static struct kmem_cache *obd_device_cachep; struct kmem_cache *obdo_cachep; EXPORT_SYMBOL(obdo_cachep); -struct kmem_cache *import_cachep; +static struct kmem_cache *import_cachep; + +static struct list_head obd_zombie_imports; +static struct list_head obd_zombie_exports; +static spinlock_t obd_zombie_impexp_lock; -struct list_head obd_zombie_imports; -struct list_head obd_zombie_exports; -spinlock_t obd_zombie_impexp_lock; static void obd_zombie_impexp_notify(void); static void obd_zombie_export_add(struct obd_export *exp); static void obd_zombie_import_add(struct obd_import *imp); @@ -962,7 +963,7 @@ void class_unlink_export(struct obd_export *exp) EXPORT_SYMBOL(class_unlink_export); /* Import management functions */ -void class_import_destroy(struct obd_import *imp) +static void class_import_destroy(struct obd_import *imp) { ENTRY; @@ -1167,7 +1168,7 @@ int class_connect(struct lustre_handle *conn, struct obd_device *obd, EXPORT_SYMBOL(class_connect); /* if export is involved in recovery then clean up related things */ -void class_export_recovery_cleanup(struct obd_export *exp) +static void class_export_recovery_cleanup(struct obd_export *exp) { struct obd_device *obd = exp->exp_obd; diff --git a/lustre/obdclass/linux/linux-module.c b/lustre/obdclass/linux/linux-module.c index 8b114d2..e590a9c 100644 --- a/lustre/obdclass/linux/linux-module.c +++ b/lustre/obdclass/linux/linux-module.c @@ -313,7 +313,7 @@ LPROC_SEQ_FOPS(obd_proc_jobid_var); struct proc_dir_entry *proc_lustre_root = NULL; EXPORT_SYMBOL(proc_lustre_root); -struct lprocfs_seq_vars lprocfs_base[] = { +static struct lprocfs_seq_vars lprocfs_base[] = { { .name = "version", .fops = &obd_proc_version_fops }, { .name = "pinger", @@ -376,7 +376,7 @@ static int obd_device_list_seq_show(struct seq_file *p, void *v) atomic_read(&obd->obd_refcount)); } -struct seq_operations obd_device_list_sops = { +static const struct seq_operations obd_device_list_sops = { .start = obd_device_list_seq_start, .stop = obd_device_list_seq_stop, .next = obd_device_list_seq_next, @@ -396,7 +396,7 @@ static int obd_device_list_open(struct inode *inode, struct file *file) return 0; } -struct file_operations obd_device_list_fops = { +static const struct file_operations obd_device_list_fops = { .owner = THIS_MODULE, .open = obd_device_list_open, .read = seq_read, diff --git a/lustre/obdclass/linux/linux-sysctl.c b/lustre/obdclass/linux/linux-sysctl.c index 1723f05..10a2aec 100644 --- a/lustre/obdclass/linux/linux-sysctl.c +++ b/lustre/obdclass/linux/linux-sysctl.c @@ -52,9 +52,10 @@ #include #include +#include #ifdef CONFIG_SYSCTL -struct ctl_table_header *obd_table_header = NULL; +static struct ctl_table_header *obd_table_header; #endif static int @@ -216,8 +217,8 @@ proc_max_dirty_pages_in_mb(struct ctl_table *table, int write, } #ifdef RANDOM_FAIL_ALLOC -int proc_alloc_fail_rate(struct ctl_table *table, int write, - void __user *buffer, size_t *lenp, loff_t *ppos) +static int proc_alloc_fail_rate(struct ctl_table *table, int write, + void __user *buffer, size_t *lenp, loff_t *ppos) { int rc = 0; diff --git a/lustre/obdclass/llog.c b/lustre/obdclass/llog.c index 2f3b9e4..d10e2f1 100644 --- a/lustre/obdclass/llog.c +++ b/lustre/obdclass/llog.c @@ -56,7 +56,7 @@ * Allocate a new log or catalog handle * Used inside llog_open(). */ -struct llog_handle *llog_alloc_handle(void) +static struct llog_handle *llog_alloc_handle(void) { struct llog_handle *loghandle; @@ -75,7 +75,7 @@ struct llog_handle *llog_alloc_handle(void) /* * Free llog handle and header data if exists. Used in llog_close() only */ -void llog_free_handle(struct llog_handle *loghandle) +static void llog_free_handle(struct llog_handle *loghandle) { LASSERT(loghandle != NULL); diff --git a/lustre/obdclass/llog_cat.c b/lustre/obdclass/llog_cat.c index ae443e6..ba92c8a 100644 --- a/lustre/obdclass/llog_cat.c +++ b/lustre/obdclass/llog_cat.c @@ -511,8 +511,9 @@ int llog_cat_cancel_records(const struct lu_env *env, } EXPORT_SYMBOL(llog_cat_cancel_records); -int llog_cat_process_cb(const struct lu_env *env, struct llog_handle *cat_llh, - struct llog_rec_hdr *rec, void *data) +static int llog_cat_process_cb(const struct lu_env *env, + struct llog_handle *cat_llh, + struct llog_rec_hdr *rec, void *data) { struct llog_process_data *d = data; struct llog_logid_rec *lir = (struct llog_logid_rec *)rec; @@ -739,7 +740,7 @@ int llog_cat_reverse_process(const struct lu_env *env, } EXPORT_SYMBOL(llog_cat_reverse_process); -int llog_cat_set_first_idx(struct llog_handle *cathandle, int index) +static int llog_cat_set_first_idx(struct llog_handle *cathandle, int index) { struct llog_log_hdr *llh = cathandle->lgh_hdr; int i, bitmap_size, idx; @@ -800,8 +801,9 @@ int llog_cat_cleanup(const struct lu_env *env, struct llog_handle *cathandle, return rc; } -int cat_cancel_cb(const struct lu_env *env, struct llog_handle *cathandle, - struct llog_rec_hdr *rec, void *data) +static int cat_cancel_cb(const struct lu_env *env, + struct llog_handle *cathandle, + struct llog_rec_hdr *rec, void *data) { struct llog_logid_rec *lir = (struct llog_logid_rec *)rec; struct llog_handle *loghandle; @@ -861,4 +863,3 @@ int llog_cat_init_and_process(const struct lu_env *env, RETURN(0); } EXPORT_SYMBOL(llog_cat_init_and_process); - diff --git a/lustre/obdclass/llog_osd.c b/lustre/obdclass/llog_osd.c index ef7b0f0..a084301 100644 --- a/lustre/obdclass/llog_osd.c +++ b/lustre/obdclass/llog_osd.c @@ -890,8 +890,8 @@ out: * \retval dt_object of llog directory * \retval ERR_PTR of negative value on error */ -struct dt_object *llog_osd_dir_get(const struct lu_env *env, - struct llog_ctxt *ctxt) +static struct dt_object *llog_osd_dir_get(const struct lu_env *env, + struct llog_ctxt *ctxt) { struct dt_device *dt; struct dt_thread_info *dti = dt_info(env); diff --git a/lustre/obdclass/local_storage.c b/lustre/obdclass/local_storage.c index 563e8dd..3672f01 100644 --- a/lustre/obdclass/local_storage.c +++ b/lustre/obdclass/local_storage.c @@ -68,14 +68,14 @@ static void ls_object_free(const struct lu_env *env, struct lu_object *o) OBD_FREE_PTR(obj); } -struct lu_object_operations ls_lu_obj_ops = { +static struct lu_object_operations ls_lu_obj_ops = { .loo_object_init = ls_object_init, .loo_object_free = ls_object_free, }; -struct lu_object *ls_object_alloc(const struct lu_env *env, - const struct lu_object_header *_h, - struct lu_device *d) +static struct lu_object *ls_object_alloc(const struct lu_env *env, + const struct lu_object_header *_h, + struct lu_device *d) { struct lu_object_header *h; struct ls_object *o; @@ -291,13 +291,14 @@ int local_object_create(const struct lu_env *env, /* * Create local named object (file, directory or index) in parent directory. */ -struct dt_object *__local_file_create(const struct lu_env *env, - const struct lu_fid *fid, - struct local_oid_storage *los, - struct ls_device *ls, - struct dt_object *parent, - const char *name, struct lu_attr *attr, - struct dt_object_format *dof) +static struct dt_object *__local_file_create(const struct lu_env *env, + const struct lu_fid *fid, + struct local_oid_storage *los, + struct ls_device *ls, + struct dt_object *parent, + const char *name, + struct lu_attr *attr, + struct dt_object_format *dof) { struct dt_thread_info *dti = dt_info(env); struct lu_object_conf *conf = &dti->dti_conf; @@ -691,8 +692,9 @@ void dt_los_put(struct local_oid_storage *los) /* after Lustre 2.3 release there may be old file to store last generated FID * If such file exists then we have to read its content */ -int lastid_compat_check(const struct lu_env *env, struct dt_device *dev, - __u64 lastid_seq, __u32 *first_oid, struct ls_device *ls) +static int lastid_compat_check(const struct lu_env *env, struct dt_device *dev, + __u64 lastid_seq, __u32 *first_oid, + struct ls_device *ls) { struct dt_thread_info *dti = dt_info(env); struct dt_object *root = NULL; diff --git a/lustre/obdclass/lprocfs_jobstats.c b/lustre/obdclass/lprocfs_jobstats.c index c2eff71..edaa25c 100644 --- a/lustre/obdclass/lprocfs_jobstats.c +++ b/lustre/obdclass/lprocfs_jobstats.c @@ -404,7 +404,7 @@ static int lprocfs_jobstats_seq_show(struct seq_file *p, void *v) return 0; } -struct seq_operations lprocfs_jobstats_seq_sops = { +static const struct seq_operations lprocfs_jobstats_seq_sops = { start: lprocfs_jobstats_seq_start, stop: lprocfs_jobstats_seq_stop, next: lprocfs_jobstats_seq_next, @@ -472,7 +472,7 @@ static ssize_t lprocfs_jobstats_seq_write(struct file *file, return len; } -struct file_operations lprocfs_jobstats_seq_fops = { +static const struct file_operations lprocfs_jobstats_seq_fops = { .owner = THIS_MODULE, .open = lprocfs_jobstats_seq_open, .read = seq_read, diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c index b469fad..95c7019 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -358,7 +358,7 @@ lprocfs_seq_add_vars(struct proc_dir_entry *root, struct lprocfs_seq_vars *list, EXPORT_SYMBOL(lprocfs_seq_add_vars); #ifndef HAVE_ONLY_PROCFS_SEQ -void lprocfs_remove_nolock(struct proc_dir_entry **proot) +static void lprocfs_remove_nolock(struct proc_dir_entry **proot) { struct proc_dir_entry *root = *proot; struct proc_dir_entry *temp = root; @@ -1466,7 +1466,7 @@ out: return (rc < 0) ? rc : 0; } -struct seq_operations lprocfs_stats_seq_sops = { +static const struct seq_operations lprocfs_stats_seq_sops = { .start = lprocfs_stats_seq_start, .stop = lprocfs_stats_seq_stop, .next = lprocfs_stats_seq_next, @@ -1490,7 +1490,7 @@ static int lprocfs_stats_seq_open(struct inode *inode, struct file *file) return 0; } -struct file_operations lprocfs_stats_seq_fops = { +static const struct file_operations lprocfs_stats_seq_fops = { .owner = THIS_MODULE, .open = lprocfs_stats_seq_open, .read = seq_read, diff --git a/lustre/obdclass/lprocfs_status_server.c b/lustre/obdclass/lprocfs_status_server.c index f0d0916..a47843e 100644 --- a/lustre/obdclass/lprocfs_status_server.c +++ b/lustre/obdclass/lprocfs_status_server.c @@ -161,8 +161,8 @@ int lprocfs_exp_nid_seq_show(struct seq_file *m, void *data) return seq_printf(m, "%s\n", obd_export_nid2str(exp)); } -int lprocfs_exp_print_uuid_seq(cfs_hash_t *hs, cfs_hash_bd_t *bd, - struct hlist_node *hnode, void *cb_data) +static int lprocfs_exp_print_uuid_seq(cfs_hash_t *hs, cfs_hash_bd_t *bd, + struct hlist_node *hnode, void *cb_data) { struct obd_export *exp = cfs_hash_object(hs, hnode); @@ -173,7 +173,7 @@ int lprocfs_exp_print_uuid_seq(cfs_hash_t *hs, cfs_hash_bd_t *bd, return 0; } -int lprocfs_exp_nodemap_seq_show(struct seq_file *m, void *data) +static int lprocfs_exp_nodemap_seq_show(struct seq_file *m, void *data) { struct obd_export *exp = m->private; if (exp->exp_target_data.ted_nodemap) @@ -183,7 +183,7 @@ int lprocfs_exp_nodemap_seq_show(struct seq_file *m, void *data) } LPROC_SEQ_FOPS_RO(lprocfs_exp_nodemap); -int lprocfs_exp_uuid_seq_show(struct seq_file *m, void *data) +static int lprocfs_exp_uuid_seq_show(struct seq_file *m, void *data) { struct nid_stat *stats = m->private; struct obd_device *obd = stats->nid_obd; @@ -194,8 +194,8 @@ int lprocfs_exp_uuid_seq_show(struct seq_file *m, void *data) } LPROC_SEQ_FOPS_RO(lprocfs_exp_uuid); -int lprocfs_exp_print_hash_seq(cfs_hash_t *hs, cfs_hash_bd_t *bd, - struct hlist_node *hnode, void *cb_data) +static int lprocfs_exp_print_hash_seq(cfs_hash_t *hs, cfs_hash_bd_t *bd, + struct hlist_node *hnode, void *cb_data) { struct seq_file *m = cb_data; @@ -208,7 +208,7 @@ int lprocfs_exp_print_hash_seq(cfs_hash_t *hs, cfs_hash_bd_t *bd, return 0; } -int lprocfs_exp_hash_seq_show(struct seq_file *m, void *data) +static int lprocfs_exp_hash_seq_show(struct seq_file *m, void *data) { struct nid_stat *stats = m->private; struct obd_device *obd = stats->nid_obd; diff --git a/lustre/obdclass/lu_object.c b/lustre/obdclass/lu_object.c index eec1bbb..c02ef3cb 100644 --- a/lustre/obdclass/lu_object.c +++ b/lustre/obdclass/lu_object.c @@ -461,7 +461,7 @@ LU_KEY_INIT_FINI(lu_global, struct lu_cdebug_data); * Key, holding temporary buffer. This key is registered very early by * lu_global_init(). */ -struct lu_context_key lu_global_key = { +static struct lu_context_key lu_global_key = { .lct_tags = LCT_MD_THREAD | LCT_DT_THREAD | LCT_MG_THREAD | LCT_CL_THREAD | LCT_LOCAL, .lct_init = lu_global_key_init, @@ -1064,7 +1064,7 @@ static void lu_obj_hop_put_locked(cfs_hash_t *hs, struct hlist_node *hnode) LBUG(); /* we should never called it */ } -cfs_hash_ops_t lu_site_hash_ops = { +static cfs_hash_ops_t lu_site_hash_ops = { .hs_hash = lu_obj_hop_hash, .hs_key = lu_obj_hop_key, .hs_keycmp = lu_obj_hop_keycmp, @@ -2058,13 +2058,13 @@ static int lu_cache_shrink(SHRINKER_ARGS(sc, nr_to_scan, gfp_mask)) /** * Environment to be used in debugger, contains all tags. */ -struct lu_env lu_debugging_env; +static struct lu_env lu_debugging_env; /** * Debugging printer function using printk(). */ int lu_printk_printer(const struct lu_env *env, - void *unused, const char *format, ...) + void *unused, const char *format, ...) { va_list args; @@ -2394,4 +2394,3 @@ int lu_buf_check_and_grow(struct lu_buf *buf, size_t len) return 0; } EXPORT_SYMBOL(lu_buf_check_and_grow); - diff --git a/lustre/obdclass/obd_config.c b/lustre/obdclass/obd_config.c index aecfbd1..08bd8c4 100644 --- a/lustre/obdclass/obd_config.c +++ b/lustre/obdclass/obd_config.c @@ -786,7 +786,7 @@ EXPORT_SYMBOL(class_add_conn); /** Remove a failover nid location. */ -int class_del_conn(struct obd_device *obd, struct lustre_cfg *lcfg) +static int class_del_conn(struct obd_device *obd, struct lustre_cfg *lcfg) { struct obd_import *imp; struct obd_uuid uuid; @@ -816,7 +816,7 @@ int class_del_conn(struct obd_device *obd, struct lustre_cfg *lcfg) RETURN(rc); } -struct list_head lustre_profile_list = +static struct list_head lustre_profile_list = LIST_HEAD_INIT(lustre_profile_list); struct lustre_profile *class_get_profile(const char * prof) @@ -837,8 +837,8 @@ EXPORT_SYMBOL(class_get_profile); * This defines the mdc and osc names to use for a client. * This also is used to define the lov to be used by a mdt. */ -int class_add_profile(int proflen, char *prof, int osclen, char *osc, - int mdclen, char *mdc) +static int class_add_profile(int proflen, char *prof, int osclen, char *osc, + int mdclen, char *mdc) { struct lustre_profile *lprof; int err = 0; @@ -1348,8 +1348,6 @@ int class_process_proc_param(char *prefix, struct lprocfs_seq_vars *lvars, } EXPORT_SYMBOL(class_process_proc_param); -extern int lustre_check_exclusion(struct super_block *sb, char *svname); - /* * Supplemental functions for config logs, it allocates lustre_cfg * buffers plus initialized llog record header at the beginning. @@ -1655,7 +1653,7 @@ parse_out: } EXPORT_SYMBOL(class_config_parse_llog); -struct lcfg_type_data { +static struct lcfg_type_data { __u32 ltd_type; char *ltd_name; char *ltd_bufs[4]; @@ -1768,7 +1766,7 @@ int class_config_yaml_output(struct llog_rec_hdr *rec, char *buf, int size) * This is separated from class_config_dump_handler() to use * for ioctl needs as well */ -int class_config_parse_rec(struct llog_rec_hdr *rec, char *buf, int size) +static int class_config_parse_rec(struct llog_rec_hdr *rec, char *buf, int size) { struct lustre_cfg *lcfg = (struct lustre_cfg *)(rec + 1); char *ptr = buf; diff --git a/lustre/obdclass/obd_mount.c b/lustre/obdclass/obd_mount.c index dd1f1ea..59b5631 100644 --- a/lustre/obdclass/obd_mount.c +++ b/lustre/obdclass/obd_mount.c @@ -207,7 +207,7 @@ int lustre_start_simple(char *obdname, char *type, char *uuid, return rc; } -DEFINE_MUTEX(mgc_start_lock); +static DEFINE_MUTEX(mgc_start_lock); /** Set up a mgc obd to process startup logs * @@ -560,7 +560,7 @@ out: /***************** lustre superblock **************/ -struct lustre_sb_info *lustre_init_lsi(struct super_block *sb) +static struct lustre_sb_info *lustre_init_lsi(struct super_block *sb) { struct lustre_sb_info *lsi; ENTRY; @@ -1263,7 +1263,7 @@ struct lustre_mount_data2 { * and this is where we start setting things up. * @param data Mount options (e.g. -o flock,abort_recov) */ -int lustre_fill_super(struct super_block *sb, void *data, int silent) +static int lustre_fill_super(struct super_block *sb, void *data, int silent) { struct lustre_mount_data *lmd; struct lustre_mount_data2 *lmd2 = data; @@ -1364,16 +1364,16 @@ EXPORT_SYMBOL(lustre_register_kill_super_cb); /***************** FS registration ******************/ #ifdef HAVE_FSTYPE_MOUNT -struct dentry *lustre_mount(struct file_system_type *fs_type, int flags, - const char *devname, void *data) +static struct dentry *lustre_mount(struct file_system_type *fs_type, int flags, + const char *devname, void *data) { struct lustre_mount_data2 lmd2 = { data, NULL }; return mount_nodev(fs_type, flags, &lmd2, lustre_fill_super); } #else -int lustre_get_sb(struct file_system_type *fs_type, int flags, - const char *devname, void * data, struct vfsmount *mnt) +static int lustre_get_sb(struct file_system_type *fs_type, int flags, + const char *devname, void *data, struct vfsmount *mnt) { struct lustre_mount_data2 lmd2 = { data, mnt }; @@ -1381,7 +1381,7 @@ int lustre_get_sb(struct file_system_type *fs_type, int flags, } #endif -void lustre_kill_super(struct super_block *sb) +static void lustre_kill_super(struct super_block *sb) { struct lustre_sb_info *lsi = s2lsi(sb); @@ -1393,7 +1393,7 @@ void lustre_kill_super(struct super_block *sb) /** Register the "lustre" fs type */ -struct file_system_type lustre_fs_type = { +static struct file_system_type lustre_fs_type = { .owner = THIS_MODULE, .name = "lustre", #ifdef HAVE_FSTYPE_MOUNT diff --git a/lustre/obdclass/obd_mount_server.c b/lustre/obdclass/obd_mount_server.c index 0059604..1bd8d10 100644 --- a/lustre/obdclass/obd_mount_server.c +++ b/lustre/obdclass/obd_mount_server.c @@ -64,7 +64,7 @@ /*********** mount lookup *********/ -DEFINE_MUTEX(lustre_mount_info_lock); +static DEFINE_MUTEX(lustre_mount_info_lock); static struct list_head server_mount_info_list = LIST_HEAD_INIT(server_mount_info_list); @@ -378,7 +378,7 @@ EXPORT_SYMBOL(tgt_name2lwp_name); static struct list_head lwp_register_list = LIST_HEAD_INIT(lwp_register_list); -DEFINE_MUTEX(lwp_register_list_lock); +static DEFINE_MUTEX(lwp_register_list_lock); int lustre_register_lwp_item(const char *lwpname, struct obd_export **exp, register_lwp_cb cb_func, void *cb_data) @@ -999,7 +999,7 @@ out: return rc; } -DEFINE_MUTEX(server_start_lock); +static DEFINE_MUTEX(server_start_lock); /* Stop MDS/OSS if nobody is using them */ static int server_stop_servers(int lsiflags) @@ -1619,7 +1619,7 @@ static ssize_t lustre_listxattr(struct dentry *d_entry, char *name, return -EOPNOTSUPP; } -const struct inode_operations server_inode_operations = { +static const struct inode_operations server_inode_operations = { .setxattr = lustre_setxattr, .getxattr = lustre_getxattr, .listxattr = lustre_listxattr, diff --git a/lustre/obdecho/echo_client.c b/lustre/obdecho/echo_client.c index 30c2195..f3e1053 100644 --- a/lustre/obdecho/echo_client.c +++ b/lustre/obdecho/echo_client.c @@ -2794,7 +2794,7 @@ static struct obd_ops echo_client_obd_ops = { .o_disconnect = echo_client_disconnect }; -int echo_client_init(void) +static int echo_client_init(void) { int rc; @@ -2809,7 +2809,7 @@ int echo_client_init(void) return rc; } -void echo_client_exit(void) +static void echo_client_exit(void) { class_unregister_type(LUSTRE_ECHO_CLIENT_NAME); lu_kmem_fini(echo_caches); -- 1.8.3.1