From 78605b74a56a5338aa93bbf394fe35d0f7c17c5b Mon Sep 17 00:00:00 2001 From: Timothy Day Date: Fri, 23 Jun 2023 20:53:00 +0000 Subject: [PATCH] LU-8191 lustre: convert lmv,lod,lov functions to static Static analysis shows that a number of functions could be made static. This patch declares several functions in lmv, lod, and lov static. Also, remove one unused function: lov_lsm_entry() Another function is intentionally unused for debugging purposes. It was detected by static analysis, but it has been left untouched. Test-Parameters: trivial Signed-off-by: Timothy Day Change-Id: If409226ea201587c7f95d4a65ffaef72671b5ac2 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51479 Tested-by: jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Patrick Farrell Reviewed-by: Oleg Drokin --- lustre/lmv/lmv_obd.c | 16 ++++++++-------- lustre/lod/lod_lov.c | 13 +++++++------ lustre/lod/lod_object.c | 4 ++-- lustre/lod/lod_qos.c | 8 +++++--- lustre/lov/lov_cl_internal.h | 5 ----- lustre/lov/lov_ea.c | 17 ----------------- lustre/lov/lov_io.c | 5 +++-- lustre/lov/lov_obd.c | 4 ++-- 8 files changed, 27 insertions(+), 45 deletions(-) diff --git a/lustre/lmv/lmv_obd.c b/lustre/lmv/lmv_obd.c index 1147316..b043a22 100644 --- a/lustre/lmv/lmv_obd.c +++ b/lustre/lmv/lmv_obd.c @@ -1997,10 +1997,10 @@ static struct lu_tgt_desc *lmv_locate_tgt_by_space(struct lmv_obd *lmv, return tgt; } -int lmv_create(struct obd_export *exp, struct md_op_data *op_data, - const void *data, size_t datalen, umode_t mode, uid_t uid, - gid_t gid, kernel_cap_t cap_effective, __u64 rdev, - struct ptlrpc_request **request) +static int lmv_create(struct obd_export *exp, struct md_op_data *op_data, + const void *data, size_t datalen, umode_t mode, uid_t uid, + gid_t gid, kernel_cap_t cap_effective, __u64 rdev, + struct ptlrpc_request **request) { struct obd_device *obd = exp->exp_obd; struct lmv_obd *lmv = &obd->u.lmv; @@ -4157,8 +4157,8 @@ lmv_batch_locate_tgt(struct lmv_obd *lmv, struct md_op_item *item) return tgt; } -struct lu_batch *lmv_batch_lookup_sub(struct lmv_batch *lbh, - struct lmv_tgt_desc *tgt) +static struct lu_batch *lmv_batch_lookup_sub(struct lmv_batch *lbh, + struct lmv_tgt_desc *tgt) { struct lmvsub_batch *sub; @@ -4170,8 +4170,8 @@ struct lu_batch *lmv_batch_lookup_sub(struct lmv_batch *lbh, return NULL; } -struct lu_batch *lmv_batch_get_sub(struct lmv_batch *lbh, - struct lmv_tgt_desc *tgt) +static struct lu_batch *lmv_batch_get_sub(struct lmv_batch *lbh, + struct lmv_tgt_desc *tgt) { struct lmvsub_batch *sbh; struct lu_batch *child_bh; diff --git a/lustre/lod/lod_lov.c b/lustre/lod/lod_lov.c index 3787656..4256191 100644 --- a/lustre/lod/lod_lov.c +++ b/lustre/lod/lod_lov.c @@ -1860,8 +1860,8 @@ struct lov_comp_md_entry_v1 *comp_entry_v1(struct lov_comp_md_v1 *comp, int i) le16_to_cpu(comp->lcm_entry_count) - 1); \ entry++) -int lod_erase_dom_stripe(struct lov_comp_md_v1 *comp_v1, - struct lov_comp_md_entry_v1 *dom_ent) +static int lod_erase_dom_stripe(struct lov_comp_md_v1 *comp_v1, + struct lov_comp_md_entry_v1 *dom_ent) { struct lov_comp_md_entry_v1 *ent; __u16 entries; @@ -1985,10 +1985,11 @@ out: return d->lod_dom_stripesize_cur_kb << 10; } -int lod_dom_stripesize_choose(const struct lu_env *env, struct lod_device *d, - struct lov_comp_md_v1 *comp_v1, - struct lov_comp_md_entry_v1 *dom_ent, - __u32 stripe_size) +static int lod_dom_stripesize_choose(const struct lu_env *env, + struct lod_device *d, + struct lov_comp_md_v1 *comp_v1, + struct lov_comp_md_entry_v1 *dom_ent, + __u32 stripe_size) { struct lov_comp_md_entry_v1 *ent; struct lu_extent *dom_ext, *ext; diff --git a/lustre/lod/lod_object.c b/lustre/lod/lod_object.c index 203b5a4..7491099 100644 --- a/lustre/lod/lod_object.c +++ b/lustre/lod/lod_object.c @@ -2296,7 +2296,7 @@ void lod_free_foreign_lov(struct lod_object *lo) * \retval 0 on success * \retval negative if failed */ -int lod_alloc_foreign_lmv(struct lod_object *lo, size_t size) +static int lod_alloc_foreign_lmv(struct lod_object *lo, size_t size) { OBD_ALLOC_LARGE(lo->ldo_foreign_lmv, size); if (lo->ldo_foreign_lmv == NULL) @@ -2337,7 +2337,7 @@ static int lod_prep_md_replayed_create(const struct lu_env *env, * * \param[in] lo object */ -void lod_free_foreign_lmv(struct lod_object *lo) +static void lod_free_foreign_lmv(struct lod_object *lo) { if (lo->ldo_foreign_lmv != NULL) OBD_FREE_LARGE(lo->ldo_foreign_lmv, lo->ldo_foreign_lmv_size); diff --git a/lustre/lod/lod_qos.c b/lustre/lod/lod_qos.c index 51f5b63..8c9a468 100644 --- a/lustre/lod/lod_qos.c +++ b/lustre/lod/lod_qos.c @@ -2557,7 +2557,8 @@ free_comp: /** * prepare enough OST avoidance bitmap space */ -int lod_prepare_avoidance(const struct lu_env *env, struct lod_object *lo) +static int lod_prepare_avoidance(const struct lu_env *env, + struct lod_object *lo) { struct lod_device *lod = lu2lod_dev(lo->ldo_obj.do_lu.lo_dev); struct lod_avoid_guide *lag = &lod_env_info(env)->lti_avoid; @@ -2622,8 +2623,9 @@ int lod_prepare_avoidance(const struct lu_env *env, struct lod_object *lo) * Collect information of used OSTs and OSSs in the overlapped components * of other mirrors */ -void lod_collect_avoidance(struct lod_object *lo, struct lod_avoid_guide *lag, - int comp_idx) +static void lod_collect_avoidance(struct lod_object *lo, + struct lod_avoid_guide *lag, + int comp_idx) { struct lod_device *lod = lu2lod_dev(lo->ldo_obj.do_lu.lo_dev); struct lod_layout_component *lod_comp = &lo->ldo_comp_entries[comp_idx]; diff --git a/lustre/lov/lov_cl_internal.h b/lustre/lov/lov_cl_internal.h index 0346ab2..7a85ed7 100644 --- a/lustre/lov/lov_cl_internal.h +++ b/lustre/lov/lov_cl_internal.h @@ -308,10 +308,6 @@ struct lov_object { * Preferred mirror is initialized by the preferred * bit of lsme. It can be changed when the preferred * is inaccessible. - * In order to make lov_lsm_entry() return the same - * mirror in the same IO context, it's only possible - * to change the preferred mirror when the - * lo_active_ios reaches zero. */ int lo_preferred_mirror; /** @@ -640,7 +636,6 @@ struct lu_object *lovsub_object_alloc(const struct lu_env *env, const struct lu_object_header *hdr, struct lu_device *dev); -int lov_lsm_entry(const struct lov_stripe_md *lsm, __u64 offset); int lov_io_layout_at(struct lov_io *lio, __u64 offset); #define lov_foreach_target(lov, var) \ diff --git a/lustre/lov/lov_ea.c b/lustre/lov/lov_ea.c index 485a540..c268197 100644 --- a/lustre/lov/lov_ea.c +++ b/lustre/lov/lov_ea.c @@ -705,23 +705,6 @@ void dump_lsm(unsigned int level, const struct lov_stripe_md *lsm) } } -int lov_lsm_entry(const struct lov_stripe_md *lsm, __u64 offset) -{ - int i; - - for (i = 0; i < lsm->lsm_entry_count; i++) { - struct lov_stripe_md_entry *lse = lsm->lsm_entries[i]; - - if ((offset >= lse->lsme_extent.e_start && - offset < lse->lsme_extent.e_end) || - (offset == OBD_OBJECT_EOF && - lse->lsme_extent.e_end == OBD_OBJECT_EOF)) - return i; - } - - return -1; -} - /** * lmm_layout_gen overlaps stripe_offset field, it needs to be reset back when * sending to MDT for passing striping checks diff --git a/lustre/lov/lov_io.c b/lustre/lov/lov_io.c index 9a9a66d..a4cab2c 100644 --- a/lustre/lov/lov_io.c +++ b/lustre/lov/lov_io.c @@ -1258,8 +1258,9 @@ static int lov_io_read_ahead(const struct lu_env *env, RETURN(0); } -int lov_io_lru_reserve(const struct lu_env *env, - const struct cl_io_slice *ios, loff_t pos, size_t bytes) +static int lov_io_lru_reserve(const struct lu_env *env, + const struct cl_io_slice *ios, loff_t pos, + size_t bytes) { struct lov_io *lio = cl2lov_io(env, ios); struct lov_stripe_md *lsm = lio->lis_object->lo_lsm; diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c index 8ef710d..c3b10a0 100644 --- a/lustre/lov/lov_obd.c +++ b/lustre/lov/lov_obd.c @@ -110,8 +110,8 @@ void lov_tgts_putref(struct obd_device *obd) static int lov_notify(struct obd_device *obd, struct obd_device *watched, enum obd_notify_event ev); -int lov_connect_osc(struct obd_device *obd, u32 index, int activate, - struct obd_connect_data *data) +static int lov_connect_osc(struct obd_device *obd, u32 index, int activate, + struct obd_connect_data *data) { struct lov_obd *lov = &obd->u.lov; struct obd_uuid *tgt_uuid; -- 1.8.3.1