From 16812282b5230d3bc2fefa3df8b9c6f2a63f7da6 Mon Sep 17 00:00:00 2001 From: Timothy Day Date: Thu, 28 Mar 2024 01:22:46 -0700 Subject: [PATCH] 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. Lustre-change: https://review.whamcloud.com/51440 Lustre-commit: b3f0995b772877f0bea5d3d790db441244c3c821 Test-Parameters: trivial Signed-off-by: Timothy Day Change-Id: I5f1d438c9663e62789d26093ec9bdd5d76a3060a Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/54605 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger --- lustre/obdclass/genops.c | 7 ++--- lustre/obdclass/jobid.c | 2 +- lustre/obdclass/llog_osd.c | 4 +-- lustre/obdclass/llog_swab.c | 1 + lustre/obdclass/local_storage.c | 11 -------- lustre/obdclass/lprocfs_status_server.c | 29 +++++--------------- lustre/obdclass/lu_object.c | 48 --------------------------------- 7 files changed, 14 insertions(+), 88 deletions(-) diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c index 2acedb3..d4cce58 100644 --- a/lustre/obdclass/genops.c +++ b/lustre/obdclass/genops.c @@ -597,7 +597,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; @@ -1016,8 +1016,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 4608b58..939d5c2 100644 --- a/lustre/obdclass/jobid.c +++ b/lustre/obdclass/jobid.c @@ -392,7 +392,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/llog_osd.c b/lustre/obdclass/llog_osd.c index bb8a398..9f366fd 100644 --- a/lustre/obdclass/llog_osd.c +++ b/lustre/obdclass/llog_osd.c @@ -1421,8 +1421,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 8c53dd5..383c17c 100644 --- a/lustre/obdclass/llog_swab.c +++ b/lustre/obdclass/llog_swab.c @@ -41,6 +41,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 c7dab50..17b0dae 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 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 5cef66d..0ddcf61 100644 --- a/lustre/obdclass/lprocfs_status_server.c +++ b/lustre/obdclass/lprocfs_status_server.c @@ -81,25 +81,6 @@ no_entry: EXPORT_SYMBOL(ldebugfs_add_symlink); #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 @@ -397,7 +378,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; @@ -414,7 +396,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; @@ -423,7 +405,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; @@ -433,7 +416,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 e564bb8..d6b47ce 100644 --- a/lustre/obdclass/lu_object.c +++ b/lustre/obdclass/lu_object.c @@ -2241,54 +2241,6 @@ static struct ll_shrinker_ops lu_site_sh_ops = { static struct shrinker *lu_site_shrinker; -/* - * 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("[%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. */ -- 1.8.3.1