From 6800beb0b0ec7cac2a4510760f568f2231d99922 Mon Sep 17 00:00:00 2001 From: Timothy Day Date: Thu, 28 Mar 2024 16:54:13 -0700 Subject: [PATCH] LU-8191 target: convert functions to static Static analysis shows that a number of functions could be made static. This patch declares several functions in target static. Also, remove an unused function tgt_obd_log_cancel(), and add some headers where they were missing. Lustre-change: https://review.whamcloud.com/51475 Lustre-commit: bcbf31a9e1bd6399053a5a757b406152f0d65a42 Test-Parameters: trivial Signed-off-by: Timothy Day Change-Id: I1823df3562cb181b275788560166c92b63483637 Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/54614 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger --- lustre/obdclass/obd_mount_server.c | 2 +- lustre/target/barrier.c | 2 ++ lustre/target/out_lib.c | 16 ++++++++-------- lustre/target/tgt_fmd.c | 10 +++++----- lustre/target/tgt_handler.c | 5 ----- lustre/target/tgt_lastrcvd.c | 8 ++++---- lustre/target/tgt_main.c | 18 ++++++++++-------- 7 files changed, 30 insertions(+), 31 deletions(-) diff --git a/lustre/obdclass/obd_mount_server.c b/lustre/obdclass/obd_mount_server.c index 666712b..886cac0 100644 --- a/lustre/obdclass/obd_mount_server.c +++ b/lustre/obdclass/obd_mount_server.c @@ -1734,7 +1734,7 @@ static int server_statfs(struct dentry *dentry, struct kstatfs *buf) RETURN(0); } -int server_show_options(struct seq_file *seq, struct dentry *dentry) +static int server_show_options(struct seq_file *seq, struct dentry *dentry) { struct lustre_sb_info *lsi; struct lustre_mount_data *lmd; diff --git a/lustre/target/barrier.c b/lustre/target/barrier.c index 6ed91f7..83e5bf7 100644 --- a/lustre/target/barrier.c +++ b/lustre/target/barrier.c @@ -41,6 +41,8 @@ #include #include +#include "tgt_internal.h" + static LIST_HEAD(barrier_instance_list); static DEFINE_SPINLOCK(barrier_instance_lock); diff --git a/lustre/target/out_lib.c b/lustre/target/out_lib.c index 068756f..ccaedf9 100644 --- a/lustre/target/out_lib.c +++ b/lustre/target/out_lib.c @@ -90,14 +90,14 @@ EXPORT_SYMBOL(update_op_str); * \retval 0 if packing succeeds. * \retval -E2BIG if packing exceeds the maximum length. */ -int out_update_header_pack(const struct lu_env *env, - struct object_update *update, - size_t *max_update_size, - enum update_type update_op, - const struct lu_fid *fid, - unsigned int param_count, - __u16 *param_sizes, - __u32 reply_size) +static int out_update_header_pack(const struct lu_env *env, + struct object_update *update, + size_t *max_update_size, + enum update_type update_op, + const struct lu_fid *fid, + unsigned int param_count, + __u16 *param_sizes, + __u32 reply_size) { struct object_update_param *param; unsigned int i; diff --git a/lustre/target/tgt_fmd.c b/lustre/target/tgt_fmd.c index afbf668..87413d9 100644 --- a/lustre/target/tgt_fmd.c +++ b/lustre/target/tgt_fmd.c @@ -82,7 +82,7 @@ static inline void tgt_fmd_put_nolock(struct obd_export *exp, * \param[in] exp OBD export * \param[in] fmd FMD to put */ -void tgt_fmd_put(struct obd_export *exp, struct tgt_fmd_data *fmd) +static void tgt_fmd_put(struct obd_export *exp, struct tgt_fmd_data *fmd) { struct tg_export_data *ted = &exp->exp_target_data; @@ -191,8 +191,8 @@ static struct tgt_fmd_data *tgt_fmd_find_nolock(struct obd_export *exp, * \retval struct tgt_fmd_data found by FID * \retval NULL indicates FMD is not found */ -struct tgt_fmd_data *tgt_fmd_find(struct obd_export *exp, - const struct lu_fid *fid) +static struct tgt_fmd_data *tgt_fmd_find(struct obd_export *exp, + const struct lu_fid *fid) { struct tg_export_data *ted = &exp->exp_target_data; struct tgt_fmd_data *fmd; @@ -220,8 +220,8 @@ struct tgt_fmd_data *tgt_fmd_find(struct obd_export *exp, * \retval struct tgt_fmd_data found by FID * \retval NULL indicates FMD is not found */ -struct tgt_fmd_data *tgt_fmd_get(struct obd_export *exp, - const struct lu_fid *fid) +static struct tgt_fmd_data *tgt_fmd_get(struct obd_export *exp, + const struct lu_fid *fid) { struct tg_export_data *ted = &exp->exp_target_data; struct tgt_fmd_data *found = NULL, *fmd_new = NULL; diff --git a/lustre/target/tgt_handler.c b/lustre/target/tgt_handler.c index 69dc7b0..b59ffb9 100644 --- a/lustre/target/tgt_handler.c +++ b/lustre/target/tgt_handler.c @@ -1148,11 +1148,6 @@ int tgt_obd_ping(struct tgt_session_info *tsi) } EXPORT_SYMBOL(tgt_obd_ping); -int tgt_obd_log_cancel(struct tgt_session_info *tsi) -{ - return err_serious(-EOPNOTSUPP); -} - int tgt_send_buffer(struct tgt_session_info *tsi, struct lu_rdbuf *rdbuf) { struct ptlrpc_request *req = tgt_ses_req(tsi); diff --git a/lustre/target/tgt_lastrcvd.c b/lustre/target/tgt_lastrcvd.c index 1ab6065..e5b850b 100644 --- a/lustre/target/tgt_lastrcvd.c +++ b/lustre/target/tgt_lastrcvd.c @@ -551,11 +551,11 @@ static void tgt_cb_new_client(struct lu_env *env, struct thandle *th, OBD_FREE_PTR(ccb); } -int tgt_new_client_cb_add(struct thandle *th, struct obd_export *exp) +static int tgt_new_client_cb_add(struct thandle *th, struct obd_export *exp) { - struct tgt_new_client_callback *ccb; - struct dt_txn_commit_cb *dcb; - int rc; + struct tgt_new_client_callback *ccb; + struct dt_txn_commit_cb *dcb; + int rc; OBD_ALLOC_PTR(ccb); if (ccb == NULL) diff --git a/lustre/target/tgt_main.c b/lustre/target/tgt_main.c index b6ee1d6..05fad34 100644 --- a/lustre/target/tgt_main.c +++ b/lustre/target/tgt_main.c @@ -136,8 +136,8 @@ LUSTRE_RW_ATTR(sync_lock_cancel); * \retval 0 and buffer filled with data on success * \retval negative value on error */ -ssize_t tgt_fmd_count_show(struct kobject *kobj, struct attribute *attr, - char *buf) +static ssize_t tgt_fmd_count_show(struct kobject *kobj, struct attribute *attr, + char *buf) { struct obd_device *obd = container_of(kobj, struct obd_device, obd_kset.kobj); @@ -159,8 +159,8 @@ ssize_t tgt_fmd_count_show(struct kobject *kobj, struct attribute *attr, * \retval \a count on success * \retval negative value on error */ -ssize_t tgt_fmd_count_store(struct kobject *kobj, struct attribute *attr, - const char *buffer, size_t count) +static ssize_t tgt_fmd_count_store(struct kobject *kobj, struct attribute *attr, + const char *buffer, size_t count) { struct obd_device *obd = container_of(kobj, struct obd_device, obd_kset.kobj); @@ -190,8 +190,9 @@ LUSTRE_RW_ATTR(tgt_fmd_count); * \retval 0 and buffer filled with data on success * \retval negative value on error */ -ssize_t tgt_fmd_seconds_show(struct kobject *kobj, struct attribute *attr, - char *buf) +static ssize_t tgt_fmd_seconds_show(struct kobject *kobj, + struct attribute *attr, + char *buf) { struct obd_device *obd = container_of(kobj, struct obd_device, obd_kset.kobj); @@ -213,8 +214,9 @@ ssize_t tgt_fmd_seconds_show(struct kobject *kobj, struct attribute *attr, * \retval \a count on success * \retval negative number on error */ -ssize_t tgt_fmd_seconds_store(struct kobject *kobj, struct attribute *attr, - const char *buffer, size_t count) +static ssize_t tgt_fmd_seconds_store(struct kobject *kobj, + struct attribute *attr, + const char *buffer, size_t count) { struct obd_device *obd = container_of(kobj, struct obd_device, obd_kset.kobj); -- 1.8.3.1