Whamcloud - gitweb
LU-8191 lustre: convert mdc,mdd,mdt,mgc functions to static 78/51478/2
authorTimothy Day <timday@amazon.com>
Fri, 23 Jun 2023 20:52:17 +0000 (20:52 +0000)
committerOleg Drokin <green@whamcloud.com>
Fri, 14 Jul 2023 03:09:10 +0000 (03:09 +0000)
Static analysis shows that a number of functions
could be made static. This patch declares several
functions in mdc, mdd, mdt, and mgc static.

Also, remove mgs_client_add() since it was unused, and
move a declaration from a c-file to the proper header file.

Test-Parameters: trivial
Signed-off-by: Timothy Day <timday@amazon.com>
Change-Id: Ia23f62465c27c83a9a0260bb45e8c8b710491558
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51478
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Neil Brown <neilb@suse.de>
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-by: jsimmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
12 files changed:
lustre/mdc/mdc_dev.c
lustre/mdc/mdc_request.c
lustre/mdd/mdd_device.c
lustre/mdd/mdd_dir.c
lustre/mdd/mdd_internal.h
lustre/mdt/mdt_hsm_cdt_agent.c
lustre/mdt/mdt_io.c
lustre/mdt/mdt_open.c
lustre/mdt/mdt_som.c
lustre/mgc/lproc_mgc.c
lustre/mgs/mgs_barrier.c
lustre/mgs/mgs_fs.c

index ad5e382..20298b3 100644 (file)
@@ -93,12 +93,13 @@ static int mdc_set_dom_lock_data(struct ldlm_lock *lock, void *data)
        return set;
 }
 
-int mdc_dom_lock_match(const struct lu_env *env, struct obd_export *exp,
-                      struct ldlm_res_id *res_id, enum ldlm_type type,
-                      union ldlm_policy_data *policy, enum ldlm_mode mode,
-                      __u64 *flags, struct osc_object *obj,
-                      struct lustre_handle *lockh,
-                      enum ldlm_match_flags match_flags)
+static int mdc_dom_lock_match(const struct lu_env *env, struct obd_export *exp,
+                             struct ldlm_res_id *res_id, enum ldlm_type type,
+                             union ldlm_policy_data *policy,
+                             enum ldlm_mode mode, __u64 *flags,
+                             struct osc_object *obj,
+                             struct lustre_handle *lockh,
+                             enum ldlm_match_flags match_flags)
 {
        struct obd_device *obd = exp->exp_obd;
        __u64 lflags = *flags;
@@ -136,9 +137,10 @@ int mdc_dom_lock_match(const struct lu_env *env, struct obd_export *exp,
  * Finds an existing lock covering a page with given index.
  * Copy of osc_obj_dlmlock_at_pgoff() but for DoM IBITS lock.
  */
-struct ldlm_lock *mdc_dlmlock_at_pgoff(const struct lu_env *env,
-                                      struct osc_object *obj, pgoff_t index,
-                                      enum osc_dap_flags dap_flags)
+static struct ldlm_lock *mdc_dlmlock_at_pgoff(const struct lu_env *env,
+                                             struct osc_object *obj,
+                                             pgoff_t index,
+                                             enum osc_dap_flags dap_flags)
 {
        struct osc_thread_info *info = osc_env_info(env);
        struct ldlm_res_id *resname = &info->oti_resname;
@@ -286,8 +288,8 @@ static int mdc_lock_flush(const struct lu_env *env, struct osc_object *obj,
        RETURN(result);
 }
 
-void mdc_lock_lockless_cancel(const struct lu_env *env,
-                             const struct cl_lock_slice *slice)
+static void mdc_lock_lockless_cancel(const struct lu_env *env,
+                                    const struct cl_lock_slice *slice)
 {
        struct osc_lock *ols = cl2osc_lock(slice);
        struct osc_object *osc = cl2osc(slice->cls_obj);
@@ -585,10 +587,10 @@ int mdc_fill_lvb(struct req_capsule *pill, struct ost_lvb *lvb)
        RETURN(0);
 }
 
-int mdc_enqueue_fini(struct obd_export *exp, struct ptlrpc_request *req,
-                    osc_enqueue_upcall_f upcall, void *cookie,
-                    struct lustre_handle *lockh, enum ldlm_mode mode,
-                    __u64 *flags, int errcode)
+static int mdc_enqueue_fini(struct obd_export *exp, struct ptlrpc_request *req,
+                           osc_enqueue_upcall_f upcall, void *cookie,
+                           struct lustre_handle *lockh, enum ldlm_mode mode,
+                           __u64 *flags, int errcode)
 {
        struct osc_lock *ols = cookie;
        bool glimpse = *flags & LDLM_FL_HAS_INTENT;
@@ -644,8 +646,9 @@ int mdc_enqueue_fini(struct obd_export *exp, struct ptlrpc_request *req,
        RETURN(rc);
 }
 
-int mdc_enqueue_interpret(const struct lu_env *env, struct ptlrpc_request *req,
-                         void *args, int rc)
+static int mdc_enqueue_interpret(const struct lu_env *env,
+                                struct ptlrpc_request *req,
+                                void *args, int rc)
 {
        struct osc_enqueue_args *aa = args;
        struct ldlm_lock *lock;
@@ -702,11 +705,11 @@ int mdc_enqueue_interpret(const struct lu_env *env, struct ptlrpc_request *req,
  * when other sync requests do not get released lock from a client, the client
  * is excluded from the cluster -- such scenarious make the life difficult, so
  * release locks just after they are obtained. */
-int mdc_enqueue_send(const struct lu_env *env, struct obd_export *exp,
-                    struct ldlm_res_id *res_id, __u64 *flags,
-                    union ldlm_policy_data *policy, struct ost_lvb *lvb,
-                    osc_enqueue_upcall_f upcall, void *cookie,
-                    struct ldlm_enqueue_info *einfo, int async)
+static int mdc_enqueue_send(const struct lu_env *env, struct obd_export *exp,
+                           struct ldlm_res_id *res_id, __u64 *flags,
+                           union ldlm_policy_data *policy, struct ost_lvb *lvb,
+                           osc_enqueue_upcall_f upcall, void *cookie,
+                           struct ldlm_enqueue_info *einfo, int async)
 {
        struct obd_device *obd = exp->exp_obd;
        struct lustre_handle lockh = { 0 };
@@ -951,8 +954,8 @@ static const struct cl_lock_operations mdc_lock_ops = {
        .clo_print      = osc_lock_print,
 };
 
-int mdc_lock_init(const struct lu_env *env, struct cl_object *obj,
-                 struct cl_lock *lock, const struct cl_io *io)
+static int mdc_lock_init(const struct lu_env *env, struct cl_object *obj,
+                        struct cl_lock *lock, const struct cl_io *io)
 {
        struct osc_lock *ols;
        __u32 enqflags = lock->cll_descr.cld_enq_flags;
@@ -1179,8 +1182,8 @@ static int mdc_io_read_ahead(const struct lu_env *env,
        RETURN(0);
 }
 
-int mdc_io_fsync_start(const struct lu_env *env,
-                      const struct cl_io_slice *slice)
+static int mdc_io_fsync_start(const struct lu_env *env,
+                             const struct cl_io_slice *slice)
 {
        struct cl_io *io = slice->cis_io;
        struct cl_fsync_io *fio = &io->u.ci_fsync;
@@ -1380,8 +1383,8 @@ static const struct cl_io_operations mdc_io_ops = {
        .cio_extent_release = osc_io_extent_release,
 };
 
-int mdc_io_init(const struct lu_env *env, struct cl_object *obj,
-               struct cl_io *io)
+static int mdc_io_init(const struct lu_env *env, struct cl_object *obj,
+                      struct cl_io *io)
 {
        struct osc_io *oio = osc_env_io(env);
 
@@ -1481,7 +1484,7 @@ static int mdc_object_ast_clear(struct ldlm_lock *lock, void *data)
        RETURN(LDLM_ITER_CONTINUE);
 }
 
-int mdc_object_prune(const struct lu_env *env, struct cl_object *obj)
+static int mdc_object_prune(const struct lu_env *env, struct cl_object *obj)
 {
        struct osc_object *osc = cl2osc(obj);
        struct ldlm_res_id *resname = &osc_env_info(env)->oti_resname;
@@ -1549,9 +1552,9 @@ static const struct lu_object_operations mdc_lu_obj_ops = {
        .loo_object_invariant = NULL
 };
 
-struct lu_object *mdc_object_alloc(const struct lu_env *env,
-                                  const struct lu_object_header *unused,
-                                  struct lu_device *dev)
+static struct lu_object *mdc_object_alloc(const struct lu_env *env,
+                                         const struct lu_object_header *unused,
+                                         struct lu_device *dev)
 {
        struct osc_object *osc;
        struct lu_object  *obj;
index 3c6fd6a..f823075 100644 (file)
@@ -2659,8 +2659,9 @@ struct mdc_rmfid_args {
        int mra_nr;
 };
 
-int mdc_rmfid_interpret(const struct lu_env *env, struct ptlrpc_request *req,
-                         void *args, int rc)
+static int mdc_rmfid_interpret(const struct lu_env *env,
+                              struct ptlrpc_request *req,
+                              void *args, int rc)
 {
        struct mdc_rmfid_args *aa;
        int *rcs, size;
index 57242b2..f237468 100644 (file)
@@ -930,9 +930,6 @@ static int mdd_dummy_unlink(const struct lu_env *env,
        return -EPERM;
 }
 
-int mdd_create(const struct lu_env *env, struct md_object *pobj,
-                     const struct lu_name *lname, struct md_object *child,
-                     struct md_op_spec *spec, struct md_attr *ma);
 static int mdd_obf_create(const struct lu_env *env, struct md_object *pobj,
                      const struct lu_name *lname, struct md_object *child,
                      struct md_op_spec *spec, struct md_attr *ma)
index e8aa9da..fc1cccf 100644 (file)
@@ -326,8 +326,8 @@ static int mdd_is_parent(const struct lu_env *env,
  * returns 0: if fid is not an ancestor of @mo;
  * returns < 0: if error
  */
-int mdd_is_subdir(const struct lu_env *env, struct md_object *mo,
-                 const struct lu_fid *fid)
+static int mdd_is_subdir(const struct lu_env *env, struct md_object *mo,
+                        const struct lu_fid *fid)
 {
        struct mdd_device *mdd = mdo2mdd(mo);
        struct lu_attr *attr = MDD_ENV_VAR(env, cattr);
@@ -928,8 +928,9 @@ static bool mdd_changelog_emrg_cleanup(const struct lu_env *env,
        return false;
 }
 
-bool mdd_changelog_need_gc(const struct lu_env *env, struct mdd_device *mdd,
-                          struct llog_handle *lgh)
+static bool mdd_changelog_need_gc(const struct lu_env *env,
+                                 struct mdd_device *mdd,
+                                 struct llog_handle *lgh)
 {
        struct mdd_changelog *mc = &mdd->mdd_cl;
 
index 4af653d..d1e6e65 100644 (file)
@@ -234,6 +234,9 @@ int mdd_attr_set_internal(const struct lu_env *env,
 int mdd_update_time(const struct lu_env *env, struct mdd_object *obj,
                    const struct lu_attr *oattr, struct lu_attr *attr,
                    struct thandle *handle);
+int mdd_create(const struct lu_env *env, struct md_object *pobj,
+                     const struct lu_name *lname, struct md_object *child,
+                     struct md_op_spec *spec, struct md_attr *ma);
 int mdd_create_object_internal(const struct lu_env *env, struct mdd_object *p,
                               struct mdd_object *c, struct lu_attr *attr,
                               struct thandle *handle,
index e72e3da..9bfe711 100644 (file)
@@ -309,8 +309,8 @@ int mdt_hsm_find_best_agent(struct coordinator *cdt, __u32 archive,
        RETURN(rc);
 }
 
-int mdt_hsm_send_action_to_each_archive(struct mdt_thread_info *mti,
-                                   struct hsm_action_item *hai)
+static int mdt_hsm_send_action_to_each_archive(struct mdt_thread_info *mti,
+                                              struct hsm_action_item *hai)
 {
        struct hsm_agent *ha;
        __u32 archive_mask = 0;
index cf86f48..8194235 100644 (file)
@@ -879,9 +879,9 @@ int mdt_obd_commitrw(const struct lu_env *env, int cmd, struct obd_export *exp,
        RETURN(rc);
 }
 
-int mdt_object_fallocate(const struct lu_env *env, struct dt_device *dt,
-                        struct dt_object *dob, __u64 start, __u64 end,
-                        int mode, struct lu_attr *la)
+static int mdt_object_fallocate(const struct lu_env *env, struct dt_device *dt,
+                               struct dt_object *dob, __u64 start, __u64 end,
+                               int mode, struct lu_attr *la)
 {
        struct thandle *th;
        int rc;
@@ -1079,9 +1079,9 @@ out:
        return rc;
 }
 
-int mdt_object_punch(const struct lu_env *env, struct dt_device *dt,
-                    struct dt_object *dob, __u64 start, __u64 end,
-                    struct lu_attr *la)
+static int mdt_object_punch(const struct lu_env *env, struct dt_device *dt,
+                           struct dt_object *dob, __u64 start, __u64 end,
+                           struct lu_attr *la)
 {
        struct thandle *th;
        int rc;
@@ -1242,8 +1242,8 @@ out:
  * an actual size from that client.
  *
  */
-int mdt_do_glimpse(const struct lu_env *env, struct ldlm_namespace *ns,
-                  struct ldlm_resource *res)
+static int mdt_do_glimpse(const struct lu_env *env, struct ldlm_namespace *ns,
+                         struct ldlm_resource *res)
 {
        union ldlm_policy_data policy;
        struct lustre_handle lockh;
@@ -1912,7 +1912,8 @@ out:
  * reprocess if lock was blocked, in the latest case l_ast_data is set to
  * the mdt_object which is kept while there are pending locks on it.
  */
-int ldlm_dom_discard_cp_ast(struct ldlm_lock *lock, __u64 flags, void *data)
+static int ldlm_dom_discard_cp_ast(struct ldlm_lock *lock, __u64 flags,
+                                  void *data)
 {
        struct mdt_object *mo;
        struct lustre_handle dom_lh;
index a00924b..a544550 100644 (file)
@@ -2122,8 +2122,8 @@ out_reprocess:
        return rc;
 }
 
-int mdt_close_handle_layouts(struct mdt_thread_info *info,
-                            struct mdt_object *o, struct md_attr *ma)
+static int mdt_close_handle_layouts(struct mdt_thread_info *info,
+                                   struct mdt_object *o, struct md_attr *ma)
 {
        struct mdt_lock_handle *lh1 = &info->mti_lh[MDT_LH_NEW];
        struct mdt_lock_handle *lh2 = &info->mti_lh[MDT_LH_OLD];
index 8bcc862..c60b220 100644 (file)
@@ -42,7 +42,7 @@
  * \param rc  - is the SOM xattr stored in \a buf
  * \param ms  - is the md_som structure where to extract SOM attributes.
  */
-int lustre_buf2som(void *buf, int rc, struct md_som *ms)
+static int lustre_buf2som(void *buf, int rc, struct md_som *ms)
 {
        struct lustre_som_attrs *attrs = (struct lustre_som_attrs *)buf;
        ENTRY;
index 051e315..b965186 100644 (file)
@@ -73,8 +73,8 @@ LUSTRE_RO_ATTR(conn_uuid);
 
 LUSTRE_RW_ATTR(ping);
 
-ssize_t dynamic_nids_show(struct kobject *kobj, struct attribute *attr,
-                         char *buf)
+static ssize_t dynamic_nids_show(struct kobject *kobj, struct attribute *attr,
+                                char *buf)
 {
        struct obd_device *obd = container_of(kobj, struct obd_device,
                                              obd_kset.kobj);
@@ -86,8 +86,8 @@ ssize_t dynamic_nids_show(struct kobject *kobj, struct attribute *attr,
        RETURN(count);
 }
 
-ssize_t dynamic_nids_store(struct kobject *kobj, struct attribute *attr,
-                          const char *buffer, size_t count)
+static ssize_t dynamic_nids_store(struct kobject *kobj, struct attribute *attr,
+                                 const char *buffer, size_t count)
 {
        struct obd_device *obd = container_of(kobj, struct obd_device,
                                              obd_kset.kobj);
index bf8a725..d6c1bd7 100644 (file)
@@ -247,7 +247,7 @@ static bool mgs_barrier_done(struct fs_db *fsdb)
        return true;
 }
 
-bool mgs_barrier_expired(struct fs_db *fsdb, time64_t timeout)
+static bool mgs_barrier_expired(struct fs_db *fsdb, time64_t timeout)
 {
        time64_t expired = fsdb->fsdb_barrier_latest_create_time + timeout;
 
index 40ec200..4c17c74 100644 (file)
@@ -90,17 +90,6 @@ out:
        RETURN(rc);
 }
 
-/**
- * Add client export data to the MGS.  This data is currently NOT stored on
- * disk in the last_rcvd file or anywhere else.  In the event of a MGS
- * crash all connections are treated as new connections.
- */
-int mgs_client_add(struct obd_device *obd, struct obd_export *exp,
-                  void *localdata)
-{
-       return 0;
-}
-
 /* Remove client export data from the MGS */
 int mgs_client_free(struct obd_export *exp)
 {