Skip to contentSkip to conversation

Staging: lustre: lustre: ldlm: Fix do not add new typedefs

PATCH Superseded Haneen Mohammed 3 participants 6 messages Feb 27, 2015 – Mar 2, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: lustre: lustre: ldlm: Fix do not add new typedefs

This patch fixes "do not add new typedefs" warning generated by checkpatch.pl.
Update related files.

---
 drivers/staging/lustre/lustre/ldlm/ldlm_internal.h |  8 +++-----
 drivers/staging/lustre/lustre/ldlm/ldlm_lock.c     |  2 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_request.c  | 16 ++++++++--------
 3 files changed, 12 insertions(+), 14 deletions(-)
drivers/staging/lustre/lustre/ldlm/ldlm_internal.h +3 -5
index 20e64cd..fc2d9a6 100644
@@ -131,12 +131,12 @@ struct ldlm_cb_set_arg {
 	union ldlm_gl_desc		*gl_desc; /* glimpse AST descriptor */
 };
 
-typedef enum {
+enum ldlm_desc_ast {
 	LDLM_WORK_BL_AST,
 	LDLM_WORK_CP_AST,
 	LDLM_WORK_REVOKE_AST,
 	LDLM_WORK_GL_AST
-} ldlm_desc_ast_t;
+};
 
 void ldlm_grant_lock(struct ldlm_lock *lock, struct list_head *work_list);
 int ldlm_fill_lvb(struct ldlm_lock *lock, struct req_capsule *pill,
@@ -155,7 +155,7 @@ void ldlm_lock_decref_internal_nolock(struct ldlm_lock *, __u32 mode);
 void ldlm_add_ast_work_item(struct ldlm_lock *lock, struct ldlm_lock *new,
 			    struct list_head *work_list);
 int ldlm_run_ast_work(struct ldlm_namespace *ns, struct list_head *rpc_list,
-		      ldlm_desc_ast_t ast_type);
+		      enum ldlm_desc_ast ast_type);
 int ldlm_work_gl_ast_lock(struct ptlrpc_request_set *rqset, void *opaq);
 int ldlm_lock_remove_from_lru(struct ldlm_lock *lock);
 int ldlm_lock_remove_from_lru_nolock(struct ldlm_lock *lock);
@@ -232,8 +232,6 @@ enum ldlm_policy_res {
 	LDLM_POLICY_SKIP_LOCK
 };
 
-typedef enum ldlm_policy_res ldlm_policy_res_t;
-
 #define LDLM_POOL_PROC_READER_SEQ_SHOW(var, type)			    \
 	static int lprocfs_##var##_seq_show(struct seq_file *m, void *v) \
 	{								    \
drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +1 -1
index 8191005..20b7376 100644
@@ -1805,7 +1805,7 @@ int ldlm_work_gl_ast_lock(struct ptlrpc_request_set *rqset, void *opaq)
  * one.
  */
 int ldlm_run_ast_work(struct ldlm_namespace *ns, struct list_head *rpc_list,
-		      ldlm_desc_ast_t ast_type)
+		      enum ldlm_desc_ast ast_type)
 {
 	struct ldlm_cb_set_arg *arg;
 	set_producer_func       work_ast_lock;
drivers/staging/lustre/lustre/ldlm/ldlm_request.c +8 -8
index 287da32..dad09ad 100644
@@ -1405,12 +1405,12 @@ EXPORT_SYMBOL(ldlm_cli_cancel_list_local);
  * dirty data, to close a file, ...) or waiting for any RPCs in-flight (e.g.
  * readahead requests, ...)
  */
-static ldlm_policy_res_t ldlm_cancel_no_wait_policy(struct ldlm_namespace *ns,
+static enum ldlm_policy_res ldlm_cancel_no_wait_policy(struct ldlm_namespace *ns,
 						    struct ldlm_lock *lock,
 						    int unused, int added,
 						    int count)
 {
-	ldlm_policy_res_t result = LDLM_POLICY_CANCEL_LOCK;
+	ldlm_policy_res result = LDLM_POLICY_CANCEL_LOCK;
 	ldlm_cancel_for_recovery cb = ns->ns_cancel_for_recovery;
 
 	lock_res_and_lock(lock);
@@ -1441,7 +1441,7 @@ static ldlm_policy_res_t ldlm_cancel_no_wait_policy(struct ldlm_namespace *ns,
  *
  * \retval LDLM_POLICY_CANCEL_LOCK cancel lock from LRU
  */
-static ldlm_policy_res_t ldlm_cancel_lrur_policy(struct ldlm_namespace *ns,
+static enum ldlm_policy_res ldlm_cancel_lrur_policy(struct ldlm_namespace *ns,
 						 struct ldlm_lock *lock,
 						 int unused, int added,
 						 int count)
@@ -1480,7 +1480,7 @@ static ldlm_policy_res_t ldlm_cancel_lrur_policy(struct ldlm_namespace *ns,
  *
  * \retval LDLM_POLICY_CANCEL_LOCK cancel lock from LRU
  */
-static ldlm_policy_res_t ldlm_cancel_passed_policy(struct ldlm_namespace *ns,
+static enum ldlm_policy_res ldlm_cancel_passed_policy(struct ldlm_namespace *ns,
 						   struct ldlm_lock *lock,
 						   int unused, int added,
 						   int count)
@@ -1500,7 +1500,7 @@ static ldlm_policy_res_t ldlm_cancel_passed_policy(struct ldlm_namespace *ns,
  *
  * \retval LDLM_POLICY_CANCEL_LOCK cancel lock from LRU
  */
-static ldlm_policy_res_t ldlm_cancel_aged_policy(struct ldlm_namespace *ns,
+static enum ldlm_policy_res ldlm_cancel_aged_policy(struct ldlm_namespace *ns,
 						 struct ldlm_lock *lock,
 						 int unused, int added,
 						 int count)
@@ -1521,7 +1521,7 @@ static ldlm_policy_res_t ldlm_cancel_aged_policy(struct ldlm_namespace *ns,
  *
  * \retval LDLM_POLICY_CANCEL_LOCK cancel lock from LRU
  */
-static ldlm_policy_res_t ldlm_cancel_default_policy(struct ldlm_namespace *ns,
+static enum ldlm_policy_res ldlm_cancel_default_policy(struct ldlm_namespace *ns,
 						    struct ldlm_lock *lock,
 						    int unused, int added,
 						    int count)
@@ -1532,7 +1532,7 @@ static ldlm_policy_res_t ldlm_cancel_default_policy(struct ldlm_namespace *ns,
 		LDLM_POLICY_KEEP_LOCK : LDLM_POLICY_CANCEL_LOCK;
 }
 
-typedef ldlm_policy_res_t (*ldlm_cancel_lru_policy_t)(struct ldlm_namespace *,
+enum ldlm_policy_res (*ldlm_cancel_lru_policy_t)(struct ldlm_namespace *,
 						      struct ldlm_lock *, int,
 						      int, int);
 
@@ -1610,7 +1610,7 @@ static int ldlm_prepare_lru_list(struct ldlm_namespace *ns,
 	LASSERT(pf != NULL);
 
 	while (!list_empty(&ns->ns_unused_list)) {
-		ldlm_policy_res_t result;
+		enum ldlm_policy_res result;
 
 		/* all unused locks */
 		if (remained-- <= 0)
Signature · 1 line
1.9.1
#1 lore raw
Quoted 67 lines · Haneen Mohammed

This patch fixes "do not add new typedefs" warning generated by checkpatch.pl.
Update related files.

---
 drivers/staging/lustre/lustre/ldlm/ldlm_internal.h |  8 +++-----
 drivers/staging/lustre/lustre/ldlm/ldlm_lock.c     |  2 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_request.c  | 16 ++++++++--------
 3 files changed, 12 insertions(+), 14 deletions(-)
drivers/staging/lustre/lustre/ldlm/ldlm_internal.h +3 -5
index 20e64cd..fc2d9a6 100644
@@ -131,12 +131,12 @@ struct ldlm_cb_set_arg {
 	union ldlm_gl_desc		*gl_desc; /* glimpse AST descriptor */
 };
 
-typedef enum {
+enum ldlm_desc_ast {
 	LDLM_WORK_BL_AST,
 	LDLM_WORK_CP_AST,
 	LDLM_WORK_REVOKE_AST,
 	LDLM_WORK_GL_AST
-} ldlm_desc_ast_t;
+};
 
 void ldlm_grant_lock(struct ldlm_lock *lock, struct list_head *work_list);
 int ldlm_fill_lvb(struct ldlm_lock *lock, struct req_capsule *pill,
@@ -155,7 +155,7 @@ void ldlm_lock_decref_internal_nolock(struct ldlm_lock *, __u32 mode);
 void ldlm_add_ast_work_item(struct ldlm_lock *lock, struct ldlm_lock *new,
 			    struct list_head *work_list);
 int ldlm_run_ast_work(struct ldlm_namespace *ns, struct list_head *rpc_list,
-		      ldlm_desc_ast_t ast_type);
+		      enum ldlm_desc_ast ast_type);
 int ldlm_work_gl_ast_lock(struct ptlrpc_request_set *rqset, void *opaq);
 int ldlm_lock_remove_from_lru(struct ldlm_lock *lock);
 int ldlm_lock_remove_from_lru_nolock(struct ldlm_lock *lock);
@@ -232,8 +232,6 @@ enum ldlm_policy_res {
 	LDLM_POLICY_SKIP_LOCK
 };
 
-typedef enum ldlm_policy_res ldlm_policy_res_t;
-
 #define LDLM_POOL_PROC_READER_SEQ_SHOW(var, type)			    \
 	static int lprocfs_##var##_seq_show(struct seq_file *m, void *v) \
 	{								    \
drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +1 -1
index 8191005..20b7376 100644
@@ -1805,7 +1805,7 @@ int ldlm_work_gl_ast_lock(struct ptlrpc_request_set *rqset, void *opaq)
  * one.
  */
 int ldlm_run_ast_work(struct ldlm_namespace *ns, struct list_head *rpc_list,
-		      ldlm_desc_ast_t ast_type)
+		      enum ldlm_desc_ast ast_type)
 {
 	struct ldlm_cb_set_arg *arg;
 	set_producer_func       work_ast_lock;
drivers/staging/lustre/lustre/ldlm/ldlm_request.c +0 -0
index 287da32..dad09ad 100644
@@ -1405,12 +1405,12 @@ EXPORT_SYMBOL(ldlm_cli_cancel_list_local);
  * dirty data, to close a file, ...) or waiting for any RPCs in-flight (e.g.

drivers/staging/lustre/lustre/ldlm/ldlm_request.c EXPORT_SYMBOL(ldlm_cli_cancel_list_local); · line 1413

Quoted 10 lines
drivers/staging/lustre/lustre/ldlm/ldlm_request.c +2 -2
  * readahead requests, ...)
  */
-static ldlm_policy_res_t ldlm_cancel_no_wait_policy(struct ldlm_namespace *ns,
+static enum ldlm_policy_res ldlm_cancel_no_wait_policy(struct ldlm_namespace *ns,
 						    struct ldlm_lock *lock,
 						    int unused, int added,
 						    int count)
 {
-	ldlm_policy_res_t result = LDLM_POLICY_CANCEL_LOCK;
+	ldlm_policy_res result = LDLM_POLICY_CANCEL_LOCK;

This does not look right. Please check that you have really compiled the file. Ie that you have a .o file that corresponds to this .c one.

julia

Quoted 67 lines
drivers/staging/lustre/lustre/ldlm/ldlm_request.c +6 -7
 	ldlm_cancel_for_recovery cb = ns->ns_cancel_for_recovery;
 
 	lock_res_and_lock(lock);
@@ -1441,7 +1441,7 @@ static ldlm_policy_res_t ldlm_cancel_no_wait_policy(struct ldlm_namespace *ns,
  *
  * \retval LDLM_POLICY_CANCEL_LOCK cancel lock from LRU
  */
-static ldlm_policy_res_t ldlm_cancel_lrur_policy(struct ldlm_namespace *ns,
+static enum ldlm_policy_res ldlm_cancel_lrur_policy(struct ldlm_namespace *ns,
 						 struct ldlm_lock *lock,
 						 int unused, int added,
 						 int count)
@@ -1480,7 +1480,7 @@ static ldlm_policy_res_t ldlm_cancel_lrur_policy(struct ldlm_namespace *ns,
  *
  * \retval LDLM_POLICY_CANCEL_LOCK cancel lock from LRU
  */
-static ldlm_policy_res_t ldlm_cancel_passed_policy(struct ldlm_namespace *ns,
+static enum ldlm_policy_res ldlm_cancel_passed_policy(struct ldlm_namespace *ns,
 						   struct ldlm_lock *lock,
 						   int unused, int added,
 						   int count)
@@ -1500,7 +1500,7 @@ static ldlm_policy_res_t ldlm_cancel_passed_policy(struct ldlm_namespace *ns,
  *
  * \retval LDLM_POLICY_CANCEL_LOCK cancel lock from LRU
  */
-static ldlm_policy_res_t ldlm_cancel_aged_policy(struct ldlm_namespace *ns,
+static enum ldlm_policy_res ldlm_cancel_aged_policy(struct ldlm_namespace *ns,
 						 struct ldlm_lock *lock,
 						 int unused, int added,
 						 int count)
@@ -1521,7 +1521,7 @@ static ldlm_policy_res_t ldlm_cancel_aged_policy(struct ldlm_namespace *ns,
  *
  * \retval LDLM_POLICY_CANCEL_LOCK cancel lock from LRU
  */
-static ldlm_policy_res_t ldlm_cancel_default_policy(struct ldlm_namespace *ns,
+static enum ldlm_policy_res ldlm_cancel_default_policy(struct ldlm_namespace *ns,
 						    struct ldlm_lock *lock,
 						    int unused, int added,
 						    int count)
@@ -1532,7 +1532,7 @@ static ldlm_policy_res_t ldlm_cancel_default_policy(struct ldlm_namespace *ns,
 		LDLM_POLICY_KEEP_LOCK : LDLM_POLICY_CANCEL_LOCK;
 }
 
-typedef ldlm_policy_res_t (*ldlm_cancel_lru_policy_t)(struct ldlm_namespace *,
+enum ldlm_policy_res (*ldlm_cancel_lru_policy_t)(struct ldlm_namespace *,
 						      struct ldlm_lock *, int,
 						      int, int);
 
@@ -1610,7 +1610,7 @@ static int ldlm_prepare_lru_list(struct ldlm_namespace *ns,
 	LASSERT(pf != NULL);
 
 	while (!list_empty(&ns->ns_unused_list)) {
-		ldlm_policy_res_t result;
+		enum ldlm_policy_res result;
 
 		/* all unused locks */
 		if (remained-- <= 0)
--

1.9.1

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1425045406-25950-1-git-send-email-hamohammed.sa%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#2 lore raw

PATCH v2 1/1 Staging: lustre: lustre: ldlm: Fix do not add new typedefs

In reply to Haneen Mohammed

This patch fixes "do not add new typedefs" warning generated by checkpatch.pl.
Update related files.

---
v2: Fix compilation errors. resolved one typedef and left the other.

 drivers/staging/lustre/lustre/ldlm/ldlm_internal.h | 6 +++---
 drivers/staging/lustre/lustre/ldlm/ldlm_lock.c     | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/staging/lustre/lustre/ldlm/ldlm_internal.h +3 -3
index 20e64cd..17271b0 100644
@@ -131,12 +131,12 @@ struct ldlm_cb_set_arg {
 	union ldlm_gl_desc		*gl_desc; /* glimpse AST descriptor */
 };
 
-typedef enum {
+enum ldlm_desc_ast_t {
 	LDLM_WORK_BL_AST,
 	LDLM_WORK_CP_AST,
 	LDLM_WORK_REVOKE_AST,
 	LDLM_WORK_GL_AST
-} ldlm_desc_ast_t;
+};
 
 void ldlm_grant_lock(struct ldlm_lock *lock, struct list_head *work_list);
 int ldlm_fill_lvb(struct ldlm_lock *lock, struct req_capsule *pill,
@@ -155,7 +155,7 @@ void ldlm_lock_decref_internal_nolock(struct ldlm_lock *, __u32 mode);
 void ldlm_add_ast_work_item(struct ldlm_lock *lock, struct ldlm_lock *new,
 			    struct list_head *work_list);
 int ldlm_run_ast_work(struct ldlm_namespace *ns, struct list_head *rpc_list,
-		      ldlm_desc_ast_t ast_type);
+		      enum ldlm_desc_ast_t ast_type);
 int ldlm_work_gl_ast_lock(struct ptlrpc_request_set *rqset, void *opaq);
 int ldlm_lock_remove_from_lru(struct ldlm_lock *lock);
 int ldlm_lock_remove_from_lru_nolock(struct ldlm_lock *lock);
drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +1 -1
index 8191005..d7fa934 100644
@@ -1805,7 +1805,7 @@ int ldlm_work_gl_ast_lock(struct ptlrpc_request_set *rqset, void *opaq)
  * one.
  */
 int ldlm_run_ast_work(struct ldlm_namespace *ns, struct list_head *rpc_list,
-		      ldlm_desc_ast_t ast_type)
+		      enum ldlm_desc_ast_t ast_type)
 {
 	struct ldlm_cb_set_arg *arg;
 	set_producer_func       work_ast_lock;
Signature · 1 line
1.9.1
maintainer
#3 lore raw
Quoted 7 lines · Haneen Mohammed

This patch fixes "do not add new typedefs" warning generated by checkpatch.pl.
Update related files.

---
v2: Fix compilation errors. resolved one typedef and left the other.

Can you fix up the other one in a separate patch?

#4 lore raw

PATCH RESEND 1/1 Staging: lustre: Remove unnecessary else after return

This patch fix else is not usefull after break or return. Moves declaration to top addressing compiler warning:
"ISO C90 forbids mixed declarations and code" Rename similar named variable in the function.

---
 drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 28 ++++++++++++-------------
 1 file changed, 13 insertions(+), 15 deletions(-)
drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c +13 -15
index cd15445..ad68e66 100644
@@ -444,28 +444,26 @@ static int ldlm_bl_to_thread(struct ldlm_namespace *ns,
 			     struct list_head *cancels, int count,
 			     ldlm_cancel_flags_t cancel_flags)
 {
+	struct ldlm_bl_work_item blwi, *pblwi;
+
 	if (cancels && count == 0)
 		return 0;
 
 	if (cancel_flags & LCF_ASYNC) {
-		struct ldlm_bl_work_item *blwi;
-
-		OBD_ALLOC(blwi, sizeof(*blwi));
-		if (blwi == NULL)
+		OBD_ALLOC(pblwi, sizeof(*pblwi));
+		if (pblwi == NULL)
 			return -ENOMEM;
-		init_blwi(blwi, ns, ld, cancels, count, lock, cancel_flags);
+		init_blwi(pblwi, ns, ld, cancels, count, lock, cancel_flags);
 
-		return __ldlm_bl_to_thread(blwi, cancel_flags);
-	} else {
-		/* if it is synchronous call do minimum mem alloc, as it could
-		 * be triggered from kernel shrinker
-		 */
-		struct ldlm_bl_work_item blwi;
-
-		memset(&blwi, 0, sizeof(blwi));
-		init_blwi(&blwi, ns, ld, cancels, count, lock, cancel_flags);
-		return __ldlm_bl_to_thread(&blwi, cancel_flags);
+		return __ldlm_bl_to_thread(pblwi, cancel_flags);
 	}
+	/* if it is synchronous call do minimum mem alloc, as it could
+	* be triggered from kernel shrinker
+	*/
+
+	memset(&blwi, 0, sizeof(blwi));
+	init_blwi(&blwi, ns, ld, cancels, count, lock, cancel_flags);
+	return __ldlm_bl_to_thread(&blwi, cancel_flags);
 }
 
 
Signature · 1 line
1.9.1
maintainer
#5 lore raw

Re: [Outreachy kernel] [RESEND PATCH] Staging: lustre: Remove unnecessary else after return

Quoted 9 lines · Haneen Mohammed

This patch fix else is not usefull after break or return. Moves declaration to top addressing compiler warning:
"ISO C90 forbids mixed declarations and code" Rename similar named variable in the function.

---
 drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 28 ++++++++++++-------------
 1 file changed, 13 insertions(+), 15 deletions(-)

What changed from your previous version?

Always be specific, don't let me guess :)