From f77e53d3656504c804fe3dd0a3fb72080229b648 Mon Sep 17 00:00:00 2001 From: Mr NeilBrown Date: Mon, 1 Mar 2021 15:38:42 +1100 Subject: [PATCH] LU-8837 ptlrpc: mark some functions as static The functions ptlrpc_start_threads, ptlrpc_start_thread, ptlrpc_stop_all_threads ptlrpc_nrs_policy_register and ptlrpc_nrs_policy_register are only used in the same file that defines them, so mark them as 'static' and remove the declarations from include files. ptlrpc_nrs_policy_unregister is never used at all, so remove it completely. Test-Parameters: trivial Signed-off-by: Mr NeilBrown Change-Id: Id7862b9da3c58ab980c0fcd4d07c1f119fbf7581 Reviewed-on: https://review.whamcloud.com/41947 Tested-by: jenkins Reviewed-by: Andreas Dilger Reviewed-by: Aurelien Degremont Tested-by: Maloo Reviewed-by: James Simmons --- lustre/include/lustre_net.h | 6 ---- lustre/ptlrpc/lproc_ptlrpc.c | 4 +-- lustre/ptlrpc/nrs.c | 70 +---------------------------------------- lustre/ptlrpc/ptlrpc_internal.h | 1 - lustre/ptlrpc/service.c | 8 +++-- 5 files changed, 8 insertions(+), 81 deletions(-) diff --git a/lustre/include/lustre_net.h b/lustre/include/lustre_net.h index e732457..8e60c92 100644 --- a/lustre/include/lustre_net.h +++ b/lustre/include/lustre_net.h @@ -1162,11 +1162,7 @@ static inline int ptlrpc_req_interpret(const struct lu_env *env, /** \addtogroup nrs * @{ */ -int ptlrpc_nrs_policy_register(struct ptlrpc_nrs_pol_conf *conf); -int ptlrpc_nrs_policy_unregister(struct ptlrpc_nrs_pol_conf *conf); void ptlrpc_nrs_req_hp_move(struct ptlrpc_request *req); -void nrs_policy_get_info_locked(struct ptlrpc_nrs_policy *policy, - struct ptlrpc_nrs_pol_info *info); /* * Can the request be moved from the regular NRS head to the high-priority NRS @@ -2264,9 +2260,7 @@ struct ptlrpc_service *ptlrpc_register_service( struct ptlrpc_service_conf *conf, struct kset *parent, struct dentry *debugfs_entry); -void ptlrpc_stop_all_threads(struct ptlrpc_service *svc); -int ptlrpc_start_threads(struct ptlrpc_service *svc); int ptlrpc_unregister_service(struct ptlrpc_service *service); int ptlrpc_service_health_check(struct ptlrpc_service *); void ptlrpc_server_drop_request(struct ptlrpc_request *req); diff --git a/lustre/ptlrpc/lproc_ptlrpc.c b/lustre/ptlrpc/lproc_ptlrpc.c index 88f0d26..71af587 100644 --- a/lustre/ptlrpc/lproc_ptlrpc.c +++ b/lustre/ptlrpc/lproc_ptlrpc.c @@ -503,8 +503,8 @@ static const char *nrs_state2str(enum ptlrpc_nrs_pol_state state) * \param[in] policy The policy * \param[out] info Holds returned status information */ -void nrs_policy_get_info_locked(struct ptlrpc_nrs_policy *policy, - struct ptlrpc_nrs_pol_info *info) +static void nrs_policy_get_info_locked(struct ptlrpc_nrs_policy *policy, + struct ptlrpc_nrs_pol_info *info) { LASSERT(policy != NULL); LASSERT(info != NULL); diff --git a/lustre/ptlrpc/nrs.c b/lustre/ptlrpc/nrs.c index 102d2e8..ccfc4e9 100644 --- a/lustre/ptlrpc/nrs.c +++ b/lustre/ptlrpc/nrs.c @@ -1164,7 +1164,7 @@ again: * \retval -ve error * \retval 0 success */ -int ptlrpc_nrs_policy_register(struct ptlrpc_nrs_pol_conf *conf) +static int ptlrpc_nrs_policy_register(struct ptlrpc_nrs_pol_conf *conf) { struct ptlrpc_service *svc; struct ptlrpc_nrs_pol_desc *desc; @@ -1306,74 +1306,6 @@ fail: RETURN(rc); } -EXPORT_SYMBOL(ptlrpc_nrs_policy_register); - -/** - * Unregisters a previously registered policy with NRS core. All instances of - * the policy on all NRS heads of all supported services are removed. - * - * N.B. This function should only be called from a module's exit() function. - * Although it can be used for policies that ship alongside NRS core, the - * function is primarily intended for policies that register externally, - * from other modules. - * - * \param[in] conf configuration information for the policy to unregister - * - * \retval -ve error - * \retval 0 success - */ -int ptlrpc_nrs_policy_unregister(struct ptlrpc_nrs_pol_conf *conf) -{ - struct ptlrpc_nrs_pol_desc *desc; - int rc; - ENTRY; - - LASSERT(conf != NULL); - - if (conf->nc_flags & PTLRPC_NRS_FL_FALLBACK) { - CERROR("Unable to unregister a fallback policy, unless the " - "PTLRPC service is stopping.\n"); - RETURN(-EPERM); - } - - conf->nc_name[NRS_POL_NAME_MAX - 1] = '\0'; - - mutex_lock(&nrs_core.nrs_mutex); - - desc = nrs_policy_find_desc_locked(conf->nc_name); - if (desc == NULL) { - CERROR("Failing to unregister NRS policy %s which has " - "not been registered with NRS core!\n", - conf->nc_name); - GOTO(not_exist, rc = -ENOENT); - } - - mutex_lock(&ptlrpc_all_services_mutex); - - rc = nrs_policy_unregister_locked(desc); - if (rc < 0) { - if (rc == -EBUSY) - CERROR("Please first stop policy %s on all service " - "partitions and then retry to unregister the " - "policy.\n", conf->nc_name); - GOTO(fail, rc); - } - - CDEBUG(D_INFO, "Unregistering policy %s from NRS core.\n", - conf->nc_name); - - list_del(&desc->pd_list); - OBD_FREE_PTR(desc); - -fail: - mutex_unlock(&ptlrpc_all_services_mutex); - -not_exist: - mutex_unlock(&nrs_core.nrs_mutex); - - RETURN(rc); -} -EXPORT_SYMBOL(ptlrpc_nrs_policy_unregister); /** * Setup NRS heads on all service partitions of service \a svc, and register diff --git a/lustre/ptlrpc/ptlrpc_internal.h b/lustre/ptlrpc/ptlrpc_internal.h index 04cbabf..97117bf 100644 --- a/lustre/ptlrpc/ptlrpc_internal.h +++ b/lustre/ptlrpc/ptlrpc_internal.h @@ -67,7 +67,6 @@ extern struct mutex pinger_mutex; extern lnet_handler_t ptlrpc_handler; extern struct percpu_ref ptlrpc_pending; -int ptlrpc_start_thread(struct ptlrpc_service_part *svcpt, int wait); /* ptlrpcd.c */ int ptlrpcd_start(struct ptlrpcd_ctl *pc); diff --git a/lustre/ptlrpc/service.c b/lustre/ptlrpc/service.c index acb23bc..738a313 100644 --- a/lustre/ptlrpc/service.c +++ b/lustre/ptlrpc/service.c @@ -63,6 +63,8 @@ MODULE_PARM_DESC(at_extra, "How much extra time to give with each early reply"); static int ptlrpc_server_post_idle_rqbds(struct ptlrpc_service_part *svcpt); static void ptlrpc_server_hpreq_fini(struct ptlrpc_request *req); static void ptlrpc_at_remove_timed(struct ptlrpc_request *req); +static int ptlrpc_start_threads(struct ptlrpc_service *svc); +static int ptlrpc_start_thread(struct ptlrpc_service_part *svcpt, int wait); /** Holds a list of all PTLRPC services */ LIST_HEAD(ptlrpc_all_services); @@ -3111,7 +3113,7 @@ static void ptlrpc_svcpt_stop_threads(struct ptlrpc_service_part *svcpt) /** * Stops all threads of a particular service \a svc */ -void ptlrpc_stop_all_threads(struct ptlrpc_service *svc) +static void ptlrpc_stop_all_threads(struct ptlrpc_service *svc) { struct ptlrpc_service_part *svcpt; int i; @@ -3126,7 +3128,7 @@ void ptlrpc_stop_all_threads(struct ptlrpc_service *svc) EXIT; } -int ptlrpc_start_threads(struct ptlrpc_service *svc) +static int ptlrpc_start_threads(struct ptlrpc_service *svc) { int rc = 0; int i; @@ -3158,7 +3160,7 @@ int ptlrpc_start_threads(struct ptlrpc_service *svc) RETURN(rc); } -int ptlrpc_start_thread(struct ptlrpc_service_part *svcpt, int wait) +static int ptlrpc_start_thread(struct ptlrpc_service_part *svcpt, int wait) { struct ptlrpc_thread *thread; struct ptlrpc_service *svc; -- 1.8.3.1