From: Frank Zago Date: Tue, 30 Sep 2014 03:10:50 +0000 (-0500) Subject: LU-5396 mdc: (and lmv, mgc, osc) make some functions static X-Git-Tag: 2.6.92~74 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=35fe4c696dd0faadc9405c19c68f0dd56aa5bb01 LU-5396 mdc: (and lmv, mgc, osc) 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: I8dcc5224c1da75cfb5ef7afb1fdb0f72422a3ac0 Reviewed-on: http://review.whamcloud.com/12222 Reviewed-by: Bob Glossman Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Dmitry Eremin Reviewed-by: Oleg Drokin --- diff --git a/lustre/lmv/lmv_intent.c b/lustre/lmv/lmv_intent.c index dc1298d..e6f43e0 100644 --- a/lustre/lmv/lmv_intent.c +++ b/lustre/lmv/lmv_intent.c @@ -308,9 +308,11 @@ cleanup: * IT_OPEN is intended to open (and create, possible) an object. Parent (pid) * may be split dir. */ -int lmv_intent_open(struct obd_export *exp, struct md_op_data *op_data, - struct lookup_intent *it, struct ptlrpc_request **reqp, - ldlm_blocking_callback cb_blocking, __u64 extra_lock_flags) +static int lmv_intent_open(struct obd_export *exp, struct md_op_data *op_data, + struct lookup_intent *it, + struct ptlrpc_request **reqp, + ldlm_blocking_callback cb_blocking, + __u64 extra_lock_flags) { struct obd_device *obd = exp->exp_obd; struct lmv_obd *lmv = &obd->u.lmv; diff --git a/lustre/lmv/lproc_lmv.c b/lustre/lmv/lproc_lmv.c index 26461c7..fc68fa5 100644 --- a/lustre/lmv/lproc_lmv.c +++ b/lustre/lmv/lproc_lmv.c @@ -42,6 +42,8 @@ #include #include +#include "lmv_internal.h" + #ifndef LPROCFS static struct lprocfs_vars lprocfs_module_vars[] = { {0} }; static struct lprocfs_vars lprocfs_obd_vars[] = { {0} }; @@ -180,7 +182,7 @@ static int lmv_tgt_seq_show(struct seq_file *p, void *v) tgt->ltd_uuid.uuid, tgt->ltd_active ? "" : "IN"); } -struct seq_operations lmv_tgt_sops = { +static const struct seq_operations lmv_tgt_sops = { .start = lmv_tgt_seq_start, .stop = lmv_tgt_seq_stop, .next = lmv_tgt_seq_next, diff --git a/lustre/mdc/lproc_mdc.c b/lustre/mdc/lproc_mdc.c index d6b9c26..ab47cac 100644 --- a/lustre/mdc/lproc_mdc.c +++ b/lustre/mdc/lproc_mdc.c @@ -40,6 +40,8 @@ #include #include +#include "mdc_internal.h" + #ifdef LPROCFS static int mdc_max_rpcs_in_flight_seq_show(struct seq_file *m, void *v) diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c index 09cfac5..7fb41ec 100644 --- a/lustre/mdc/mdc_request.c +++ b/lustre/mdc/mdc_request.c @@ -63,8 +63,9 @@ struct mdc_renew_capa_args { static int mdc_cleanup(struct obd_device *obd); -int mdc_unpack_capa(struct obd_export *exp, struct ptlrpc_request *req, - const struct req_msg_field *field, struct obd_capa **oc) +static int mdc_unpack_capa(struct obd_export *exp, struct ptlrpc_request *req, + const struct req_msg_field *field, + struct obd_capa **oc) { struct lustre_capa *capa; struct obd_capa *c; @@ -149,8 +150,8 @@ out: } /* This should be mdc_get_info("rootfid") */ -int mdc_getstatus(struct obd_export *exp, struct lu_fid *rootfid, - struct obd_capa **pc) +static int mdc_getstatus(struct obd_export *exp, struct lu_fid *rootfid, + struct obd_capa **pc) { return send_getstatus(class_exp2cliimp(exp), rootfid, pc, LUSTRE_IMP_FULL, 0); @@ -215,8 +216,8 @@ static int mdc_getattr_common(struct obd_export *exp, RETURN(0); } -int mdc_getattr(struct obd_export *exp, struct md_op_data *op_data, - struct ptlrpc_request **request) +static int mdc_getattr(struct obd_export *exp, struct md_op_data *op_data, + struct ptlrpc_request **request) { struct ptlrpc_request *req; int rc; @@ -260,8 +261,8 @@ int mdc_getattr(struct obd_export *exp, struct md_op_data *op_data, RETURN(rc); } -int mdc_getattr_name(struct obd_export *exp, struct md_op_data *op_data, - struct ptlrpc_request **request) +static int mdc_getattr_name(struct obd_export *exp, struct md_op_data *op_data, + struct ptlrpc_request **request) { struct ptlrpc_request *req; int rc; @@ -417,10 +418,12 @@ static int mdc_xattr_common(struct obd_export *exp,const struct req_format *fmt, RETURN(rc); } -int mdc_setxattr(struct obd_export *exp, const struct lu_fid *fid, - struct obd_capa *oc, obd_valid valid, const char *xattr_name, - const char *input, int input_size, int output_size, - int flags, __u32 suppgid, struct ptlrpc_request **request) +static int mdc_setxattr(struct obd_export *exp, const struct lu_fid *fid, + struct obd_capa *oc, obd_valid valid, + const char *xattr_name, + const char *input, int input_size, int output_size, + int flags, __u32 suppgid, + struct ptlrpc_request **request) { return mdc_xattr_common(exp, &RQF_MDS_REINT_SETXATTR, fid, oc, MDS_REINT, valid, xattr_name, @@ -428,10 +431,11 @@ int mdc_setxattr(struct obd_export *exp, const struct lu_fid *fid, suppgid, request); } -int mdc_getxattr(struct obd_export *exp, const struct lu_fid *fid, - struct obd_capa *oc, obd_valid valid, const char *xattr_name, - const char *input, int input_size, int output_size, - int flags, struct ptlrpc_request **request) +static int mdc_getxattr(struct obd_export *exp, const struct lu_fid *fid, + struct obd_capa *oc, obd_valid valid, + const char *xattr_name, + const char *input, int input_size, int output_size, + int flags, struct ptlrpc_request **request) { return mdc_xattr_common(exp, &RQF_MDS_GETXATTR, fid, oc, MDS_GETXATTR, valid, xattr_name, @@ -832,8 +836,8 @@ static void mdc_close_handle_reply(struct ptlrpc_request *req, } } -int mdc_close(struct obd_export *exp, struct md_op_data *op_data, - struct md_open_data *mod, struct ptlrpc_request **request) +static int mdc_close(struct obd_export *exp, struct md_op_data *op_data, + struct md_open_data *mod, struct ptlrpc_request **request) { struct obd_device *obd = class_exp2obd(exp); struct ptlrpc_request *req; @@ -950,8 +954,8 @@ int mdc_close(struct obd_export *exp, struct md_op_data *op_data, RETURN(rc < 0 ? rc : saved_rc); } -int mdc_done_writing(struct obd_export *exp, struct md_op_data *op_data, - struct md_open_data *mod) +static int mdc_done_writing(struct obd_export *exp, struct md_op_data *op_data, + struct md_open_data *mod) { struct obd_device *obd = class_exp2obd(exp); struct ptlrpc_request *req; @@ -2427,9 +2431,9 @@ out: return rc; } -int mdc_get_info_rpc(struct obd_export *exp, - obd_count keylen, void *key, - int vallen, void *val) +static int mdc_get_info_rpc(struct obd_export *exp, + obd_count keylen, void *key, + int vallen, void *val) { struct obd_import *imp = class_exp2cliimp(exp); struct ptlrpc_request *req; @@ -2609,11 +2613,11 @@ static int mdc_kuc_reregister(struct obd_import *imp) (void *)imp); } -int mdc_set_info_async(const struct lu_env *env, - struct obd_export *exp, - obd_count keylen, void *key, - obd_count vallen, void *val, - struct ptlrpc_request_set *set) +static int mdc_set_info_async(const struct lu_env *env, + struct obd_export *exp, + obd_count keylen, void *key, + obd_count vallen, void *val, + struct ptlrpc_request_set *set) { struct obd_import *imp = class_exp2cliimp(exp); int rc; @@ -2661,9 +2665,9 @@ int mdc_set_info_async(const struct lu_env *env, RETURN(-EINVAL); } -int mdc_get_info(const struct lu_env *env, struct obd_export *exp, - __u32 keylen, void *key, __u32 *vallen, void *val, - struct lov_stripe_md *lsm) +static int mdc_get_info(const struct lu_env *env, struct obd_export *exp, + __u32 keylen, void *key, __u32 *vallen, void *val, + struct lov_stripe_md *lsm) { int rc = -EINVAL; @@ -2725,8 +2729,8 @@ int mdc_get_info(const struct lu_env *env, struct obd_export *exp, RETURN(rc); } -int mdc_fsync(struct obd_export *exp, const struct lu_fid *fid, - struct obd_capa *oc, struct ptlrpc_request **request) +static int mdc_fsync(struct obd_export *exp, const struct lu_fid *fid, + struct obd_capa *oc, struct ptlrpc_request **request) { struct ptlrpc_request *req; int rc; @@ -2819,7 +2823,8 @@ int mdc_fid_alloc(const struct lu_env *env, struct obd_export *exp, RETURN(seq_client_alloc_fid(env, seq, fid)); } -struct obd_uuid *mdc_get_uuid(struct obd_export *exp) { +static struct obd_uuid *mdc_get_uuid(struct obd_export *exp) +{ struct client_obd *cli = &exp->exp_obd->u.cli; return &cli->cl_target_uuid; } @@ -2851,7 +2856,7 @@ static int mdc_resource_inode_free(struct ldlm_resource *res) return 0; } -struct ldlm_valblock_ops inode_lvbo = { +static struct ldlm_valblock_ops inode_lvbo = { .lvbo_free = mdc_resource_inode_free }; @@ -3015,9 +3020,9 @@ static int mdc_process_config(struct obd_device *obd, obd_count len, void *buf) /* get remote permission for current user on fid */ -int mdc_get_remote_perm(struct obd_export *exp, const struct lu_fid *fid, - struct obd_capa *oc, __u32 suppgid, - struct ptlrpc_request **request) +static int mdc_get_remote_perm(struct obd_export *exp, const struct lu_fid *fid, + struct obd_capa *oc, __u32 suppgid, + struct ptlrpc_request **request) { struct ptlrpc_request *req; int rc; @@ -3108,7 +3113,7 @@ static int mdc_renew_capa(struct obd_export *exp, struct obd_capa *oc, RETURN(0); } -struct obd_ops mdc_obd_ops = { +static struct obd_ops mdc_obd_ops = { .o_owner = THIS_MODULE, .o_setup = mdc_setup, .o_precleanup = mdc_precleanup, @@ -3131,7 +3136,7 @@ struct obd_ops mdc_obd_ops = { .o_quotacheck = mdc_quotacheck }; -struct md_ops mdc_md_ops = { +static struct md_ops mdc_md_ops = { .m_getstatus = mdc_getstatus, .m_null_inode = mdc_null_inode, .m_find_cbdata = mdc_find_cbdata, @@ -3165,7 +3170,7 @@ struct md_ops mdc_md_ops = { .m_revalidate_lock = mdc_revalidate_lock }; -int __init mdc_init(void) +static int __init mdc_init(void) { return class_register_type(&mdc_obd_ops, &mdc_md_ops, true, NULL, LUSTRE_MDC_NAME, NULL); diff --git a/lustre/mgc/mgc_request.c b/lustre/mgc/mgc_request.c index 347590f..de63a86 100644 --- a/lustre/mgc/mgc_request.c +++ b/lustre/mgc/mgc_request.c @@ -96,7 +96,8 @@ int mgc_fsname2resid(char *fsname, struct ldlm_res_id *res_id, int type) } EXPORT_SYMBOL(mgc_fsname2resid); -int mgc_logname2resid(char *logname, struct ldlm_res_id *res_id, int type) +static int mgc_logname2resid(char *logname, struct ldlm_res_id *res_id, + int type) { char *name_end; int len; @@ -1174,9 +1175,9 @@ static int mgc_target_register(struct obd_export *exp, RETURN(rc); } -int mgc_set_info_async(const struct lu_env *env, struct obd_export *exp, - obd_count keylen, void *key, obd_count vallen, - void *val, struct ptlrpc_request_set *set) +static int mgc_set_info_async(const struct lu_env *env, struct obd_export *exp, + obd_count keylen, void *key, obd_count vallen, + void *val, struct ptlrpc_request_set *set) { int rc = -EINVAL; ENTRY; @@ -2034,7 +2035,7 @@ out: RETURN(rc); } -struct obd_ops mgc_obd_ops = { +static struct obd_ops mgc_obd_ops = { .o_owner = THIS_MODULE, .o_setup = mgc_setup, .o_precleanup = mgc_precleanup, @@ -2049,7 +2050,7 @@ struct obd_ops mgc_obd_ops = { .o_process_config = mgc_process_config, }; -int __init mgc_init(void) +static int __init mgc_init(void) { return class_register_type(&mgc_obd_ops, NULL, true, NULL, LUSTRE_MGC_NAME, NULL); diff --git a/lustre/ofd/ofd_dev.c b/lustre/ofd/ofd_dev.c index 698fd7f..5e34ecc 100644 --- a/lustre/ofd/ofd_dev.c +++ b/lustre/ofd/ofd_dev.c @@ -465,7 +465,7 @@ static int ofd_object_print(const struct lu_env *env, void *cookie, return (*p)(env, cookie, LUSTRE_OST_NAME"-object@%p", o); } -struct lu_object_operations ofd_obj_ops = { +static struct lu_object_operations ofd_obj_ops = { .loo_object_init = ofd_object_init, .loo_object_free = ofd_object_free, .loo_object_print = ofd_object_print @@ -895,7 +895,7 @@ out_free: * \retval 0 if successful * \retval negative value on error */ -int ofd_set_info_hdl(struct tgt_session_info *tsi) +static int ofd_set_info_hdl(struct tgt_session_info *tsi) { struct ptlrpc_request *req = tgt_ses_req(tsi); struct ost_body *body = NULL, *repbody; @@ -1137,7 +1137,7 @@ unlock_zero_regions(struct ldlm_namespace *ns, struct list_head *locked) * \retval 0 if successful * \retval negative value on error */ -int ofd_get_info_hdl(struct tgt_session_info *tsi) +static int ofd_get_info_hdl(struct tgt_session_info *tsi) { struct obd_export *exp = tsi->tsi_exp; struct ofd_device *ofd = ofd_exp(exp); @@ -2503,13 +2503,13 @@ static void ofd_punch_hpreq_fini(struct ptlrpc_request *req) ofd_punch_hpreq_check(req); } -struct ptlrpc_hpreq_ops ofd_hpreq_rw = { +static struct ptlrpc_hpreq_ops ofd_hpreq_rw = { .hpreq_lock_match = ofd_rw_hpreq_lock_match, .hpreq_check = ofd_rw_hpreq_check, .hpreq_fini = ofd_rw_hpreq_fini }; -struct ptlrpc_hpreq_ops ofd_hpreq_punch = { +static struct ptlrpc_hpreq_ops ofd_hpreq_punch = { .hpreq_lock_match = ofd_punch_hpreq_lock_match, .hpreq_check = ofd_punch_hpreq_check, .hpreq_fini = ofd_punch_hpreq_fini @@ -3016,7 +3016,7 @@ static struct lu_device_type ofd_device_type = { * \retval 0 if successful * \retval negative value on error */ -int __init ofd_init(void) +static int __init ofd_init(void) { int rc; @@ -3041,7 +3041,7 @@ int __init ofd_init(void) * This function is called upon OFD module unloading. * It frees all related structures and unregisters OFD device type. */ -void __exit ofd_exit(void) +static void __exit ofd_exit(void) { ofd_fmd_exit(); lu_kmem_fini(ofd_caches); diff --git a/lustre/ofd/ofd_obd.c b/lustre/ofd/ofd_obd.c index 5656ae9..ede28dc 100644 --- a/lustre/ofd/ofd_obd.c +++ b/lustre/ofd/ofd_obd.c @@ -566,7 +566,7 @@ int ofd_postrecov(const struct lu_env *env, struct ofd_device *ofd) * \retval 0 if successful * \retval negative value on error */ -int ofd_obd_postrecov(struct obd_device *obd) +static int ofd_obd_postrecov(struct obd_device *obd) { struct lu_env env; struct lu_device *ldev = obd->obd_lu_dev; @@ -897,8 +897,8 @@ out: * \retval 0 if successful * \retval negative value on error */ -int ofd_echo_setattr(const struct lu_env *env, struct obd_export *exp, - struct obd_info *oinfo, struct obd_trans_info *oti) +static int ofd_echo_setattr(const struct lu_env *env, struct obd_export *exp, + struct obd_info *oinfo, struct obd_trans_info *oti) { struct ofd_thread_info *info; struct ofd_device *ofd = ofd_exp(exp); @@ -1048,8 +1048,8 @@ int ofd_destroy_by_fid(const struct lu_env *env, struct ofd_device *ofd, * \retval 0 if successful * \retval negative value on error */ -int ofd_echo_destroy(const struct lu_env *env, struct obd_export *exp, - struct obdo *oa, struct obd_trans_info *oti) +static int ofd_echo_destroy(const struct lu_env *env, struct obd_export *exp, + struct obdo *oa, struct obd_trans_info *oti) { struct ofd_device *ofd = ofd_exp(exp); struct lu_fid *fid = &oa->o_oi.oi_fid; @@ -1096,8 +1096,8 @@ out: * \retval 0 if successful * \retval negative value on error */ -int ofd_echo_create(const struct lu_env *env, struct obd_export *exp, - struct obdo *oa, struct obd_trans_info *oti) +static int ofd_echo_create(const struct lu_env *env, struct obd_export *exp, + struct obdo *oa, struct obd_trans_info *oti) { struct ofd_device *ofd = ofd_exp(exp); struct ofd_thread_info *info; @@ -1177,8 +1177,8 @@ out_sem: * \retval 0 if successful * \retval negative value on error */ -int ofd_echo_getattr(const struct lu_env *env, struct obd_export *exp, - struct obd_info *oinfo) +static int ofd_echo_getattr(const struct lu_env *env, struct obd_export *exp, + struct obd_info *oinfo) { struct ofd_device *ofd = ofd_exp(exp); struct ofd_thread_info *info; @@ -1302,8 +1302,8 @@ out: * \retval 0 if successful * \retval negative value on error */ -int ofd_iocontrol(unsigned int cmd, struct obd_export *exp, int len, - void *karg, void *uarg) +static int ofd_iocontrol(unsigned int cmd, struct obd_export *exp, int len, + void *karg, void *uarg) { struct lu_env env; struct ofd_device *ofd = ofd_exp(exp); diff --git a/lustre/ofd/ofd_objects.c b/lustre/ofd/ofd_objects.c index 19b790b..eea06e7 100644 --- a/lustre/ofd/ofd_objects.c +++ b/lustre/ofd/ofd_objects.c @@ -60,8 +60,8 @@ * \retval 0 if version matches * \retval -EOVERFLOW on version mismatch */ -int ofd_version_get_check(struct ofd_thread_info *info, - struct ofd_object *fo) +static int ofd_version_get_check(struct ofd_thread_info *info, + struct ofd_object *fo) { dt_obj_version_t curr_version; diff --git a/lustre/osc/osc_cache.c b/lustre/osc/osc_cache.c index f2bad36..68dec1a 100644 --- a/lustre/osc/osc_cache.c +++ b/lustre/osc/osc_cache.c @@ -596,9 +596,10 @@ static inline int overlapped(struct osc_extent *ex1, struct osc_extent *ex2) * Find or create an extent which includes @index, core function to manage * extent tree. */ -struct osc_extent *osc_extent_find(const struct lu_env *env, - struct osc_object *obj, pgoff_t index, - int *grants) +static struct osc_extent *osc_extent_find(const struct lu_env *env, + struct osc_object *obj, pgoff_t index, + int *grants) + { struct client_obd *cli = osc_cli(obj); struct osc_lock *olck; @@ -1423,8 +1424,8 @@ static void __osc_unreserve_grant(struct client_obd *cli, } } -void osc_unreserve_grant(struct client_obd *cli, - unsigned int reserved, unsigned int unused) +static void osc_unreserve_grant(struct client_obd *cli, + unsigned int reserved, unsigned int unused) { spin_lock(&cli->cl_loi_list_lock); __osc_unreserve_grant(cli, reserved, unused); diff --git a/lustre/osc/osc_internal.h b/lustre/osc/osc_internal.h index c26e70f..96dd416 100644 --- a/lustre/osc/osc_internal.h +++ b/lustre/osc/osc_internal.h @@ -135,6 +135,10 @@ long osc_lru_shrink(const struct lu_env *env, struct client_obd *cli, long target, bool force); long osc_lru_reclaim(struct client_obd *cli); +extern spinlock_t osc_ast_guard; +extern struct lu_kmem_descr osc_caches[]; +extern struct lock_class_key osc_ast_guard_class; + unsigned long osc_ldlm_weigh_ast(struct ldlm_lock *dlmlock); int osc_cleanup(struct obd_device *obd); diff --git a/lustre/osc/osc_object.c b/lustre/osc/osc_object.c index e1e4fdb..c7d8dfa 100644 --- a/lustre/osc/osc_object.c +++ b/lustre/osc/osc_object.c @@ -43,8 +43,8 @@ #include "osc_cl_internal.h" -/** \addtogroup osc - * @{ +/** \addtogroup osc + * @{ */ /***************************************************************************** @@ -170,8 +170,8 @@ static int osc_attr_get(const struct lu_env *env, struct cl_object *obj, return 0; } -int osc_attr_set(const struct lu_env *env, struct cl_object *obj, - const struct cl_attr *attr, unsigned valid) +static int osc_attr_set(const struct lu_env *env, struct cl_object *obj, + const struct cl_attr *attr, unsigned valid) { struct lov_oinfo *oinfo = cl2osc(obj)->oo_oinfo; struct ost_lvb *lvb = &oinfo->loi_lvb; diff --git a/lustre/osc/osc_page.c b/lustre/osc/osc_page.c index b543093..5c3e4995 100644 --- a/lustre/osc/osc_page.c +++ b/lustre/osc/osc_page.c @@ -359,8 +359,9 @@ static void osc_page_delete(const struct lu_env *env, EXIT; } -void osc_page_clip(const struct lu_env *env, const struct cl_page_slice *slice, - int from, int to) +static void osc_page_clip(const struct lu_env *env, + const struct cl_page_slice *slice, + int from, int to) { struct osc_page *opg = cl2osc_page(slice); struct osc_async_page *oap = &opg->ops_oap; diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index b71705e..28874eb 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -3087,7 +3087,7 @@ static int osc_process_config(struct obd_device *obd, obd_count len, void *buf) return osc_process_config_base(obd, buf); } -struct obd_ops osc_obd_ops = { +static struct obd_ops osc_obd_ops = { .o_owner = THIS_MODULE, .o_setup = osc_setup, .o_precleanup = osc_precleanup, @@ -3116,10 +3116,7 @@ struct obd_ops osc_obd_ops = { .o_quotacheck = osc_quotacheck, }; -extern struct lu_kmem_descr osc_caches[]; -extern struct lock_class_key osc_ast_guard_class; - -int __init osc_init(void) +static int __init osc_init(void) { bool enable_proc = true; struct obd_type *type; diff --git a/lustre/osd-ldiskfs/osd_compat.c b/lustre/osd-ldiskfs/osd_compat.c index de373e5..0a34228 100644 --- a/lustre/osd-ldiskfs/osd_compat.c +++ b/lustre/osd-ldiskfs/osd_compat.c @@ -120,7 +120,7 @@ out_up: return dchild; } -int osd_last_rcvd_subdir_count(struct osd_device *osd) +static int osd_last_rcvd_subdir_count(struct osd_device *osd) { struct lr_server_data lsd; struct dentry *dlast; @@ -480,7 +480,8 @@ int osd_obj_map_init(const struct lu_env *env, struct osd_device *dev) RETURN(rc); } -struct osd_obj_seq *osd_seq_find_locked(struct osd_obj_map *map, obd_seq seq) +static struct osd_obj_seq *osd_seq_find_locked(struct osd_obj_map *map, + obd_seq seq) { struct osd_obj_seq *osd_seq; @@ -491,7 +492,7 @@ struct osd_obj_seq *osd_seq_find_locked(struct osd_obj_map *map, obd_seq seq) return NULL; } -struct osd_obj_seq *osd_seq_find(struct osd_obj_map *map, obd_seq seq) +static struct osd_obj_seq *osd_seq_find(struct osd_obj_map *map, obd_seq seq) { struct osd_obj_seq *osd_seq; @@ -646,11 +647,11 @@ static int osd_obj_del_entry(struct osd_thread_info *info, RETURN(rc); } -int osd_obj_add_entry(struct osd_thread_info *info, - struct osd_device *osd, - struct dentry *dir, char *name, - const struct osd_inode_id *id, - handle_t *th) +static int osd_obj_add_entry(struct osd_thread_info *info, + struct osd_device *osd, + struct dentry *dir, char *name, + const struct osd_inode_id *id, + handle_t *th) { struct dentry *child; struct inode *inode; diff --git a/lustre/osd-ldiskfs/osd_dynlocks.c b/lustre/osd-ldiskfs/osd_dynlocks.c index e14fab4..27e6ecb 100644 --- a/lustre/osd-ldiskfs/osd_dynlocks.c +++ b/lustre/osd-ldiskfs/osd_dynlocks.c @@ -35,8 +35,7 @@ #include #include "osd_dynlocks.h" - -extern struct kmem_cache *dynlock_cachep; +#include "osd_internal.h" #define DYNLOCK_HANDLE_MAGIC 0xd19a10c #define DYNLOCK_HANDLE_DEAD 0xd1956ee diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c index 80d1e67..d958695 100644 --- a/lustre/osd-ldiskfs/osd_handler.c +++ b/lustre/osd-ldiskfs/osd_handler.c @@ -976,8 +976,8 @@ static struct thandle *osd_trans_create(const struct lu_env *env, /* * Concurrency: shouldn't matter. */ -int osd_trans_start(const struct lu_env *env, struct dt_device *d, - struct thandle *th) +static int osd_trans_start(const struct lu_env *env, struct dt_device *d, + struct thandle *th) { struct osd_thread_info *oti = osd_oti_get(env); struct osd_device *dev = osd_dt_dev(d); @@ -2023,9 +2023,9 @@ static int osd_attr_set(const struct lu_env *env, return rc; } -struct dentry *osd_child_dentry_get(const struct lu_env *env, - struct osd_object *obj, - const char *name, const int namelen) +static struct dentry *osd_child_dentry_get(const struct lu_env *env, + struct osd_object *obj, + const char *name, const int namelen) { return osd_child_dentry_by_inode(env, obj->oo_inode, name, namelen); } @@ -2587,8 +2587,8 @@ int osd_ea_fid_set(struct osd_thread_info *info, struct inode *inode, * \ldiskfs_dentry_param is used only to pass fid from osd to ldiskfs. * its inmemory API. */ -void osd_get_ldiskfs_dirent_param(struct ldiskfs_dentry_param *param, - const struct lu_fid *fid) +static void osd_get_ldiskfs_dirent_param(struct ldiskfs_dentry_param *param, + const struct lu_fid *fid) { if (!fid_is_namespace_visible(fid) || OBD_FAIL_CHECK(OBD_FAIL_FID_IGIF)) { @@ -4387,9 +4387,9 @@ out: * \retval osd_object on success * \retval -ve on error */ -struct osd_object *osd_object_find(const struct lu_env *env, - struct dt_object *dt, - const struct lu_fid *fid) +static struct osd_object *osd_object_find(const struct lu_env *env, + struct dt_object *dt, + const struct lu_fid *fid) { struct lu_device *ludev = dt->do_lu.lo_dev; struct osd_object *child = NULL; @@ -6312,8 +6312,8 @@ static int osd_prepare(const struct lu_env *env, struct lu_device *pdev, RETURN(result); } -int osd_fid_alloc(const struct lu_env *env, struct obd_export *exp, - struct lu_fid *fid, struct md_op_data *op_data) +static int osd_fid_alloc(const struct lu_env *env, struct obd_export *exp, + struct lu_fid *fid, struct md_op_data *op_data) { struct osd_device *osd = osd_dev(exp->exp_obd->obd_lu_dev); @@ -6350,7 +6350,7 @@ static const struct lu_device_type_operations osd_device_type_ops = { .ldto_device_fini = osd_device_fini }; -struct lu_device_type osd_device_type = { +static struct lu_device_type osd_device_type = { .ldt_tags = LU_DEVICE_DT, .ldt_name = LUSTRE_OSD_LDISKFS_NAME, .ldt_ops = &osd_device_type_ops, diff --git a/lustre/osd-ldiskfs/osd_iam.c b/lustre/osd-ldiskfs/osd_iam.c index e7b5ae6..a92df9c 100644 --- a/lustre/osd-ldiskfs/osd_iam.c +++ b/lustre/osd-ldiskfs/osd_iam.c @@ -543,7 +543,8 @@ int iam_leaf_at_end(const struct iam_leaf *leaf) return iam_leaf_ops(leaf)->at_end(leaf); } -void iam_leaf_split(struct iam_leaf *l, struct buffer_head **bh, iam_ptr_t nr) +static void iam_leaf_split(struct iam_leaf *l, struct buffer_head **bh, + iam_ptr_t nr) { iam_leaf_ops(l)->split(l, bh, nr); } @@ -749,7 +750,7 @@ static struct dynlock_handle *iam_lock_htree(struct iam_container *ic, return dynlock_lock(&ic->ic_tree_lock, value, lt, GFP_NOFS); } -int iam_index_lock(struct iam_path *path, struct dynlock_handle **lh) +static int iam_index_lock(struct iam_path *path, struct dynlock_handle **lh) { struct iam_frame *f; @@ -809,8 +810,8 @@ int dx_index_is_compat(struct iam_path *path) * */ -struct iam_entry *iam_find_position(struct iam_path *path, - struct iam_frame *frame) +static struct iam_entry *iam_find_position(struct iam_path *path, + struct iam_frame *frame) { int count; struct iam_entry *p; @@ -1036,8 +1037,8 @@ static int iam_check_full_path(struct iam_path *path, int search) * Performs path lookup and returns with found leaf (if any) locked by htree * lock. */ -int iam_lookup_lock(struct iam_path *path, - struct dynlock_handle **dl, enum dynlock_type lt) +static int iam_lookup_lock(struct iam_path *path, + struct dynlock_handle **dl, enum dynlock_type lt) { int result; @@ -1652,7 +1653,7 @@ int iam_it_key_size(const struct iam_iterator *it) } EXPORT_SYMBOL(iam_it_key_size); -struct buffer_head * +static struct buffer_head * iam_new_node(handle_t *h, struct iam_container *c, iam_ptr_t *b, int *e) { struct inode *inode = c->ic_object; @@ -2525,7 +2526,7 @@ static inline int ptr_inside(void *base, size_t size, void *ptr) return (base <= ptr) && (ptr < base + size); } -int iam_frame_invariant(struct iam_frame *f) +static int iam_frame_invariant(struct iam_frame *f) { return (f->bh != NULL && @@ -2534,7 +2535,8 @@ int iam_frame_invariant(struct iam_frame *f) ptr_inside(f->bh->b_data, f->bh->b_size, f->at) && f->entries <= f->at); } -int iam_leaf_invariant(struct iam_leaf *l) + +static int iam_leaf_invariant(struct iam_leaf *l) { return l->il_bh != NULL && @@ -2544,7 +2546,7 @@ int iam_leaf_invariant(struct iam_leaf *l) l->il_entries <= l->il_at; } -int iam_path_invariant(struct iam_path *p) +static int iam_path_invariant(struct iam_path *p) { int i; diff --git a/lustre/osd-ldiskfs/osd_iam_lfix.c b/lustre/osd-ldiskfs/osd_iam_lfix.c index 85a84ad..061ff31 100644 --- a/lustre/osd-ldiskfs/osd_iam_lfix.c +++ b/lustre/osd-ldiskfs/osd_iam_lfix.c @@ -206,7 +206,7 @@ static struct iam_lentry *iam_lfix_get_end(const struct iam_leaf *l) return ile; } -struct iam_rec *iam_lfix_rec(const struct iam_leaf *l) +static struct iam_rec *iam_lfix_rec(const struct iam_leaf *l) { void *e = l->il_at; assert_corr(iam_leaf_at_rec(l)); diff --git a/lustre/osd-ldiskfs/osd_iam_lvar.c b/lustre/osd-ldiskfs/osd_iam_lvar.c index 1464791..8a360dd 100644 --- a/lustre/osd-ldiskfs/osd_iam_lvar.c +++ b/lustre/osd-ldiskfs/osd_iam_lvar.c @@ -422,7 +422,7 @@ static void lvar_fini(struct iam_leaf *l) l->il_entries = l->il_at = NULL; } -struct iam_rec *lvar_rec(const struct iam_leaf *l) +static struct iam_rec *lvar_rec(const struct iam_leaf *l) { assert_corr(n_at_rec(l)); return e_rec(n_cur(l)); diff --git a/lustre/osd-ldiskfs/osd_internal.h b/lustre/osd-ldiskfs/osd_internal.h index 6d92a31..65ae8c4 100644 --- a/lustre/osd-ldiskfs/osd_internal.h +++ b/lustre/osd-ldiskfs/osd_internal.h @@ -70,6 +70,7 @@ #include "osd_quota_fmt.h" struct inode; +extern struct kmem_cache *dynlock_cachep; #define OSD_COUNTERS (0) diff --git a/lustre/osd-ldiskfs/osd_io.c b/lustre/osd-ldiskfs/osd_io.c index 8344d4a..75a0cb2 100644 --- a/lustre/osd-ldiskfs/osd_io.c +++ b/lustre/osd-ldiskfs/osd_io.c @@ -414,7 +414,7 @@ static int osd_map_remote_to_local(loff_t offset, ssize_t len, int *nrpages, RETURN(0); } -struct page *osd_get_page(struct dt_object *dt, loff_t offset, int rw) +static struct page *osd_get_page(struct dt_object *dt, loff_t offset, int rw) { struct inode *inode = osd_dt_obj(dt)->oo_inode; struct osd_device *d = osd_obj2dev(osd_dt_obj(dt)); @@ -448,9 +448,9 @@ struct page *osd_get_page(struct dt_object *dt, loff_t offset, int rw) * i_data_sem */ -int osd_bufs_get(const struct lu_env *env, struct dt_object *d, loff_t pos, - ssize_t len, struct niobuf_local *lnb, int rw, - struct lustre_capa *capa) +static int osd_bufs_get(const struct lu_env *env, struct dt_object *d, + loff_t pos, ssize_t len, struct niobuf_local *lnb, + int rw, struct lustre_capa *capa) { struct osd_object *obj = osd_dt_obj(d); int npages, i, rc = 0; @@ -731,9 +731,9 @@ map: return err; } -int osd_ldiskfs_map_nblocks(struct inode *inode, unsigned long block, - unsigned long num, unsigned long *blocks, - int create) +static int osd_ldiskfs_map_nblocks(struct inode *inode, unsigned long block, + unsigned long num, unsigned long *blocks, + int create) { struct bpointers bp; int err; @@ -753,9 +753,9 @@ int osd_ldiskfs_map_nblocks(struct inode *inode, unsigned long block, return err; } -int osd_ldiskfs_map_bm_inode_pages(struct inode *inode, struct page **page, - int pages, unsigned long *blocks, - int create) +static int osd_ldiskfs_map_bm_inode_pages(struct inode *inode, + struct page **page, int pages, + unsigned long *blocks, int create) { int blocks_per_page = PAGE_CACHE_SIZE >> inode->i_blkbits; unsigned long *b; @@ -773,9 +773,10 @@ int osd_ldiskfs_map_bm_inode_pages(struct inode *inode, struct page **page, return rc; } -int osd_ldiskfs_map_ext_inode_pages(struct inode *inode, struct page **page, - int pages, unsigned long *blocks, - int create) +static int osd_ldiskfs_map_ext_inode_pages(struct inode *inode, + struct page **page, + int pages, unsigned long *blocks, + int create) { int blocks_per_page = PAGE_CACHE_SIZE >> inode->i_blkbits; int rc = 0, i = 0; diff --git a/lustre/osd-ldiskfs/osd_lproc.c b/lustre/osd-ldiskfs/osd_lproc.c index c46ef96..674aad3 100644 --- a/lustre/osd-ldiskfs/osd_lproc.c +++ b/lustre/osd-ldiskfs/osd_lproc.c @@ -512,7 +512,7 @@ static int ldiskfs_osd_oi_scrub_seq_show(struct seq_file *m, void *data) } LPROC_SEQ_FOPS_RO(ldiskfs_osd_oi_scrub); -int ldiskfs_osd_readcache_seq_show(struct seq_file *m, void *data) +static int ldiskfs_osd_readcache_seq_show(struct seq_file *m, void *data) { struct osd_device *osd = osd_dt_dev((struct dt_device *)m->private); @@ -523,7 +523,7 @@ int ldiskfs_osd_readcache_seq_show(struct seq_file *m, void *data) return seq_printf(m, LPU64"\n", osd->od_readcache_max_filesize); } -ssize_t +static ssize_t ldiskfs_osd_readcache_seq_write(struct file *file, const char *buffer, size_t count, loff_t *off) { diff --git a/lustre/osd-ldiskfs/osd_quota.c b/lustre/osd-ldiskfs/osd_quota.c index 37e8d9b..82ea9fe 100644 --- a/lustre/osd-ldiskfs/osd_quota.c +++ b/lustre/osd-ldiskfs/osd_quota.c @@ -766,7 +766,7 @@ static int osd_it_admin_next(const struct lu_env *env, struct dt_it *di) RETURN(rc); } -const struct dt_index_operations osd_admin_index_ops = { +static const struct dt_index_operations osd_admin_index_ops = { .dio_lookup = osd_acct_index_lookup, .dio_it = { .init = osd_it_acct_init, diff --git a/lustre/osp/lwp_dev.c b/lustre/osp/lwp_dev.c index cb22b2f..f1dceb1 100644 --- a/lustre/osp/lwp_dev.c +++ b/lustre/osp/lwp_dev.c @@ -42,7 +42,8 @@ #include #include #include -#include + +#include "osp_internal.h" struct lwp_device { struct lu_device lpd_dev; @@ -220,7 +221,7 @@ static int lwp_process_config(const struct lu_env *env, RETURN(rc); } -const struct lu_device_operations lwp_lu_ops = { +static const struct lu_device_operations lwp_lu_ops = { .ldo_process_config = lwp_process_config, }; @@ -236,8 +237,8 @@ const struct lu_device_operations lwp_lu_ops = { * \retval -ENODEV if the device name cannot be found * \retval negative numbers on other errors */ -int lwp_init0(const struct lu_env *env, struct lwp_device *lwp, - struct lu_device_type *ldt, struct lustre_cfg *cfg) +static int lwp_init0(const struct lu_env *env, struct lwp_device *lwp, + struct lu_device_type *ldt, struct lustre_cfg *cfg) { int rc; ENTRY; diff --git a/lustre/osp/osp_dev.c b/lustre/osp/osp_dev.c index 00e5da0..ad260f2 100644 --- a/lustre/osp/osp_dev.c +++ b/lustre/osp/osp_dev.c @@ -111,9 +111,9 @@ static struct lu_kmem_descr osp_caches[] = { * \retval object object being created if the creation succeed. * \retval NULL NULL if the creation failed. */ -struct lu_object *osp_object_alloc(const struct lu_env *env, - const struct lu_object_header *hdr, - struct lu_device *d) +static struct lu_object *osp_object_alloc(const struct lu_env *env, + const struct lu_object_header *hdr, + struct lu_device *d) { struct lu_object_header *h = NULL; struct osp_object *o; @@ -1651,8 +1651,8 @@ static int osp_obd_get_info(const struct lu_env *env, struct obd_export *exp, * requested from seq meta server * \retval negative negative errno if FID allocation failed. */ -int osp_fid_alloc(const struct lu_env *env, struct obd_export *exp, - struct lu_fid *fid, struct md_op_data *unused) +static int osp_fid_alloc(const struct lu_env *env, struct obd_export *exp, + struct lu_fid *fid, struct md_op_data *unused) { struct client_obd *cli = &exp->exp_obd->u.cli; struct osp_device *osp = lu2osp_dev(exp->exp_obd->obd_lu_dev); diff --git a/lustre/osp/osp_md_object.c b/lustre/osp/osp_md_object.c index b8d2da9..68eb678 100644 --- a/lustre/osp/osp_md_object.c +++ b/lustre/osp/osp_md_object.c @@ -752,7 +752,7 @@ static int osp_md_index_delete(const struct lu_env *env, * \retval 1 if it reaches to the end of the index object. * \retval negative errno if the pointer cannot be advanced. */ -int osp_md_index_it_next(const struct lu_env *env, struct dt_it *di) +static int osp_md_index_it_next(const struct lu_env *env, struct dt_it *di) { struct osp_it *it = (struct osp_it *)di; struct lu_idxpage *idxpage; diff --git a/lustre/osp/osp_object.c b/lustre/osp/osp_object.c index 198b8d9..f8aa9af 100644 --- a/lustre/osp/osp_object.c +++ b/lustre/osp/osp_object.c @@ -1975,7 +1975,7 @@ again0: * \retval 0 for success * \retval negative error number on failure */ -int osp_orphan_it_next(const struct lu_env *env, struct dt_it *di) +static int osp_orphan_it_next(const struct lu_env *env, struct dt_it *di) { struct osp_it *it = (struct osp_it *)di; struct lu_idxpage *idxpage; @@ -2016,8 +2016,8 @@ void osp_it_put(const struct lu_env *env, struct dt_it *di) { } -struct dt_key *osp_orphan_it_key(const struct lu_env *env, - const struct dt_it *di) +static struct dt_key *osp_orphan_it_key(const struct lu_env *env, + const struct dt_it *di) { struct osp_it *it = (struct osp_it *)di; struct lu_orphan_ent *ent = (struct lu_orphan_ent *)it->ooi_ent; @@ -2028,13 +2028,14 @@ struct dt_key *osp_orphan_it_key(const struct lu_env *env, return NULL; } -int osp_orphan_it_key_size(const struct lu_env *env, const struct dt_it *di) +static int osp_orphan_it_key_size(const struct lu_env *env, + const struct dt_it *di) { return sizeof(struct lu_fid); } -int osp_orphan_it_rec(const struct lu_env *env, const struct dt_it *di, - struct dt_rec *rec, __u32 attr) +static int osp_orphan_it_rec(const struct lu_env *env, const struct dt_it *di, + struct dt_rec *rec, __u32 attr) { struct osp_it *it = (struct osp_it *)di; struct lu_orphan_ent *ent = (struct lu_orphan_ent *)it->ooi_ent; @@ -2138,7 +2139,7 @@ static int osp_index_try(const struct lu_env *env, return 0; } -struct dt_object_operations osp_obj_ops = { +static struct dt_object_operations osp_obj_ops = { .do_declare_attr_get = osp_declare_attr_get, .do_attr_get = osp_attr_get, .do_declare_attr_set = osp_declare_attr_set, diff --git a/lustre/osp/osp_precreate.c b/lustre/osp/osp_precreate.c index e42a7f0..18a9d07 100644 --- a/lustre/osp/osp_precreate.c +++ b/lustre/osp/osp_precreate.c @@ -422,7 +422,8 @@ out: * \retval 0 on success * \retval negative negated errno on error */ -int osp_precreate_rollover_new_seq(struct lu_env *env, struct osp_device *osp) +static int osp_precreate_rollover_new_seq(struct lu_env *env, + struct osp_device *osp) { struct lu_fid *fid = &osp_env_info(env)->osi_fid; struct lu_fid *last_fid = &osp->opd_last_used_fid; diff --git a/lustre/osp/osp_sync.c b/lustre/osp/osp_sync.c index 6737bc4..2d29229 100644 --- a/lustre/osp/osp_sync.c +++ b/lustre/osp/osp_sync.c @@ -375,7 +375,7 @@ int osp_sync_add(const struct lu_env *env, struct osp_object *o, } int osp_sync_gap(const struct lu_env *env, struct osp_device *d, - struct lu_fid *fid, int lost, struct thandle *th) + struct lu_fid *fid, int lost, struct thandle *th) { return osp_sync_add_rec(env, d, fid, MDS_UNLINK64_REC, lost, th, NULL); }