Whamcloud - gitweb
LU-8191 lustre: convert lmv,lod,lov functions to static 79/51479/7
authorTimothy Day <timday@amazon.com>
Fri, 23 Jun 2023 20:53:00 +0000 (20:53 +0000)
committerOleg Drokin <green@whamcloud.com>
Wed, 29 Nov 2023 21:27:04 +0000 (21:27 +0000)
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 <timday@amazon.com>
Change-Id: If409226ea201587c7f95d4a65ffaef72671b5ac2
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51479
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Patrick Farrell <pfarrell@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/lmv/lmv_obd.c
lustre/lod/lod_lov.c
lustre/lod/lod_object.c
lustre/lod/lod_qos.c
lustre/lov/lov_cl_internal.h
lustre/lov/lov_ea.c
lustre/lov/lov_io.c
lustre/lov/lov_obd.c

index 1147316..b043a22 100644 (file)
@@ -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;
index 3787656..4256191 100644 (file)
@@ -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;
index 203b5a4..7491099 100644 (file)
@@ -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);
index 51f5b63..8c9a468 100644 (file)
@@ -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];
index 0346ab2..7a85ed7 100644 (file)
@@ -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)                    \
index 485a540..c268197 100644 (file)
@@ -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
index 9a9a66d..a4cab2c 100644 (file)
@@ -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;
index 8ef710d..c3b10a0 100644 (file)
@@ -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;