Skip to contentSkip to conversation

Staging: lustre: Code cleanup

PATCH New Shraddha Barke 1 participant 7 messages Oct 31, 2015 Staging

lore
Share & tools
lore
#0 lore raw

cover Staging: lustre: Code cleanup

These patches remove wrapper functions, unused declarations and declare local functions as static in lustre.

Shraddha Barke (6):
Staging: lustre: lclient: Remove wrapper functions
Staging: lustre: lmv: Remove unused function declaration
Staging: lustre: lmv: Declare local functions as static
Staging: lustre: lov: Remove unused function declarations
Staging: lustre: lov: Declare local functions as static
Staging: lustre: mdc: Remove unused declarations

 drivers/staging/lustre/lustre/lclient/lcommon_cl.c  |  4 ++--
 .../staging/lustre/lustre/llite/llite_internal.h    | 10 ----------
 drivers/staging/lustre/lustre/lmv/lmv_intent.c      | 21 +++++++++++----------
 drivers/staging/lustre/lustre/lmv/lmv_internal.h    | 14 --------------
 drivers/staging/lustre/lustre/lov/lov_internal.h    | 15 ---------------
 drivers/staging/lustre/lustre/lov/lov_request.c     | 16 +++++++++-------
 drivers/staging/lustre/lustre/mdc/mdc_internal.h    |  2 --
 7 files changed, 22 insertions(+), 60 deletions(-)
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/6 Staging: lustre: lclient: Remove wrapper functions

The functions cl_isize_lock and cl_isize_unlock can be replaced with direct calls to ll_inode_size_lock and ll_inode_size_unlock. Thus drop the wrapper functions.

---
 drivers/staging/lustre/lustre/lclient/lcommon_cl.c   |  4 ++--
 drivers/staging/lustre/lustre/llite/llite_internal.h | 10 ----------
 2 files changed, 2 insertions(+), 12 deletions(-)
drivers/staging/lustre/lustre/lclient/lcommon_cl.c +2 -2
index 0b8e4d2..12c7f0e 100644
@@ -427,7 +427,7 @@ static void ccc_object_size_lock(struct cl_object *obj)
 {
 	struct inode *inode = ccc_object_inode(obj);
 
-	cl_isize_lock(inode);
+	ll_inode_size_lock(inode);
 	cl_object_attr_lock(obj);
 }
 
@@ -436,7 +436,7 @@ static void ccc_object_size_unlock(struct cl_object *obj)
 	struct inode *inode = ccc_object_inode(obj);
 
 	cl_object_attr_unlock(obj);
-	cl_isize_unlock(inode);
+	ll_inode_size_unlock(inode);
 }
 
 /*****************************************************************************
drivers/staging/lustre/lustre/llite/llite_internal.h +0 -10
index 9096d31..157c3284 100644
@@ -1285,16 +1285,6 @@ static inline struct ll_file_data *cl_iattr2fd(struct inode *inode,
 	return LUSTRE_FPRIVATE(attr->ia_file);
 }
 
-static inline void cl_isize_lock(struct inode *inode)
-{
-	ll_inode_size_lock(inode);
-}
-
-static inline void cl_isize_unlock(struct inode *inode)
-{
-	ll_inode_size_unlock(inode);
-}
-
 static inline void cl_isize_write_nolock(struct inode *inode, loff_t kms)
 {
 	LASSERT(mutex_is_locked(&ll_i2info(inode)->lli_size_mutex));
Signature · 1 line
2.1.4
#2 lore raw

PATCH 2/6 Staging: lustre: lmv: Remove unused function declaration

In reply to Shraddha Barke

The function lmv_blocking_ast is declared in header file but not used. Hence remove the declaration.

---
 drivers/staging/lustre/lustre/lmv/lmv_internal.h | 2 --
 1 file changed, 2 deletions(-)
drivers/staging/lustre/lustre/lmv/lmv_internal.h +0 -2
index b808728..c8f40d9 100644
@@ -68,8 +68,6 @@ int lmv_intent_open(struct obd_export *exp, struct md_op_data *op_data,
 		    ldlm_blocking_callback cb_blocking,
 		    __u64 extra_lock_flags);
 
-int lmv_blocking_ast(struct ldlm_lock *, struct ldlm_lock_desc *,
-		     void *, int);
 int lmv_fld_lookup(struct lmv_obd *lmv, const struct lu_fid *fid, u32 *mds);
 int __lmv_fid_alloc(struct lmv_obd *lmv, struct lu_fid *fid, u32 mds);
 int lmv_fid_alloc(struct obd_export *exp, struct lu_fid *fid,
Signature · 1 line
2.1.4
#3 lore raw

PATCH 3/6 Staging: lustre: lmv: Declare local functions as static

In reply to Shraddha Barke

Declare functions lmv_intent_open and lmv_intent_lookup as static since they are used only in this particular file. Also remove corresponding declarations from header file.

---
 drivers/staging/lustre/lustre/lmv/lmv_intent.c   | 21 +++++++++++----------
 drivers/staging/lustre/lustre/lmv/lmv_internal.h | 12 ------------
 2 files changed, 11 insertions(+), 22 deletions(-)
drivers/staging/lustre/lustre/lmv/lmv_intent.c +11 -10
index eebe45b..3c585ae 100644
@@ -156,11 +156,11 @@ out:
  * IT_OPEN is intended to open (and create, possible) an object. Parent (pid)
  * may be split dir.
  */
-int lmv_intent_open(struct obd_export *exp, struct md_op_data *op_data,
-		    void *lmm, int lmmsize, struct lookup_intent *it,
-		    int flags, struct ptlrpc_request **reqp,
-		    ldlm_blocking_callback cb_blocking,
-		    __u64 extra_lock_flags)
+static int lmv_intent_open(struct obd_export *exp, struct md_op_data *op_data,
+			   void *lmm, int lmmsize, struct lookup_intent *it,
+			   int flags, struct ptlrpc_request **reqp,
+			   ldlm_blocking_callback cb_blocking,
+			   __u64 extra_lock_flags)
 {
 	struct obd_device	*obd = exp->exp_obd;
 	struct lmv_obd		*lmv = &obd->u.lmv;
@@ -239,11 +239,12 @@ int lmv_intent_open(struct obd_export *exp, struct md_op_data *op_data,
 /*
  * Handler for: getattr, lookup and revalidate cases.
  */
-int lmv_intent_lookup(struct obd_export *exp, struct md_op_data *op_data,
-		      void *lmm, int lmmsize, struct lookup_intent *it,
-		      int flags, struct ptlrpc_request **reqp,
-		      ldlm_blocking_callback cb_blocking,
-		      __u64 extra_lock_flags)
+static int lmv_intent_lookup(struct obd_export *exp,
+			     struct md_op_data *op_data,
+			     void *lmm, int lmmsize, struct lookup_intent *it,
+			     int flags, struct ptlrpc_request **reqp,
+			     ldlm_blocking_callback cb_blocking,
+			     __u64 extra_lock_flags)
 {
 	struct obd_device      *obd = exp->exp_obd;
 	struct lmv_obd	 *lmv = &obd->u.lmv;
drivers/staging/lustre/lustre/lmv/lmv_internal.h +0 -12
index c8f40d9..467cfb3 100644
@@ -56,18 +56,6 @@ int lmv_intent_lock(struct obd_export *exp, struct md_op_data *op_data,
 		    ldlm_blocking_callback cb_blocking,
 		    __u64 extra_lock_flags);
 
-int lmv_intent_lookup(struct obd_export *exp, struct md_op_data *op_data,
-		      void *lmm, int lmmsize, struct lookup_intent *it,
-		      int flags, struct ptlrpc_request **reqp,
-		      ldlm_blocking_callback cb_blocking,
-		      __u64 extra_lock_flags);
-
-int lmv_intent_open(struct obd_export *exp, struct md_op_data *op_data,
-		    void *lmm, int lmmsize, struct lookup_intent *it,
-		    int flags, struct ptlrpc_request **reqp,
-		    ldlm_blocking_callback cb_blocking,
-		    __u64 extra_lock_flags);
-
 int lmv_fld_lookup(struct lmv_obd *lmv, const struct lu_fid *fid, u32 *mds);
 int __lmv_fid_alloc(struct lmv_obd *lmv, struct lu_fid *fid, u32 mds);
 int lmv_fid_alloc(struct obd_export *exp, struct lu_fid *fid,
Signature · 1 line
2.1.4
#4 lore raw

PATCH 4/6 Staging: lustre: lov: Remove unused function declarations

In reply to Shraddha Barke

These functions have been declared in header but not used anywhere. Thus drop the declarations.

---
 drivers/staging/lustre/lustre/lov/lov_internal.h | 8 --------
 1 file changed, 8 deletions(-)
drivers/staging/lustre/lustre/lov/lov_internal.h +0 -8
index 515a5c1..87bc1dc 100644
@@ -151,14 +151,6 @@ int lov_stripe_number(struct lov_stripe_md *lsm, u64 lov_off);
 /* lov_qos.c */
 #define LOV_USES_ASSIGNED_STRIPE	0
 #define LOV_USES_DEFAULT_STRIPE	 1
-int qos_add_tgt(struct obd_device *obd, __u32 index);
-int qos_del_tgt(struct obd_device *obd, struct lov_tgt_desc *tgt);
-void qos_shrink_lsm(struct lov_request_set *set);
-int qos_prep_create(struct obd_export *exp, struct lov_request_set *set);
-void qos_update(struct lov_obd *lov);
-void qos_statfs_done(struct lov_obd *lov);
-void qos_statfs_update(struct obd_device *obd, __u64 max_age, int wait);
-int qos_remedy_create(struct lov_request_set *set, struct lov_request *req);
 
 /* lov_request.c */
 void lov_set_add_req(struct lov_request *req, struct lov_request_set *set);
Signature · 1 line
2.1.4
#5 lore raw

PATCH 5/6 Staging: lustre: lov: Declare local functions as static

In reply to Shraddha Barke

Declare functions lov_set_add_req, lov_set_finished, lov_update_set, lov_check_and_wait_active and lov_update_statfs as static since they are used only in this particular file. Also remove corresponding declarations from header file.

---
 drivers/staging/lustre/lustre/lov/lov_internal.h |  7 -------
 drivers/staging/lustre/lustre/lov/lov_request.c  | 16 +++++++++-------
 2 files changed, 9 insertions(+), 14 deletions(-)
drivers/staging/lustre/lustre/lov/lov_internal.h +0 -7
index 87bc1dc..b802873 100644
@@ -153,13 +153,8 @@ int lov_stripe_number(struct lov_stripe_md *lsm, u64 lov_off);
 #define LOV_USES_DEFAULT_STRIPE	 1
 
 /* lov_request.c */
-void lov_set_add_req(struct lov_request *req, struct lov_request_set *set);
-int lov_set_finished(struct lov_request_set *set, int idempotent);
-void lov_update_set(struct lov_request_set *set,
-		    struct lov_request *req, int rc);
 int lov_update_common_set(struct lov_request_set *set,
 			  struct lov_request *req, int rc);
-int lov_check_and_wait_active(struct lov_obd *lov, int ost_idx);
 int lov_prep_getattr_set(struct obd_export *exp, struct obd_info *oinfo,
 			 struct lov_request_set **reqset);
 int lov_fini_getattr_set(struct lov_request_set *set);
@@ -176,8 +171,6 @@ int lov_update_setattr_set(struct lov_request_set *set,
 int lov_fini_setattr_set(struct lov_request_set *set);
 int lov_prep_statfs_set(struct obd_device *obd, struct obd_info *oinfo,
 			struct lov_request_set **reqset);
-void lov_update_statfs(struct obd_statfs *osfs, struct obd_statfs *lov_sfs,
-		       int success);
 int lov_fini_statfs(struct obd_device *obd, struct obd_statfs *osfs,
 		    int success);
 int lov_fini_statfs_set(struct lov_request_set *set);
drivers/staging/lustre/lustre/lov/lov_request.c +9 -7
index 1a150c2..bb1a03f 100644
@@ -74,7 +74,7 @@ void lov_finish_set(struct lov_request_set *set)
 	kfree(set);
 }
 
-int lov_set_finished(struct lov_request_set *set, int idempotent)
+static int lov_set_finished(struct lov_request_set *set, int idempotent)
 {
 	int completes = atomic_read(&set->set_completes);
 
@@ -89,8 +89,8 @@ int lov_set_finished(struct lov_request_set *set, int idempotent)
 	return 0;
 }
 
-void lov_update_set(struct lov_request_set *set,
-		    struct lov_request *req, int rc)
+static void lov_update_set(struct lov_request_set *set,
+			   struct lov_request *req, int rc)
 {
 	req->rq_complete = 1;
 	req->rq_rc = rc;
@@ -118,7 +118,8 @@ int lov_update_common_set(struct lov_request_set *set,
 	return rc;
 }
 
-void lov_set_add_req(struct lov_request *req, struct lov_request_set *set)
+static void lov_set_add_req(struct lov_request *req,
+			    struct lov_request_set *set)
 {
 	list_add_tail(&req->rq_link, &set->set_list);
 	set->set_count++;
@@ -144,7 +145,7 @@ static int lov_check_set(struct lov_obd *lov, int idx)
  * If the OSC has not yet had a chance to connect to the OST the first time,
  * wait once for it to connect instead of returning an error.
  */
-int lov_check_and_wait_active(struct lov_obd *lov, int ost_idx)
+static int lov_check_and_wait_active(struct lov_obd *lov, int ost_idx)
 {
 	wait_queue_head_t waitq;
 	struct l_wait_info lwi;
@@ -591,8 +592,9 @@ int lov_fini_statfs_set(struct lov_request_set *set)
 	return rc;
 }
 
-void lov_update_statfs(struct obd_statfs *osfs, struct obd_statfs *lov_sfs,
-		       int success)
+static void lov_update_statfs(struct obd_statfs *osfs,
+			      struct obd_statfs *lov_sfs,
+			      int success)
 {
 	int shift = 0, quit = 0;
 	__u64 tmp;
Signature · 1 line
2.1.4
#6 lore raw

PATCH 6/6 Staging: lustre: mdc: Remove unused declarations

In reply to Shraddha Barke

The functions mdc_pack_req and mdc_getxattr_pack have been declared in header file but not used. Thus remove the declarations.

---
 drivers/staging/lustre/lustre/mdc/mdc_internal.h | 2 --
 1 file changed, 2 deletions(-)
drivers/staging/lustre/lustre/mdc/mdc_internal.h +0 -2
index 29b46f7..b01c75c 100644
@@ -44,7 +44,6 @@ void lprocfs_mdc_init_vars(struct lprocfs_static_vars *lvars);
 
 void mdc_pack_body(struct ptlrpc_request *req, const struct lu_fid *fid,
 		   __u64 valid, int ea_size, __u32 suppgid, int flags);
-int mdc_pack_req(struct ptlrpc_request *req, int version, int opc);
 void mdc_is_subdir_pack(struct ptlrpc_request *req, const struct lu_fid *pfid,
 			const struct lu_fid *cfid, int flags);
 void mdc_swap_layouts_pack(struct ptlrpc_request *req,
@@ -62,7 +61,6 @@ void mdc_open_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
 		   __u32 mode, __u64 rdev, __u64 flags, const void *data,
 		   int datalen);
 void mdc_unlink_pack(struct ptlrpc_request *req, struct md_op_data *op_data);
-void mdc_getxattr_pack(struct ptlrpc_request *req, struct md_op_data *op_data);
 void mdc_link_pack(struct ptlrpc_request *req, struct md_op_data *op_data);
 void mdc_rename_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
 		     const char *old, int oldlen, const char *new, int newlen);
Signature · 1 line
2.1.4