From: Timothy Day Date: Fri, 23 Jun 2023 20:40:35 +0000 (+0000) Subject: LU-8191 obdclass: add static and remove functions X-Git-Tag: 2.15.57~68 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=b3f0995b772877f0bea5d3d790db441244c3c821;p=fs%2Flustre-release.git LU-8191 obdclass: add static and remove functions Static analysis shows that a number of functions could be made static. This patch declares several functions in obdclass static. There are a few functions which are never called anywhere. These are removed. Additionally, there is some debugging code (added 15 years ago) that has also been removed. Test-Parameters: trivial Signed-off-by: Timothy Day Change-Id: I5f1d438c9663e62789d26093ec9bdd5d76a3060a Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51440 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Neil Brown Reviewed-by: Arshad Hussain Reviewed-by: jsimmons Reviewed-by: Oleg Drokin --- diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c index 75703c0..c300236 100644 --- a/lustre/obdclass/genops.c +++ b/lustre/obdclass/genops.c @@ -600,7 +600,7 @@ struct obd_device *class_name2obd(const char *name) } EXPORT_SYMBOL(class_name2obd); -int class_uuid2dev_nolock(struct obd_uuid *uuid) +static int class_uuid2dev_nolock(struct obd_uuid *uuid) { int i; @@ -1019,8 +1019,9 @@ static void obd_zombie_exp_cull(struct work_struct *ws) /* Creates a new export, adds it to the hash table, and returns a * pointer to it. The refcount is 2: one for the hash reference, and * one for the pointer returned by this function. */ -struct obd_export *__class_new_export(struct obd_device *obd, - struct obd_uuid *cluuid, bool is_self) +static struct obd_export *__class_new_export(struct obd_device *obd, + struct obd_uuid *cluuid, + bool is_self) { struct obd_export *export; int rc = 0; diff --git a/lustre/obdclass/jobid.c b/lustre/obdclass/jobid.c index ab35998..437d714 100644 --- a/lustre/obdclass/jobid.c +++ b/lustre/obdclass/jobid.c @@ -388,7 +388,7 @@ out: * then an upcall could be issued here to get the jobid by utilizing * the userspace tools/API. Then, the jobid must be cached. */ -int jobid_get_from_environ(char *jobid_var, char *jobid, int *jobid_len) +static int jobid_get_from_environ(char *jobid_var, char *jobid, int *jobid_len) { int rc; diff --git a/lustre/obdclass/kernelcomm.c b/lustre/obdclass/kernelcomm.c index f0e28ce..b8198b1 100644 --- a/lustre/obdclass/kernelcomm.c +++ b/lustre/obdclass/kernelcomm.c @@ -276,7 +276,7 @@ int lustre_old_device_list_dump(struct sk_buff *msg, } #endif -int lustre_device_done(struct netlink_callback *cb) +static int lustre_device_done(struct netlink_callback *cb) { struct genl_dev_list *glist; diff --git a/lustre/obdclass/llog_osd.c b/lustre/obdclass/llog_osd.c index adbcd2a..3b36294 100644 --- a/lustre/obdclass/llog_osd.c +++ b/lustre/obdclass/llog_osd.c @@ -1415,8 +1415,8 @@ out: * \retval pointer to the directory if it is found. * \retval ERR_PTR(negative errno) if it fails. */ -struct dt_object *llog_osd_get_regular_fid_dir(const struct lu_env *env, - struct dt_object *dto) +static struct dt_object *llog_osd_get_regular_fid_dir(const struct lu_env *env, + struct dt_object *dto) { struct llog_thread_info *lgi = llog_info(env); struct seq_server_site *ss = dto->do_lu.lo_dev->ld_site->ld_seq_site; diff --git a/lustre/obdclass/llog_swab.c b/lustre/obdclass/llog_swab.c index 1c9d0be..d7d8bfc 100644 --- a/lustre/obdclass/llog_swab.c +++ b/lustre/obdclass/llog_swab.c @@ -40,6 +40,7 @@ #include #include +#include static void print_llogd_body(struct llogd_body *d) { diff --git a/lustre/obdclass/local_storage.c b/lustre/obdclass/local_storage.c index 91518ac..6015d1d 100644 --- a/lustre/obdclass/local_storage.c +++ b/lustre/obdclass/local_storage.c @@ -119,17 +119,6 @@ static struct ls_device *__ls_find_dev(struct dt_device *dev) return ret; } -struct ls_device *ls_find_dev(struct dt_device *dev) -{ - struct ls_device *ls; - - mutex_lock(&ls_list_mutex); - ls = __ls_find_dev(dev); - mutex_unlock(&ls_list_mutex); - - return ls; -} - static const struct lu_device_type_operations ls_device_type_ops = { .ldto_start = NULL, .ldto_stop = NULL, diff --git a/lustre/obdclass/lprocfs_status_server.c b/lustre/obdclass/lprocfs_status_server.c index 13cd886..a979216 100644 --- a/lustre/obdclass/lprocfs_status_server.c +++ b/lustre/obdclass/lprocfs_status_server.c @@ -116,25 +116,6 @@ int lprocfs_recovery_stale_clients_seq_show(struct seq_file *m, void *data) EXPORT_SYMBOL(lprocfs_recovery_stale_clients_seq_show); #ifdef CONFIG_PROC_FS - -int lprocfs_evict_client_open(struct inode *inode, struct file *f) -{ - struct obd_device *obd = pde_data(file_inode(f)); - - atomic_inc(&obd->obd_evict_inprogress); - return 0; -} - -int lprocfs_evict_client_release(struct inode *inode, struct file *f) -{ - struct obd_device *obd = pde_data(file_inode(f)); - - atomic_dec(&obd->obd_evict_inprogress); - wake_up(&obd->obd_evict_inprogress_waitq); - - return 0; -} - #define BUFLEN (UUID_MAX + 5) ssize_t @@ -464,7 +445,8 @@ static int lprocfs_exp_hash_seq_show(struct seq_file *m, void *data) } LPROC_SEQ_FOPS_RO(lprocfs_exp_hash); -int lprocfs_exp_print_replydata_seq(struct obd_export *exp, void *cb_data) +static int lprocfs_exp_print_replydata_seq(struct obd_export *exp, + void *cb_data) { struct seq_file *m = cb_data; @@ -481,7 +463,7 @@ int lprocfs_exp_print_replydata_seq(struct obd_export *exp, void *cb_data) return 0; } -int lprocfs_exp_replydata_seq_show(struct seq_file *m, void *data) +static int lprocfs_exp_replydata_seq_show(struct seq_file *m, void *data) { struct nid_stat *stats = m->private; @@ -490,7 +472,8 @@ int lprocfs_exp_replydata_seq_show(struct seq_file *m, void *data) } LPROC_SEQ_FOPS_RO(lprocfs_exp_replydata); -int lprocfs_exp_print_fmd_count_seq(struct obd_export *exp, void *cb_data) +static int lprocfs_exp_print_fmd_count_seq(struct obd_export *exp, + void *cb_data) { struct seq_file *m = cb_data; struct tg_export_data *ted = &exp->exp_target_data; @@ -500,7 +483,7 @@ int lprocfs_exp_print_fmd_count_seq(struct obd_export *exp, void *cb_data) return 0; } -int lprocfs_exp_fmd_count_seq_show(struct seq_file *m, void *data) +static int lprocfs_exp_fmd_count_seq_show(struct seq_file *m, void *data) { struct nid_stat *stats = m->private; diff --git a/lustre/obdclass/lu_object.c b/lustre/obdclass/lu_object.c index 776d1c8..dd6a831 100644 --- a/lustre/obdclass/lu_object.c +++ b/lustre/obdclass/lu_object.c @@ -2241,55 +2241,6 @@ static struct shrinker lu_site_shrinker = { #endif /* HAVE_SHRINKER_COUNT */ - -/* - * Debugging stuff. - */ - -/** - * Environment to be used in debugger, contains all tags. - */ -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, ...) -{ - va_list args; - - va_start(args, format); - vprintk(format, args); - va_end(args); - return 0; -} - -int lu_debugging_setup(void) -{ - return lu_env_init(&lu_debugging_env, ~0); -} - -void lu_context_keys_dump(void) -{ - unsigned int i; - - for (i = 0; i < ARRAY_SIZE(lu_keys); ++i) { - struct lu_context_key *key; - - key = lu_keys[i]; - if (key != NULL) { - CERROR("LU context keys [%d]: %p %x (%p,%p,%p) %d %d \"%s\"@%p\n", - i, key, key->lct_tags, - key->lct_init, key->lct_fini, key->lct_exit, - key->lct_index, atomic_read(&key->lct_used), - key->lct_owner ? key->lct_owner->name : "", - key->lct_owner); - lu_ref_print(&key->lct_reference); - } - } -} - /** * Initialization of global lu_* data. */