From: Frank Zago Date: Tue, 23 Dec 2014 02:25:54 +0000 (-0500) Subject: LU-5396 lod: (and mdt, mgs) make some symbols static X-Git-Tag: 2.6.93~61 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=ad1810a2dbea1eed5e8b5feb55bdf915a545feb3 LU-5396 lod: (and mdt, mgs) make some symbols 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: I48d5e51f6f7de030f332bc99b3be3a06ed5b10e1 Reviewed-on: http://review.whamcloud.com/12223 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Dmitry Eremin Reviewed-by: Bob Glossman Reviewed-by: James Simmons Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin --- diff --git a/lustre/lod/lod_dev.c b/lustre/lod/lod_dev.c index b2accf3..3cb71719 100644 --- a/lustre/lod/lod_dev.c +++ b/lustre/lod/lod_dev.c @@ -156,9 +156,6 @@ int lod_fld_lookup(const struct lu_env *env, struct lod_device *lod, RETURN(0); } -extern struct lu_object_operations lod_lu_obj_ops; -extern struct dt_object_operations lod_obj_ops; - /* Slab for OSD object allocation */ struct kmem_cache *lod_object_kmem; @@ -183,9 +180,9 @@ static struct lu_device *lod_device_fini(const struct lu_env *env, * * see include/lu_object.h for the details. */ -struct lu_object *lod_object_alloc(const struct lu_env *env, - const struct lu_object_header *hdr, - struct lu_device *dev) +static struct lu_object *lod_object_alloc(const struct lu_env *env, + const struct lu_object_header *hdr, + struct lu_device *dev) { struct lod_object *lod_obj; struct lu_object *lu_obj; diff --git a/lustre/lod/lod_internal.h b/lustre/lod/lod_internal.h index 8e1cbec..48bd2d4 100644 --- a/lustre/lod/lod_internal.h +++ b/lustre/lod/lod_internal.h @@ -386,6 +386,7 @@ lod_name_get(const struct lu_env *env, const void *area, int len) cfs_foreach_bit((__dev)->lod_ost_bitmap, (index)) /* lod_dev.c */ +extern struct kmem_cache *lod_object_kmem; int lod_fld_lookup(const struct lu_env *env, struct lod_device *lod, const struct lu_fid *fid, __u32 *tgt, int *flags); /* lod_lov.c */ @@ -467,6 +468,8 @@ int lod_procfs_init(struct lod_device *lod); void lod_procfs_fini(struct lod_device *lod); /* lod_object.c */ +extern struct dt_object_operations lod_obj_ops; +extern struct lu_object_operations lod_lu_obj_ops; int lod_load_lmv_shards(const struct lu_env *env, struct lod_object *lo, struct lu_buf *buf, bool resize); int lod_object_set_pool(struct lod_object *o, char *pool); diff --git a/lustre/lod/lod_object.c b/lustre/lod/lod_object.c index f4e1fba..450e7f7 100644 --- a/lustre/lod/lod_object.c +++ b/lustre/lod/lod_object.c @@ -58,7 +58,6 @@ static const char dot[] = "."; static const char dotdot[] = ".."; -extern struct kmem_cache *lod_object_kmem; static const struct dt_body_operations lod_body_lnk_ops; /** @@ -188,7 +187,7 @@ do { \ * * \see dt_index_operations::dio_it.fini() in the API description for details. */ -void lod_it_fini(const struct lu_env *env, struct dt_it *di) +static void lod_it_fini(const struct lu_env *env, struct dt_it *di) { struct lod_it *it = (struct lod_it *)di; @@ -207,8 +206,8 @@ void lod_it_fini(const struct lu_env *env, struct dt_it *di) * * \see dt_it_ops::get() in the API description for details. */ -int lod_it_get(const struct lu_env *env, struct dt_it *di, - const struct dt_key *key) +static int lod_it_get(const struct lu_env *env, struct dt_it *di, + const struct dt_key *key) { const struct lod_it *it = (const struct lod_it *)di; @@ -223,7 +222,7 @@ int lod_it_get(const struct lu_env *env, struct dt_it *di, * * \see dt_it_ops::put() in the API description for details. */ -void lod_it_put(const struct lu_env *env, struct dt_it *di) +static void lod_it_put(const struct lu_env *env, struct dt_it *di) { struct lod_it *it = (struct lod_it *)di; @@ -238,7 +237,7 @@ void lod_it_put(const struct lu_env *env, struct dt_it *di) * * \see dt_it_ops::next() in the API description for details. */ -int lod_it_next(const struct lu_env *env, struct dt_it *di) +static int lod_it_next(const struct lu_env *env, struct dt_it *di) { struct lod_it *it = (struct lod_it *)di; @@ -253,7 +252,8 @@ int lod_it_next(const struct lu_env *env, struct dt_it *di) * * \see dt_it_ops::key() in the API description for details. */ -struct dt_key *lod_it_key(const struct lu_env *env, const struct dt_it *di) +static struct dt_key *lod_it_key(const struct lu_env *env, + const struct dt_it *di) { const struct lod_it *it = (const struct lod_it *)di; @@ -268,7 +268,7 @@ struct dt_key *lod_it_key(const struct lu_env *env, const struct dt_it *di) * * \see dt_it_ops::key_size() in the API description for details. */ -int lod_it_key_size(const struct lu_env *env, const struct dt_it *di) +static int lod_it_key_size(const struct lu_env *env, const struct dt_it *di) { struct lod_it *it = (struct lod_it *)di; @@ -283,8 +283,8 @@ int lod_it_key_size(const struct lu_env *env, const struct dt_it *di) * * \see dt_it_ops::rec() in the API description for details. */ -int lod_it_rec(const struct lu_env *env, const struct dt_it *di, - struct dt_rec *rec, __u32 attr) +static int lod_it_rec(const struct lu_env *env, const struct dt_it *di, + struct dt_rec *rec, __u32 attr) { const struct lod_it *it = (const struct lod_it *)di; @@ -300,8 +300,8 @@ int lod_it_rec(const struct lu_env *env, const struct dt_it *di, * * \see dt_it_ops::rec_size() in the API description for details. */ -int lod_it_rec_size(const struct lu_env *env, const struct dt_it *di, - __u32 attr) +static int lod_it_rec_size(const struct lu_env *env, const struct dt_it *di, + __u32 attr) { const struct lod_it *it = (const struct lod_it *)di; @@ -317,7 +317,7 @@ int lod_it_rec_size(const struct lu_env *env, const struct dt_it *di, * * \see dt_it_ops::store() in the API description for details. */ -__u64 lod_it_store(const struct lu_env *env, const struct dt_it *di) +static __u64 lod_it_store(const struct lu_env *env, const struct dt_it *di) { const struct lod_it *it = (const struct lod_it *)di; @@ -332,7 +332,8 @@ __u64 lod_it_store(const struct lu_env *env, const struct dt_it *di) * * \see dt_it_ops::load() in the API description for details. */ -int lod_it_load(const struct lu_env *env, const struct dt_it *di, __u64 hash) +static int lod_it_load(const struct lu_env *env, const struct dt_it *di, + __u64 hash) { const struct lod_it *it = (const struct lod_it *)di; @@ -347,8 +348,8 @@ int lod_it_load(const struct lu_env *env, const struct dt_it *di, __u64 hash) * * \see dt_it_ops::rec() in the API description for details. */ -int lod_it_key_rec(const struct lu_env *env, const struct dt_it *di, - void *key_rec) +static int lod_it_key_rec(const struct lu_env *env, const struct dt_it *di, + void *key_rec) { const struct lod_it *it = (const struct lod_it *)di; @@ -1490,8 +1491,8 @@ static void lod_prep_slave_lmv_md(struct lmv_mds_md_v1 *slave_lmv, * \retval 0 on success * \retval negative if failed */ -int lod_prep_lmv_md(const struct lu_env *env, struct dt_object *dt, - struct lu_buf *lmv_buf) +static int lod_prep_lmv_md(const struct lu_env *env, struct dt_object *dt, + struct lu_buf *lmv_buf) { struct lod_thread_info *info = lod_env_info(env); struct lod_device *lod = lu2lod_dev(dt->do_lu.lo_dev); @@ -2578,12 +2579,12 @@ out: * \retval 0 on success * \retval negative if failed */ -int lod_dir_striping_create_internal(const struct lu_env *env, - struct dt_object *dt, - struct lu_attr *attr, - struct dt_object_format *dof, - struct thandle *th, - bool declare) +static int lod_dir_striping_create_internal(const struct lu_env *env, + struct dt_object *dt, + struct lu_attr *attr, + struct dt_object_format *dof, + struct thandle *th, + bool declare) { struct lod_thread_info *info = lod_env_info(env); struct lod_object *lo = lod_dt_obj(dt); diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index d8c56b2..5118c44 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -547,7 +547,8 @@ void mdt_client_compatibility(struct mdt_thread_info *info) EXIT; } -int mdt_attr_get_eabuf_size(struct mdt_thread_info *info, struct mdt_object *o) +static int mdt_attr_get_eabuf_size(struct mdt_thread_info *info, + struct mdt_object *o) { const struct lu_env *env = info->mti_env; int rc, rc2; @@ -4240,7 +4241,7 @@ static void mdt_quota_fini(const struct lu_env *env, struct mdt_device *mdt) /* mdt_getxattr() is used from mdt_intent_getxattr(), use this wrapper * for now. This will be removed along with converting rest of MDT code * to use tgt_session_info */ -int mdt_tgt_getxattr(struct tgt_session_info *tsi) +static int mdt_tgt_getxattr(struct tgt_session_info *tsi) { struct mdt_thread_info *info = tsi2mdt_info(tsi); int rc; diff --git a/lustre/mdt/mdt_internal.h b/lustre/mdt/mdt_internal.h index f14960f..ea2f66d 100644 --- a/lustre/mdt/mdt_internal.h +++ b/lustre/mdt/mdt_internal.h @@ -835,6 +835,9 @@ __u32 mdt_identity_get_perm(struct md_identity *, __u32, lnet_nid_t); int mdt_pack_remote_perm(struct mdt_thread_info *, struct mdt_object *, void *); +/* mdt/mdt_recovery.c */ +void mdt_req_from_lcd(struct ptlrpc_request *req, struct lsd_client_data *lcd); + /* mdt/mdt_hsm.c */ int mdt_hsm_state_get(struct tgt_session_info *tsi); int mdt_hsm_state_set(struct tgt_session_info *tsi); diff --git a/lustre/mdt/mdt_lproc.c b/lustre/mdt/mdt_lproc.c index c143882..c7295cb 100644 --- a/lustre/mdt/mdt_lproc.c +++ b/lustre/mdt/mdt_lproc.c @@ -881,8 +881,8 @@ static struct lprocfs_seq_vars lprocfs_mdt_obd_vars[] = { { 0 } }; -int lprocfs_mdt_print_open_files(cfs_hash_t *hs, cfs_hash_bd_t *bd, - struct hlist_node *hnode, void *v) +static int lprocfs_mdt_print_open_files(cfs_hash_t *hs, cfs_hash_bd_t *bd, + struct hlist_node *hnode, void *v) { struct obd_export *exp = cfs_hash_object(hs, hnode); struct seq_file *seq = v; @@ -902,7 +902,7 @@ int lprocfs_mdt_print_open_files(cfs_hash_t *hs, cfs_hash_bd_t *bd, return 0; } -int lprocfs_mdt_open_files_seq_show(struct seq_file *seq, void *v) +static int lprocfs_mdt_open_files_seq_show(struct seq_file *seq, void *v) { struct nid_stat *stats = seq->private; struct obd_device *obd = stats->nid_obd; diff --git a/lustre/mdt/mdt_open.c b/lustre/mdt/mdt_open.c index b2b077b..c779056 100644 --- a/lustre/mdt/mdt_open.c +++ b/lustre/mdt/mdt_open.c @@ -470,7 +470,7 @@ static int mdt_ioepoch_close(struct mdt_thread_info *info, struct mdt_object *o) * Apply obtained attributes for the 1st case, wipe out the on-disk SOM * cache otherwise. */ -int mdt_som_au_close(struct mdt_thread_info *info, struct mdt_object *o) +static int mdt_som_au_close(struct mdt_thread_info *info, struct mdt_object *o) { struct ptlrpc_request *req = mdt_info_req(info); __u64 ioepoch = 0; @@ -663,9 +663,9 @@ void mdt_mfd_set_mode(struct mdt_file_data *mfd, __u64 mode) /** * prep ma_lmm/ma_lmv for md_attr from reply */ -void mdt_prep_ma_buf_from_rep(struct mdt_thread_info *info, - struct mdt_object *obj, - struct md_attr *ma) +static void mdt_prep_ma_buf_from_rep(struct mdt_thread_info *info, + struct mdt_object *obj, + struct md_attr *ma) { LASSERT(ma->ma_lmv == NULL && ma->ma_lmm == NULL); if (S_ISDIR(obj->mot_header.loh_attr)) { @@ -852,9 +852,9 @@ err_out: return rc; } -int mdt_finish_open(struct mdt_thread_info *info, - struct mdt_object *p, struct mdt_object *o, - __u64 flags, int created, struct ldlm_reply *rep) +static int mdt_finish_open(struct mdt_thread_info *info, + struct mdt_object *p, struct mdt_object *o, + __u64 flags, int created, struct ldlm_reply *rep) { struct ptlrpc_request *req = mdt_info_req(info); struct obd_export *exp = req->rq_export; @@ -1001,9 +1001,6 @@ int mdt_finish_open(struct mdt_thread_info *info, RETURN(rc); } -extern void mdt_req_from_lcd(struct ptlrpc_request *req, - struct lsd_client_data *lcd); - void mdt_reconstruct_open(struct mdt_thread_info *info, struct mdt_lock_handle *lhc) { @@ -1117,7 +1114,7 @@ out: LASSERT(ergo(rc < 0, lustre_msg_get_transno(req->rq_repmsg) == 0)); } -int mdt_open_by_fid(struct mdt_thread_info *info, struct ldlm_reply *rep) +static int mdt_open_by_fid(struct mdt_thread_info *info, struct ldlm_reply *rep) { __u64 flags = info->mti_spec.sp_cr_flags; struct mdt_reint_record *rr = &info->mti_rr; @@ -1405,8 +1402,9 @@ static bool mdt_hsm_release_allow(const struct md_attr *ma) return true; } -int mdt_open_by_fid_lock(struct mdt_thread_info *info, struct ldlm_reply *rep, - struct mdt_lock_handle *lhc) +static int mdt_open_by_fid_lock(struct mdt_thread_info *info, + struct ldlm_reply *rep, + struct mdt_lock_handle *lhc) { const struct lu_env *env = info->mti_env; struct mdt_device *mdt = info->mti_mdt; diff --git a/lustre/mdt/mdt_recovery.c b/lustre/mdt/mdt_recovery.c index 0381a26..b06022b 100644 --- a/lustre/mdt/mdt_recovery.c +++ b/lustre/mdt/mdt_recovery.c @@ -72,7 +72,7 @@ const struct lu_buf *mdt_buf_const(const struct lu_env *env, } void mdt_trans_stop(const struct lu_env *env, - struct mdt_device *mdt, struct thandle *th) + struct mdt_device *mdt, struct thandle *th) { dt_trans_stop(env, mdt->mdt_bottom, th); } @@ -189,8 +189,8 @@ static void mdt_steal_ack_locks(struct ptlrpc_request *req) /** * VBR: restore versions */ -void mdt_vbr_reconstruct(struct ptlrpc_request *req, - struct lsd_client_data *lcd) +static void mdt_vbr_reconstruct(struct ptlrpc_request *req, + struct lsd_client_data *lcd) { __u64 pre_versions[4] = {0}; pre_versions[0] = lcd->lcd_pre_versions[0]; @@ -200,8 +200,7 @@ void mdt_vbr_reconstruct(struct ptlrpc_request *req, lustre_msg_set_versions(req->rq_repmsg, pre_versions); } -void mdt_req_from_lcd(struct ptlrpc_request *req, - struct lsd_client_data *lcd) +void mdt_req_from_lcd(struct ptlrpc_request *req, struct lsd_client_data *lcd) { DEBUG_REQ(D_HA, req, "restoring transno "LPD64"/status %d", lcd->lcd_last_transno, lcd->lcd_last_result); diff --git a/lustre/mdt/mdt_reint.c b/lustre/mdt/mdt_reint.c index ef6ef70..62538bc 100644 --- a/lustre/mdt/mdt_reint.c +++ b/lustre/mdt/mdt_reint.c @@ -220,9 +220,10 @@ int mdt_version_get_check_save(struct mdt_thread_info *info, * This checks version of 'name'. Many reint functions uses 'name' for child not * FID, therefore we need to get object by name and check its version. */ -int mdt_lookup_version_check(struct mdt_thread_info *info, - struct mdt_object *p, const struct lu_name *lname, - struct lu_fid *fid, int idx) +static int mdt_lookup_version_check(struct mdt_thread_info *info, + struct mdt_object *p, + const struct lu_name *lname, + struct lu_fid *fid, int idx) { int rc, vbrc; diff --git a/lustre/mgs/lproc_mgs.c b/lustre/mgs/lproc_mgs.c index 0bde3e8..2d86d35 100644 --- a/lustre/mgs/lproc_mgs.c +++ b/lustre/mgs/lproc_mgs.c @@ -207,7 +207,7 @@ LPROC_SEQ_FOPS_RO_TYPE(mgs, hash); LPROC_SEQ_FOPS_WO_TYPE(mgs, evict_client); LPROC_SEQ_FOPS_RW_TYPE(mgs, ir_timeout); -struct lprocfs_seq_vars lprocfs_mgs_obd_vars[] = { +static struct lprocfs_seq_vars lprocfs_mgs_obd_vars[] = { { .name = "uuid", .fops = &mgs_uuid_fops }, { .name = "num_exports", diff --git a/lustre/mgs/mgs_fs.c b/lustre/mgs/mgs_fs.c index 532aaa6..0ffa587 100644 --- a/lustre/mgs/mgs_fs.c +++ b/lustre/mgs/mgs_fs.c @@ -102,7 +102,7 @@ out: * crash all connections are treated as new connections. */ int mgs_client_add(struct obd_device *obd, struct obd_export *exp, - void *localdata) + void *localdata) { return 0; } diff --git a/lustre/mgs/mgs_handler.c b/lustre/mgs/mgs_handler.c index 7646c59..168ed8e 100644 --- a/lustre/mgs/mgs_handler.c +++ b/lustre/mgs/mgs_handler.c @@ -841,8 +841,8 @@ out_pool: } /* from mdt_iocontrol */ -int mgs_iocontrol(unsigned int cmd, struct obd_export *exp, int len, - void *karg, void *uarg) +static int mgs_iocontrol(unsigned int cmd, struct obd_export *exp, int len, + void *karg, void *uarg) { struct mgs_device *mgs = exp2mgs_dev(exp); struct obd_ioctl_data *data = karg; @@ -1302,15 +1302,15 @@ static int mgs_object_print(const struct lu_env *env, void *cookie, return (*p)(env, cookie, LUSTRE_MGS_NAME"-object@%p", o); } -struct lu_object_operations mgs_lu_obj_ops = { +static struct lu_object_operations mgs_lu_obj_ops = { .loo_object_init = mgs_object_init, .loo_object_free = mgs_object_free, .loo_object_print = mgs_object_print, }; -struct lu_object *mgs_object_alloc(const struct lu_env *env, - const struct lu_object_header *hdr, - struct lu_device *d) +static struct lu_object *mgs_object_alloc(const struct lu_env *env, + const struct lu_object_header *hdr, + struct lu_device *d) { struct lu_object_header *h; struct mgs_object *o; diff --git a/lustre/mgs/mgs_llog.c b/lustre/mgs/mgs_llog.c index 302749e..85a42a9 100644 --- a/lustre/mgs/mgs_llog.c +++ b/lustre/mgs/mgs_llog.c @@ -1442,10 +1442,12 @@ out_end: } /* write the lcfg in all logs for the given fs */ -int mgs_write_log_direct_all(const struct lu_env *env, struct mgs_device *mgs, - struct fs_db *fsdb, struct mgs_target_info *mti, - struct llog_cfg_rec *lcr, char *devname, - char *comment, int server_only) +static int mgs_write_log_direct_all(const struct lu_env *env, + struct mgs_device *mgs, + struct fs_db *fsdb, + struct mgs_target_info *mti, + struct llog_cfg_rec *lcr, char *devname, + char *comment, int server_only) { struct list_head log_list; struct mgs_direntry *dirent, *n;