Whamcloud - gitweb
LU-8191 lustre: convert osp,osd,osc,ofd functions to static
authorTimothy Day <timday@amazon.com>
Thu, 28 Mar 2024 23:02:17 +0000 (16:02 -0700)
committerAndreas Dilger <adilger@whamcloud.com>
Sat, 30 Mar 2024 07:24:06 +0000 (07:24 +0000)
Static analysis shows that a number of functions
could be made static. This patch declares several
functions in osp, osd, osc, and ofd static.

Also, fix a few minor style issues.

Lustre-change: https://review.whamcloud.com/51477
Lustre-commit: 2fa075d10f72f1400e4da9bdcaec905858b0a264

Test-Parameters: trivial
Signed-off-by: Timothy Day <timday@amazon.com>
Change-Id: I3d7af7ec0fa2978bfdd0cb490f18f485a78f81f6
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/54616
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
13 files changed:
lustre/ofd/ofd_access_log.c
lustre/osc/lproc_osc.c
lustre/osc/osc_io.c
lustre/osc/osc_request.c
lustre/osd-zfs/osd_lproc.c
lustre/osd-zfs/osd_oi.c
lustre/osd-zfs/osd_xattr.c
lustre/osp/lproc_osp.c
lustre/osp/osp_md_object.c
lustre/osp/osp_object.c
lustre/osp/osp_precreate.c
lustre/osp/osp_sync.c
lustre/osp/osp_trans.c

index 0dcd328..b37c4dd 100644 (file)
@@ -323,7 +323,8 @@ static ssize_t oal_file_write(struct file *filp, const char __user *buf,
        return size > 0 ? size : rc;
 }
 
-unsigned int oal_file_poll(struct file *filp, struct poll_table_struct *wait)
+static unsigned int oal_file_poll(struct file *filp,
+                                 struct poll_table_struct *wait)
 {
        struct oal_circ_buf *ocb = filp->private_data;
        struct ofd_access_log *oal = ocb->ocb_access_log;
index 3e011b2..479136a 100644 (file)
@@ -1007,7 +1007,7 @@ static ssize_t osc_stats_seq_write(struct file *file,
 
 LPROC_SEQ_FOPS(osc_stats);
 
-int lprocfs_osc_attach_seqstat(struct obd_device *obd)
+static int lprocfs_osc_attach_seqstat(struct obd_device *obd)
 {
        int rc;
 
index 03617f0..6ebebf8 100644 (file)
@@ -943,8 +943,8 @@ int osc_fsync_ost(const struct lu_env *env, struct osc_object *obj,
 }
 EXPORT_SYMBOL(osc_fsync_ost);
 
-int osc_io_fsync_start(const struct lu_env *env,
-                      const struct cl_io_slice *slice)
+static int osc_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;
index af3504a..000b112 100644 (file)
@@ -89,7 +89,7 @@ static void osc_release_ppga(struct brw_page **ppga, size_t count);
 static int brw_interpret(const struct lu_env *env, struct ptlrpc_request *req,
                         void *data, int rc);
 
-void osc_pack_req_body(struct ptlrpc_request *req, struct obdo *oa)
+static void osc_pack_req_body(struct ptlrpc_request *req, struct obdo *oa)
 {
        struct ost_body *body;
 
@@ -3086,10 +3086,11 @@ static int osc_set_lock_data(struct ldlm_lock *lock, void *data)
        return set;
 }
 
-int osc_enqueue_fini(struct ptlrpc_request *req, osc_enqueue_upcall_f upcall,
-                    void *cookie, struct lustre_handle *lockh,
-                    enum ldlm_mode mode, __u64 *flags, bool speculative,
-                    int errcode)
+static int osc_enqueue_fini(struct ptlrpc_request *req,
+                           osc_enqueue_upcall_f upcall,
+                           void *cookie, struct lustre_handle *lockh,
+                           enum ldlm_mode mode, __u64 *flags,
+                           bool speculative, int errcode)
 {
        bool intent = *flags & LDLM_FL_HAS_INTENT;
        int rc;
@@ -3124,8 +3125,9 @@ int osc_enqueue_fini(struct ptlrpc_request *req, osc_enqueue_upcall_f upcall,
        RETURN(rc);
 }
 
-int osc_enqueue_interpret(const struct lu_env *env, struct ptlrpc_request *req,
-                         void *args, int rc)
+static int osc_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;
index b4f2d03..20c85fd 100644 (file)
@@ -212,8 +212,8 @@ static ssize_t mntdev_show(struct kobject *kobj, struct attribute *attr,
 }
 LUSTRE_RO_ATTR(mntdev);
 
-ssize_t force_sync_store(struct kobject *kobj, struct attribute *attr,
-                        const char *buffer, size_t count)
+static ssize_t force_sync_store(struct kobject *kobj, struct attribute *attr,
+                               const char *buffer, size_t count)
 {
        struct dt_device *dt = container_of(kobj, struct dt_device,
                                            dd_kobj);
@@ -284,8 +284,8 @@ static ssize_t index_backup_show(struct kobject *kobj, struct attribute *attr,
        return sprintf(buf, "%d\n", dev->od_index_backup_policy);
 }
 
-ssize_t index_backup_store(struct kobject *kobj, struct attribute *attr,
-                          const char *buffer, size_t count)
+static ssize_t index_backup_store(struct kobject *kobj, struct attribute *attr,
+                                 const char *buffer, size_t count)
 {
        struct dt_device *dt = container_of(kobj, struct dt_device,
                                            dd_kobj);
index 89469d0..94a8f91 100644 (file)
@@ -583,7 +583,7 @@ osd_get_idx_for_fid(struct osd_device *osd, const struct lu_fid *fid,
        return oi->oi_zapid;
 }
 
-uint64_t
+static uint64_t
 osd_get_name_n_idx_compat(const struct lu_env *env, struct osd_device *osd,
                          const struct lu_fid *fid, char *buf, int bufsize,
                          dnode_t **zdn)
@@ -1066,9 +1066,9 @@ struct osd_idmap_cache *osd_idc_find(const struct lu_env *env,
        return NULL;
 }
 
-struct osd_idmap_cache *osd_idc_add(const struct lu_env *env,
-                                   struct osd_device *osd,
-                                   const struct lu_fid *fid)
+static struct osd_idmap_cache *osd_idc_add(const struct lu_env *env,
+                                          struct osd_device *osd,
+                                          const struct lu_fid *fid)
 {
        struct osd_thread_info *oti = osd_oti_get(env);
        struct osd_idmap_cache *idc;
index e22916a..23eb0ff 100644 (file)
@@ -354,10 +354,10 @@ int osd_xattr_get(const struct lu_env *env, struct dt_object *dt,
 }
 
 /* the function is used to declare EAs when SA is not supported */
-void __osd_xattr_declare_legacy(const struct lu_env *env,
-                               struct osd_object *obj,
-                               int vallen, const char *name,
-                               struct osd_thandle *oh)
+static void __osd_xattr_declare_legacy(const struct lu_env *env,
+                                      struct osd_object *obj,
+                                      int vallen, const char *name,
+                                      struct osd_thandle *oh)
 {
        struct osd_device *osd = osd_obj2dev(obj);
        dmu_tx_t *tx = oh->ot_tx;
index f48f125..c99057e 100644 (file)
@@ -820,8 +820,8 @@ ssize_t ping_show(struct kobject *kobj, struct attribute *attr,
 }
 LUSTRE_RO_ATTR(ping);
 
-ssize_t osp_conn_uuid_show(struct kobject *kobj, struct attribute *attr,
-                          char *buf)
+static ssize_t osp_conn_uuid_show(struct kobject *kobj, struct attribute *attr,
+                                 char *buf)
 {
        struct dt_device *dt = container_of(kobj, struct dt_device,
                                            dd_kobj);
index 61e22b7..6c76014 100644 (file)
@@ -1034,8 +1034,9 @@ static int osp_md_object_unlock(const struct lu_env *env,
  * \retval             0 for success
  * \retval             negative error number on failure
  */
-int osp_md_declare_destroy(const struct lu_env *env, struct dt_object *dt,
-                          struct thandle *th)
+static int osp_md_declare_destroy(const struct lu_env *env,
+                                 struct dt_object *dt,
+                                 struct thandle *th)
 {
        return osp_trans_update_request_create(th);
 }
@@ -1064,8 +1065,8 @@ static int osp_destroy_interpreter(const struct lu_env *env,
  * \retval             0 for success
  * \retval             negative error number on failure
  */
-int osp_md_destroy(const struct lu_env *env, struct dt_object *dt,
-                  struct thandle *th)
+static int osp_md_destroy(const struct lu_env *env, struct dt_object *dt,
+                         struct thandle *th)
 {
        struct osp_object *o = dt2osp_obj(dt);
        struct osp_device *osp = lu2osp_dev(dt->do_lu.lo_dev);
index 641cdaa..bc6a29f 100644 (file)
@@ -1657,8 +1657,8 @@ static int osp_create(const struct lu_env *env, struct dt_object *dt,
  * \retval             0 for success
  * \retval             negative error number on failure
  */
-int osp_declare_destroy(const struct lu_env *env, struct dt_object *dt,
-                       struct thandle *th)
+static int osp_declare_destroy(const struct lu_env *env, struct dt_object *dt,
+                              struct thandle *th)
 {
        struct osp_object       *o = dt2osp_obj(dt);
        struct osp_device       *osp = lu2osp_dev(dt->do_lu.lo_dev);
@@ -2178,11 +2178,11 @@ __u64 osp_it_store(const struct lu_env *env, const struct dt_it *di)
  * \retval             0 for arriving at the end of the iteration
  * \retval             negative error number on failure
  */
-int osp_orphan_it_load(const struct lu_env *env, const struct dt_it *di,
-                      __u64 hash)
+static int osp_orphan_it_load(const struct lu_env *env, const struct dt_it *di,
+                             __u64 hash)
 {
-       struct osp_it   *it     = (struct osp_it *)di;
-       int              rc;
+       struct osp_it *it = (struct osp_it *)di;
+       int rc;
 
        it->ooi_next = hash;
        rc = osp_orphan_it_next(env, (struct dt_it *)di);
index ac8439c..cd20168 100644 (file)
@@ -1133,7 +1133,7 @@ update:
  * \retval 0           on success
  * \retval negative    negated errno on error
  */
-int osp_init_pre_fid(struct lu_env *env, struct osp_device *osp)
+static int osp_init_pre_fid(struct lu_env *env, struct osp_device *osp)
 {
        struct osp_thread_info *osi;
        struct lu_client_seq *cli_seq;
index 09bd735..fd6c415 100644 (file)
@@ -460,12 +460,6 @@ int osp_sync_add(const struct lu_env *env, struct osp_object *o,
                                th, attr);
 }
 
-int osp_sync_gap(const struct lu_env *env, struct osp_device *d,
-                       struct lu_fid *fid, int lost, struct thandle *th)
-{
-       return osp_sync_add_rec(env, d, fid, MDS_UNLINK64_REC, lost, th, NULL);
-}
-
 /*
  * it's quite obvious we can't maintain all the structures in the memory:
  * while OST is down, MDS can be processing thousands and thousands of unlinks
@@ -1594,8 +1588,8 @@ struct osp_last_committed_cb {
        __u64                    ospc_transno;
 };
 
-void osp_sync_local_commit_cb(struct lu_env *env, struct thandle *th,
-                             struct dt_txn_commit_cb *dcb, int err)
+static void osp_sync_local_commit_cb(struct lu_env *env, struct thandle *th,
+                                    struct dt_txn_commit_cb *dcb, int err)
 {
        struct osp_last_committed_cb    *cb;
        struct osp_device               *d;
index 6c7b1b4..6eecfe3 100644 (file)
@@ -284,10 +284,10 @@ object_update_request_dump(const struct object_update_request *ourq,
  * \retval             0 if packing succeeds
  * \retval             negative errno if packing fails
  */
-int osp_prep_inline_update_req(const struct lu_env *env,
-                              struct ptlrpc_request *req,
-                              struct osp_update_request *our,
-                              int repsize)
+static int osp_prep_inline_update_req(const struct lu_env *env,
+                                     struct ptlrpc_request *req,
+                                     struct osp_update_request *our,
+                                     int repsize)
 {
        struct osp_update_request_sub *ours;
        struct out_update_header *ouh;