Whamcloud - gitweb
LU-8191 lustre: convert osp,osd,osc,ofd functions to static 77/51477/2
authorTimothy Day <timday@amazon.com>
Fri, 23 Jun 2023 20:51:00 +0000 (20:51 +0000)
committerOleg Drokin <green@whamcloud.com>
Fri, 14 Jul 2023 03:08:59 +0000 (03:08 +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.

Test-Parameters: trivial
Signed-off-by: Timothy Day <timday@amazon.com>
Change-Id: I3d7af7ec0fa2978bfdd0cb490f18f485a78f81f6
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51477
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>
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 8d00ed1..088ec66 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 78a8c14..bd55e71 100644 (file)
@@ -848,7 +848,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 327e69d..543f772 100644 (file)
@@ -954,8 +954,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 c351d67..5e7757f 100644 (file)
@@ -86,7 +86,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;
 
@@ -2907,10 +2907,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;
@@ -2945,8 +2946,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 44bc966..48da973 100644 (file)
@@ -167,8 +167,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);
@@ -198,8 +198,8 @@ static ssize_t sync_on_lseek_show(struct kobject *kobj, struct attribute *attr,
        return sprintf(buf, "%u\n", osd->od_sync_on_lseek);
 }
 
-ssize_t sync_on_lseek_store(struct kobject *kobj, struct attribute *attr,
-                           const char *buffer, size_t count)
+static ssize_t sync_on_lseek_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);
        struct osd_device *osd = osd_dt_dev(dt);
@@ -270,8 +270,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 18aaca9..25054a5 100644 (file)
@@ -582,7 +582,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)
@@ -1065,9 +1065,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 4be0737..f37f7a9 100644 (file)
@@ -349,10 +349,10 @@ out:
 }
 
 /* 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 b34f2d8..6d4e09b 100644 (file)
@@ -194,7 +194,8 @@ static ssize_t sync_changes_store(struct kobject *kobj, struct attribute *attr,
 LUSTRE_RW_ATTR(sync_changes);
 
 static ssize_t max_sync_changes_show(struct kobject *kobj,
-               struct attribute *attr, char *buf)
+                                    struct attribute *attr,
+                                    char *buf)
 {
        struct dt_device *dt = container_of(kobj, struct dt_device,
                                            dd_kobj);
@@ -205,7 +206,8 @@ static ssize_t max_sync_changes_show(struct kobject *kobj,
 
 
 static ssize_t max_sync_changes_store(struct kobject *kobj,
-               struct attribute *attr, const char *buffer, size_t count)
+                                     struct attribute *attr,
+                                     const char *buffer, size_t count)
 {
        struct dt_device *dt = container_of(kobj, struct dt_device,
                                            dd_kobj);
@@ -847,8 +849,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 c6e6ed7..107a386 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 b9cbe72..d890439 100644 (file)
@@ -1670,8 +1670,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);
@@ -2191,11 +2191,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 6f5afb2..0bd9548 100644 (file)
@@ -1166,7 +1166,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 51b1a4b..bfc5b38 100644 (file)
@@ -462,12 +462,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
@@ -1597,8 +1591,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 33adf2a..872d5e9 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;