Whamcloud - gitweb
LU-8191 lustre: convert mdc,mdd,mdt,mgc functions to static
authorTimothy Day <timday@amazon.com>
Thu, 28 Mar 2024 23:12:34 +0000 (16:12 -0700)
committerAndreas Dilger <adilger@whamcloud.com>
Sat, 30 Mar 2024 07:24:12 +0000 (07:24 +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.

Lustre-change: https://review.whamcloud.com/51478
Lustre-commit: 38d151f2f65d76fc392d356519227a648e114b5f

Test-Parameters: trivial
Signed-off-by: Timothy Day <timday@amazon.com>
Change-Id: Ia23f62465c27c83a9a0260bb45e8c8b710491558
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/54617
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@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 cf555c0..fb81e30 100644 (file)
@@ -92,12 +92,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;
@@ -135,9 +136,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;
@@ -285,8 +287,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);
@@ -584,10 +586,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;
@@ -643,8 +645,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;
@@ -701,11 +704,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 };
@@ -946,8 +949,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;
@@ -1165,8 +1168,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;
@@ -1381,8 +1384,8 @@ static struct cl_io_operations mdc_io_ops = {
        .cio_commit_async = osc_io_commit_async,
 };
 
-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);
 
@@ -1482,7 +1485,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;
@@ -1550,9 +1553,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 48957ad..be5b9f9 100644 (file)
@@ -2625,8 +2625,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 b8dca7a..96399ae 100644 (file)
@@ -911,9 +911,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 9ae14d6..dab561c 100644 (file)
@@ -327,8 +327,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);
@@ -929,8 +929,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 3c9464c..5ab585f 100644 (file)
@@ -240,6 +240,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 3e51788..2df990e 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 69e7172..eb8677f 100644 (file)
@@ -876,9 +876,9 @@ int mdt_obd_commitrw(const struct lu_env *env, int cmd, struct obd_export *exp,
        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;
@@ -1038,8 +1038,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;
@@ -1706,7 +1706,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 d020e7e..308e6d7 100644 (file)
@@ -2172,8 +2172,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 4adae62..179ed65 100644 (file)
@@ -74,8 +74,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);
@@ -87,8 +87,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 90fa72d..d608924 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 3b824e7..eca7fa5 100644 (file)
@@ -91,17 +91,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)
 {