Skip to contentSkip to conversation

Staging: lustre: Fix coding style issues

PATCH Superseded Haneen Mohammed 2 participants 13 messages Feb 28, 2015 – Mar 2, 2015 Staging

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v2 cover Staging: lustre: Fix coding style issues

This patchset fixes the following coding style issues found by checkpatch.pl:
- Line over 80 charachters.
- Trailing statement should be on next line.
- Extern should be avoided in .c files.
- Else is not useful after return.
- Strings are generally beter as one

Changes in v2:
- Edit subject line.

Haneen Mohammed (5):
Staging: lustre: lustre: ldlm: Fix line over 80
Staging: lustre: lustre: idlm: Move trailing statement to next line
Staging: lustre: lustre: ldlm: Fix externs should be avoided in .c
Staging: lustre: lustre: ldlm: Remove unnecessary else after return
Staging: lustre: lustre: ldlm: Concatenate strings into single string

 drivers/staging/lustre/lustre/ldlm/interval_tree.c |  9 ++--
 drivers/staging/lustre/lustre/ldlm/ldlm_extent.c   |  3 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_flock.c    |  3 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_internal.h |  2 +
 drivers/staging/lustre/lustre/ldlm/ldlm_lib.c      |  4 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_lock.c     | 56 ++++++++++++++--------
 drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c    | 29 ++++++-----
 drivers/staging/lustre/lustre/ldlm/ldlm_pool.c     | 20 ++++----
 drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 12 +++--
 9 files changed, 84 insertions(+), 54 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH v2 1/5 Staging: lustre: Fix line over 80 characters

This patch splits line over 80 characters addressing checkpatch.pl warning.

---
 drivers/staging/lustre/lustre/ldlm/interval_tree.c |  9 +++--
 drivers/staging/lustre/lustre/ldlm/ldlm_flock.c    |  3 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_lock.c     | 46 +++++++++++++++-------
 drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c    | 12 ++++--
 drivers/staging/lustre/lustre/ldlm/ldlm_pool.c     | 11 +++---
 drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 12 ++++--
 6 files changed, 62 insertions(+), 31 deletions(-)
drivers/staging/lustre/lustre/ldlm/interval_tree.c +6 -3
index eab2bd6..1b2bf08 100644
@@ -433,7 +433,8 @@ static void interval_erase_color(struct interval_node *node,
 
 					o_left = tmp->in_left;
 					if (o_left)
-						o_left->in_color = INTERVAL_BLACK;
+						o_left->in_color =
+							INTERVAL_BLACK;
 					tmp->in_color = INTERVAL_RED;
 					__rotate_right(tmp, root);
 					tmp = parent->in_right;
@@ -441,7 +442,8 @@ static void interval_erase_color(struct interval_node *node,
 				tmp->in_color = parent->in_color;
 				parent->in_color = INTERVAL_BLACK;
 				if (tmp->in_right)
-					tmp->in_right->in_color = INTERVAL_BLACK;
+					tmp->in_right->in_color =
+						INTERVAL_BLACK;
 				__rotate_left(parent, root);
 				node = *root;
 				break;
@@ -465,7 +467,8 @@ static void interval_erase_color(struct interval_node *node,
 
 					o_right = tmp->in_right;
 					if (o_right)
-						o_right->in_color = INTERVAL_BLACK;
+						o_right->in_color =
+							INTERVAL_BLACK;
 					tmp->in_color = INTERVAL_RED;
 					__rotate_left(tmp, root);
 					tmp = parent->in_left;
drivers/staging/lustre/lustre/ldlm/ldlm_flock.c +2 -1
index a4c252f..6541c9d 100644
@@ -622,7 +622,8 @@ ldlm_flock_completion_ast(struct ldlm_lock *lock, __u64 flags, void *data)
 		return 0;
 	}
 
-	LDLM_DEBUG(lock, "client-side enqueue returned a blocked lock, sleeping");
+	LDLM_DEBUG(lock,
+			"client-side enqueue returned a blocked lock, sleeping");
 	fwd.fwd_lock = lock;
 	obd = class_exp2obd(lock->l_conn_export);
 
drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +32 -14

106 lines not on this page · raw message

drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c +8 -4
index e0a8157..cd15445 100644
@@ -202,7 +202,8 @@ static void ldlm_handle_cp_callback(struct ptlrpc_request *req,
 
 	lvb_len = req_capsule_get_size(&req->rq_pill, &RMF_DLM_LVB, RCL_CLIENT);
 	if (lvb_len < 0) {
-		LDLM_ERROR(lock, "Fail to get lvb_len, rc = %d", lvb_len);
+		LDLM_ERROR(lock,
+				"Fail to get lvb_len, rc = %d", lvb_len);
 		rc = lvb_len;
 		goto out;
 	} else if (lvb_len > 0) {
@@ -211,7 +212,8 @@ static void ldlm_handle_cp_callback(struct ptlrpc_request *req,
 			LASSERT(lock->l_lvb_data != NULL);
 
 			if (unlikely(lock->l_lvb_len < lvb_len)) {
-				LDLM_ERROR(lock, "Replied LVB is larger than expectation, expected = %d, replied = %d",
+				LDLM_ERROR(lock,
+						"Replied LVB is larger than expectation, expected = %d, replied = %d",
 					   lock->l_lvb_len, lvb_len);
 				rc = -EINVAL;
 				goto out;
@@ -638,7 +640,8 @@ static int ldlm_callback_handler(struct ptlrpc_request *req)
 
 	lock = ldlm_handle2lock_long(&dlm_req->lock_handle[0], 0);
 	if (!lock) {
-		CDEBUG(D_DLMTRACE, "callback on lock %#llx - lock disappeared\n",
+		CDEBUG(D_DLMTRACE,
+				"callback on lock %#llx - lock disappeared\n",
 		       dlm_req->lock_handle[0].cookie);
 		rc = ldlm_callback_reply(req, -EINVAL);
 		ldlm_callback_errmsg(req, "Operate with invalid parameter", rc,
@@ -662,7 +665,8 @@ static int ldlm_callback_handler(struct ptlrpc_request *req)
 		if (((lock->l_flags & LDLM_FL_CANCELING) &&
 		    (lock->l_flags & LDLM_FL_BL_DONE)) ||
 		    (lock->l_flags & LDLM_FL_FAILED)) {
-			LDLM_DEBUG(lock, "callback on lock %#llx - lock disappeared\n",
+			LDLM_DEBUG(lock,
+					"callback on lock %#llx - lock disappeared\n",
 				   dlm_req->lock_handle[0].cookie);
 			unlock_res_and_lock(lock);
 			LDLM_LOCK_RELEASE(lock);
drivers/staging/lustre/lustre/ldlm/ldlm_pool.c +6 -5
index d20d277..3af2687 100644
@@ -605,10 +605,10 @@ int ldlm_pool_recalc(struct ldlm_pool *pl)
 			      pl->pl_recalc_period;
 	if (recalc_interval_sec <= 0) {
 		/* Prevent too frequent recalculation. */
-		CDEBUG(D_DLMTRACE, "Negative interval(%ld), "
-		       "too short period(%ld)",
-		       recalc_interval_sec,
-		       pl->pl_recalc_period);
+		CDEBUG(D_DLMTRACE,
+			"Negative interval(%ld), too short period(%ld)",
+			recalc_interval_sec,
+			pl->pl_recalc_period);
 		recalc_interval_sec = 1;
 	}
 
@@ -634,7 +634,8 @@ int ldlm_pool_shrink(struct ldlm_pool *pl, int nr,
 			lprocfs_counter_add(pl->pl_stats,
 					    LDLM_POOL_SHRINK_FREED_STAT,
 					    cancel);
-			CDEBUG(D_DLMTRACE, "%s: request to shrink %d locks, shrunk %d\n",
+			CDEBUG(D_DLMTRACE,
+					"%s: request to shrink %d locks, shrunk %d\n",
 			       pl->pl_name, nr, cancel);
 		}
 	}
drivers/staging/lustre/lustre/ldlm/ldlm_resource.c +8 -4
index c6f62a9..898f896 100644
@@ -193,7 +193,8 @@ static ssize_t lprocfs_lru_size_seq_write(struct file *file,
 					const char __user *buffer,
 					size_t count, loff_t *off)
 {
-	struct ldlm_namespace *ns = ((struct seq_file *)file->private_data)->private;
+	struct ldlm_namespace *ns =
+		((struct seq_file *)file->private_data)->private;
 	char dummy[MAX_STRING_SIZE + 1];
 	unsigned long tmp;
 	int lru_resize;
@@ -291,7 +292,8 @@ static ssize_t lprocfs_elc_seq_write(struct file *file,
 				const char __user *buffer,
 				size_t count, loff_t *off)
 {
-	struct ldlm_namespace *ns = ((struct seq_file *)file->private_data)->private;
+	struct ldlm_namespace *ns =
+		((struct seq_file *)file->private_data)->private;
 	unsigned int supp = -1;
 	int rc;
 
@@ -738,7 +740,8 @@ static void cleanup_resource(struct ldlm_resource *res, struct list_head *q,
 		} else {
 			ldlm_resource_unlink_lock(lock);
 			unlock_res(res);
-			LDLM_DEBUG(lock, "Freeing a lock still held by a client node");
+			LDLM_DEBUG(lock,
+					"Freeing a lock still held by a client node");
 			ldlm_lock_destroy(lock);
 		}
 		LDLM_LOCK_RELEASE(lock);
@@ -1406,7 +1409,8 @@ void ldlm_resource_dump(int level, struct ldlm_resource *res)
 			LDLM_DEBUG_LIMIT(level, lock, "###");
 			if (!(level & D_CANTMASK) &&
 			    ++granted > ldlm_dump_granted_max) {
-				CDEBUG(level, "only dump %d granted locks to avoid DDOS.\n",
+				CDEBUG(level,
+					"only dump %d granted locks to avoid DDOS.\n",
 				       granted);
 				break;
 			}
Signature · 1 line
1.9.1
#2 lore raw

PATCH v2 2/5 Staging: lustre: Move trailing statement to next line

In reply to Haneen Mohammed

This patch Fix both "trailing statement should be on next line" and space before semicolon errors addressed by checkpatch.pl

---
 drivers/staging/lustre/lustre/ldlm/ldlm_extent.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/lustre/lustre/ldlm/ldlm_extent.c +2 -1
index a89eeba..fd9b059 100644
@@ -151,7 +151,8 @@ static inline int lock_mode_to_index(ldlm_mode_t mode)
 
 	LASSERT(mode != 0);
 	LASSERT(IS_PO2(mode));
-	for (index = -1; mode; index++, mode >>= 1) ;
+	for (index = -1; mode; index++)
+		mode >>= 1;
 	LASSERT(index < LCK_MODE_NUM);
 	return index;
 }
Signature · 1 line
1.9.1
#3 lore raw

PATCH v2 3/5 Staging: lustre: Fix externs should be avoided in .c

In reply to Haneen Mohammed

This patch moves extern declaration to ldlm_internal.h. Remove prototype from ldlm_pool.c.
Issue addressed by checkpatch.pl.

---
 drivers/staging/lustre/lustre/ldlm/ldlm_internal.h | 2 ++
 drivers/staging/lustre/lustre/ldlm/ldlm_pool.c     | 2 --
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/ldlm/ldlm_internal.h +2 -0
index 5bf9488..a694f01 100644
@@ -208,6 +208,8 @@ struct ldlm_state {
 	struct ldlm_bl_pool *ldlm_bl_pool;
 };
 
+/* l_lock.c */
+extern struct proc_dir_entry *ldlm_ns_proc_dir;
 /* interval tree, for LDLM_EXTENT. */
 extern struct kmem_cache *ldlm_interval_slab; /* slab cache for ldlm_interval */
 extern void ldlm_interval_attach(struct ldlm_interval *n, struct ldlm_lock *l);
drivers/staging/lustre/lustre/ldlm/ldlm_pool.c +0 -2
index 3af2687..54e2478 100644
@@ -141,8 +141,6 @@
  */
 #define LDLM_POOL_SLV_SHIFT (10)
 
-extern struct proc_dir_entry *ldlm_ns_proc_dir;
-
 static inline __u64 dru(__u64 val, __u32 shift, int round_up)
 {
 	return (val + (round_up ? (1 << shift) - 1 : 0)) >> shift;
Signature · 1 line
1.9.1
#4 lore raw

PATCH v2 4/5 Staging: lustre: Remove unnecessary else after return

In reply to Haneen Mohammed

This patch fix else is not usefull after break or return. Issue addressed by checkpatch.pl

---
 drivers/staging/lustre/lustre/ldlm/ldlm_lib.c   |  4 ++--
 drivers/staging/lustre/lustre/ldlm/ldlm_lock.c  | 10 +++++-----
 drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 17 ++++++++---------
 drivers/staging/lustre/lustre/ldlm/ldlm_pool.c  |  3 +--
 4 files changed, 16 insertions(+), 18 deletions(-)
drivers/staging/lustre/lustre/ldlm/ldlm_lib.c +2 -2
index c5c86e7..7bcae30 100644
@@ -668,10 +668,10 @@ int target_send_reply_msg(struct ptlrpc_request *req, int rc, int fail_id)
 		DEBUG_REQ(D_NET, req, "processing error (%d)", rc);
 		req->rq_status = rc;
 		return ptlrpc_send_error(req, 1);
-	} else {
-		DEBUG_REQ(D_NET, req, "sending reply");
 	}
 
+	DEBUG_REQ(D_NET, req, "sending reply");
+
 	return ptlrpc_send_reply(req, PTLRPC_REPLY_MAYBE_DIFFICULT);
 }
 
drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +5 -5
index bd8d458..28f2639 100644
@@ -932,7 +932,8 @@ static void search_granted_lock(struct list_head *queue,
 			prev->mode_link = &mode_end->l_sl_mode;
 			prev->policy_link = &req->l_sl_policy;
 			return;
-		} else if (lock->l_resource->lr_type == LDLM_IBITS) {
+		}
+		if (lock->l_resource->lr_type == LDLM_IBITS) {
 			for (;;) {
 				policy_end =
 					list_entry(lock->l_sl_policy.prev,
@@ -968,11 +969,10 @@ static void search_granted_lock(struct list_head *queue,
 			prev->mode_link = &mode_end->l_sl_mode;
 			prev->policy_link = &req->l_sl_policy;
 			return;
-		} else {
-			LDLM_ERROR(lock,
-				   "is not LDLM_PLAIN or LDLM_IBITS lock");
-			LBUG();
 		}
+		LDLM_ERROR(lock,
+				"is not LDLM_PLAIN or LDLM_IBITS lock");
+		LBUG();
 	}
 
 	/* insert point is last lock on the queue,
drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c +8 -9
index cd15445..4abca14 100644
@@ -456,16 +456,15 @@ static int ldlm_bl_to_thread(struct ldlm_namespace *ns,
 		init_blwi(blwi, 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);
 	}
+	/* 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);
 }
 
 
drivers/staging/lustre/lustre/ldlm/ldlm_pool.c +1 -2
index 54e2478..bfdb2b3 100644
@@ -1363,8 +1363,7 @@ static int ldlm_pools_thread_main(void *arg)
 
 		if (thread_test_and_clear_flags(thread, SVC_STOPPING))
 			break;
-		else
-			thread_test_and_clear_flags(thread, SVC_EVENT);
+		thread_test_and_clear_flags(thread, SVC_EVENT);
 	}
 
 	thread_set_flags(thread, SVC_STOPPED);
Signature · 1 line
1.9.1
#5 lore raw

PATCH v2 5/5 Staging: lustre: Concatenate strings into single string

In reply to Haneen Mohammed

This patch concatenate two consecutive strings into one, addressing checkpatch.pl warning:
"Consecutive strings are generally better as a single string"

---
 drivers/staging/lustre/lustre/ldlm/ldlm_pool.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/ldlm/ldlm_pool.c +2 -2
index bfdb2b3..0d65d80 100644
@@ -688,8 +688,8 @@ static int lprocfs_pool_state_seq_show(struct seq_file *m, void *unused)
 			      "  GP:  %d\n",
 			      grant_step, grant_plan);
 	}
-	seq_printf(m, "  GR:  %d\n" "  CR:  %d\n" "  GS:  %d\n"
-		      "  G:   %d\n" "  L:   %d\n",
+	seq_printf(m, "  GR:  %d\n  CR:  %d\n  GS:  %d\n"
+		      "  G:   %d\n  L:   %d\n",
 		      grant_rate, cancel_rate, grant_speed,
 		      granted, limit);
 
Signature · 1 line
1.9.1
#6 lore raw

v3 cover Fix coding style issues

This patchset fixes the following coding style issues found by checkpatch.pl:
- Line over 80 charachters.
- Trailing statement should be on next line.
- Extern should be avoided in .c files.
- Else is not useful after return.
- Strings are generally beter as one

Changes in v3:
- Split [PATCH 4/5] and return one removal of else to original, for it produces compilation warning: mixed declaration and code. better resolve in separate patch.
- Edit subject line appropriately

Changes in v2:
- Edit subject line.

Haneen Mohammed (5):
Staging: lustre: Fix line over 80 characters
Staging: lustre: Move trailing statement to next line
Staging: lustre: Fix externs should be avoided in .c
Staging: lustre: Remove unnecessary else after return
Staging: lustre: Concatenate strings into single string

 drivers/staging/lustre/lustre/ldlm/interval_tree.c |  9 ++--
 drivers/staging/lustre/lustre/ldlm/ldlm_extent.c   |  3 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_flock.c    |  3 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_internal.h |  2 +
 drivers/staging/lustre/lustre/ldlm/ldlm_lib.c      |  4 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_lock.c     | 56 ++++++++++++++--------
 drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c    | 12 +++--
 drivers/staging/lustre/lustre/ldlm/ldlm_pool.c     | 20 ++++----
 drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 12 +++--
 9 files changed, 76 insertions(+), 45 deletions(-)
Signature · 1 line
1.9.1
#7 lore raw

PATCH v3 1/5 Staging: lustre: Fix line over 80 characters

In reply to Haneen Mohammed

This patch splits line over 80 characters addressing checkpatch.pl warning.

---
 drivers/staging/lustre/lustre/ldlm/interval_tree.c |  9 +++--
 drivers/staging/lustre/lustre/ldlm/ldlm_flock.c    |  3 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_lock.c     | 46 +++++++++++++++-------
 drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c    | 12 ++++--
 drivers/staging/lustre/lustre/ldlm/ldlm_pool.c     | 11 +++---
 drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 12 ++++--
 6 files changed, 62 insertions(+), 31 deletions(-)
drivers/staging/lustre/lustre/ldlm/interval_tree.c +6 -3
index eab2bd6..1b2bf08 100644
@@ -433,7 +433,8 @@ static void interval_erase_color(struct interval_node *node,
 
 					o_left = tmp->in_left;
 					if (o_left)
-						o_left->in_color = INTERVAL_BLACK;
+						o_left->in_color =
+							INTERVAL_BLACK;
 					tmp->in_color = INTERVAL_RED;
 					__rotate_right(tmp, root);
 					tmp = parent->in_right;
@@ -441,7 +442,8 @@ static void interval_erase_color(struct interval_node *node,
 				tmp->in_color = parent->in_color;
 				parent->in_color = INTERVAL_BLACK;
 				if (tmp->in_right)
-					tmp->in_right->in_color = INTERVAL_BLACK;
+					tmp->in_right->in_color =
+						INTERVAL_BLACK;
 				__rotate_left(parent, root);
 				node = *root;
 				break;
@@ -465,7 +467,8 @@ static void interval_erase_color(struct interval_node *node,
 
 					o_right = tmp->in_right;
 					if (o_right)
-						o_right->in_color = INTERVAL_BLACK;
+						o_right->in_color =
+							INTERVAL_BLACK;
 					tmp->in_color = INTERVAL_RED;
 					__rotate_left(tmp, root);
 					tmp = parent->in_left;
drivers/staging/lustre/lustre/ldlm/ldlm_flock.c +2 -1
index a4c252f..6541c9d 100644
@@ -622,7 +622,8 @@ ldlm_flock_completion_ast(struct ldlm_lock *lock, __u64 flags, void *data)
 		return 0;
 	}
 
-	LDLM_DEBUG(lock, "client-side enqueue returned a blocked lock, sleeping");
+	LDLM_DEBUG(lock,
+			"client-side enqueue returned a blocked lock, sleeping");
 	fwd.fwd_lock = lock;
 	obd = class_exp2obd(lock->l_conn_export);
 
drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +32 -14

106 lines not on this page · raw message

drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c +8 -4
index e0a8157..cd15445 100644
@@ -202,7 +202,8 @@ static void ldlm_handle_cp_callback(struct ptlrpc_request *req,
 
 	lvb_len = req_capsule_get_size(&req->rq_pill, &RMF_DLM_LVB, RCL_CLIENT);
 	if (lvb_len < 0) {
-		LDLM_ERROR(lock, "Fail to get lvb_len, rc = %d", lvb_len);
+		LDLM_ERROR(lock,
+				"Fail to get lvb_len, rc = %d", lvb_len);
 		rc = lvb_len;
 		goto out;
 	} else if (lvb_len > 0) {
@@ -211,7 +212,8 @@ static void ldlm_handle_cp_callback(struct ptlrpc_request *req,
 			LASSERT(lock->l_lvb_data != NULL);
 
 			if (unlikely(lock->l_lvb_len < lvb_len)) {
-				LDLM_ERROR(lock, "Replied LVB is larger than expectation, expected = %d, replied = %d",
+				LDLM_ERROR(lock,
+						"Replied LVB is larger than expectation, expected = %d, replied = %d",
 					   lock->l_lvb_len, lvb_len);
 				rc = -EINVAL;
 				goto out;
@@ -638,7 +640,8 @@ static int ldlm_callback_handler(struct ptlrpc_request *req)
 
 	lock = ldlm_handle2lock_long(&dlm_req->lock_handle[0], 0);
 	if (!lock) {
-		CDEBUG(D_DLMTRACE, "callback on lock %#llx - lock disappeared\n",
+		CDEBUG(D_DLMTRACE,
+				"callback on lock %#llx - lock disappeared\n",
 		       dlm_req->lock_handle[0].cookie);
 		rc = ldlm_callback_reply(req, -EINVAL);
 		ldlm_callback_errmsg(req, "Operate with invalid parameter", rc,
@@ -662,7 +665,8 @@ static int ldlm_callback_handler(struct ptlrpc_request *req)
 		if (((lock->l_flags & LDLM_FL_CANCELING) &&
 		    (lock->l_flags & LDLM_FL_BL_DONE)) ||
 		    (lock->l_flags & LDLM_FL_FAILED)) {
-			LDLM_DEBUG(lock, "callback on lock %#llx - lock disappeared\n",
+			LDLM_DEBUG(lock,
+					"callback on lock %#llx - lock disappeared\n",
 				   dlm_req->lock_handle[0].cookie);
 			unlock_res_and_lock(lock);
 			LDLM_LOCK_RELEASE(lock);
drivers/staging/lustre/lustre/ldlm/ldlm_pool.c +6 -5
index d20d277..3af2687 100644
@@ -605,10 +605,10 @@ int ldlm_pool_recalc(struct ldlm_pool *pl)
 			      pl->pl_recalc_period;
 	if (recalc_interval_sec <= 0) {
 		/* Prevent too frequent recalculation. */
-		CDEBUG(D_DLMTRACE, "Negative interval(%ld), "
-		       "too short period(%ld)",
-		       recalc_interval_sec,
-		       pl->pl_recalc_period);
+		CDEBUG(D_DLMTRACE,
+			"Negative interval(%ld), too short period(%ld)",
+			recalc_interval_sec,
+			pl->pl_recalc_period);
 		recalc_interval_sec = 1;
 	}
 
@@ -634,7 +634,8 @@ int ldlm_pool_shrink(struct ldlm_pool *pl, int nr,
 			lprocfs_counter_add(pl->pl_stats,
 					    LDLM_POOL_SHRINK_FREED_STAT,
 					    cancel);
-			CDEBUG(D_DLMTRACE, "%s: request to shrink %d locks, shrunk %d\n",
+			CDEBUG(D_DLMTRACE,
+					"%s: request to shrink %d locks, shrunk %d\n",
 			       pl->pl_name, nr, cancel);
 		}
 	}
drivers/staging/lustre/lustre/ldlm/ldlm_resource.c +8 -4
index c6f62a9..898f896 100644
@@ -193,7 +193,8 @@ static ssize_t lprocfs_lru_size_seq_write(struct file *file,
 					const char __user *buffer,
 					size_t count, loff_t *off)
 {
-	struct ldlm_namespace *ns = ((struct seq_file *)file->private_data)->private;
+	struct ldlm_namespace *ns =
+		((struct seq_file *)file->private_data)->private;
 	char dummy[MAX_STRING_SIZE + 1];
 	unsigned long tmp;
 	int lru_resize;
@@ -291,7 +292,8 @@ static ssize_t lprocfs_elc_seq_write(struct file *file,
 				const char __user *buffer,
 				size_t count, loff_t *off)
 {
-	struct ldlm_namespace *ns = ((struct seq_file *)file->private_data)->private;
+	struct ldlm_namespace *ns =
+		((struct seq_file *)file->private_data)->private;
 	unsigned int supp = -1;
 	int rc;
 
@@ -738,7 +740,8 @@ static void cleanup_resource(struct ldlm_resource *res, struct list_head *q,
 		} else {
 			ldlm_resource_unlink_lock(lock);
 			unlock_res(res);
-			LDLM_DEBUG(lock, "Freeing a lock still held by a client node");
+			LDLM_DEBUG(lock,
+					"Freeing a lock still held by a client node");
 			ldlm_lock_destroy(lock);
 		}
 		LDLM_LOCK_RELEASE(lock);
@@ -1406,7 +1409,8 @@ void ldlm_resource_dump(int level, struct ldlm_resource *res)
 			LDLM_DEBUG_LIMIT(level, lock, "###");
 			if (!(level & D_CANTMASK) &&
 			    ++granted > ldlm_dump_granted_max) {
-				CDEBUG(level, "only dump %d granted locks to avoid DDOS.\n",
+				CDEBUG(level,
+					"only dump %d granted locks to avoid DDOS.\n",
 				       granted);
 				break;
 			}
Signature · 1 line
1.9.1
maintainer
#8 lore raw

Re: [Outreachy kernel] [PATCH v3 1/5] Staging: lustre: Fix line over 80 characters

Quoted 18 lines · Haneen Mohammed

This patch splits line over 80 characters addressing checkpatch.pl warning.

---
 drivers/staging/lustre/lustre/ldlm/interval_tree.c |  9 +++--
 drivers/staging/lustre/lustre/ldlm/ldlm_flock.c    |  3 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_lock.c     | 46 +++++++++++++++-------
 drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c    | 12 ++++--
 drivers/staging/lustre/lustre/ldlm/ldlm_pool.c     | 11 +++---
 drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 12 ++++--
 6 files changed, 62 insertions(+), 31 deletions(-)
drivers/staging/lustre/lustre/ldlm/interval_tree.c +0 -0
index eab2bd6..1b2bf08 100644

drivers/staging/lustre/lustre/ldlm/interval_tree.c static void interval_erase_color(struct interval_node *node, · line 437

Quoted 6 lines
drivers/staging/lustre/lustre/ldlm/interval_tree.c +2 -1
@@ -433,7 +433,8 @@ static void interval_erase_color(struct interval_node *node,
 
 					o_left = tmp->in_left;
 					if (o_left)
-						o_left->in_color = INTERVAL_BLACK;
+						o_left->in_color =
+							INTERVAL_BLACK;

This all looks worse now :(

Try reorginizing things to not make this happen.

thanks,

greg k-h

#9 lore raw

PATCH v3 2/5 Staging: lustre: Move trailing statement to next line

In reply to Haneen Mohammed

This patch Fix both "trailing statement should be on next line" and space before semicolon errors addressed by checkpatch.pl

---
 drivers/staging/lustre/lustre/ldlm/ldlm_extent.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/lustre/lustre/ldlm/ldlm_extent.c +2 -1
index a89eeba..fd9b059 100644
@@ -151,7 +151,8 @@ static inline int lock_mode_to_index(ldlm_mode_t mode)
 
 	LASSERT(mode != 0);
 	LASSERT(IS_PO2(mode));
-	for (index = -1; mode; index++, mode >>= 1) ;
+	for (index = -1; mode; index++)
+		mode >>= 1;
 	LASSERT(index < LCK_MODE_NUM);
 	return index;
 }
Signature · 1 line
1.9.1
#10 lore raw

PATCH v3 3/5 Staging: lustre: Fix externs should be avoided in .c

In reply to Haneen Mohammed

This patch moves extern declaration to ldlm_internal.h. Remove prototype from ldlm_pool.c.
Issue addressed by checkpatch.pl.

---
 drivers/staging/lustre/lustre/ldlm/ldlm_internal.h | 2 ++
 drivers/staging/lustre/lustre/ldlm/ldlm_pool.c     | 2 --
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/ldlm/ldlm_internal.h +2 -0
index 5bf9488..a694f01 100644
@@ -208,6 +208,8 @@ struct ldlm_state {
 	struct ldlm_bl_pool *ldlm_bl_pool;
 };
 
+/* l_lock.c */
+extern struct proc_dir_entry *ldlm_ns_proc_dir;
 /* interval tree, for LDLM_EXTENT. */
 extern struct kmem_cache *ldlm_interval_slab; /* slab cache for ldlm_interval */
 extern void ldlm_interval_attach(struct ldlm_interval *n, struct ldlm_lock *l);
drivers/staging/lustre/lustre/ldlm/ldlm_pool.c +0 -2
index 3af2687..54e2478 100644
@@ -141,8 +141,6 @@
  */
 #define LDLM_POOL_SLV_SHIFT (10)
 
-extern struct proc_dir_entry *ldlm_ns_proc_dir;
-
 static inline __u64 dru(__u64 val, __u32 shift, int round_up)
 {
 	return (val + (round_up ? (1 << shift) - 1 : 0)) >> shift;
Signature · 1 line
1.9.1
#11 lore raw

PATCH v3 4/5 Staging: lustre: Remove unnecessary else after return

In reply to Haneen Mohammed

This patch fix else is not useful after break or return. Issue addressed by checkpatch.pl.

---
v3: unmodified the removal of an else statement for it introduces "mixed declaration and code" warning.

 drivers/staging/lustre/lustre/ldlm/ldlm_lib.c  |  4 ++--
 drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 10 +++++-----
 drivers/staging/lustre/lustre/ldlm/ldlm_pool.c |  3 +--
 3 files changed, 8 insertions(+), 9 deletions(-)
drivers/staging/lustre/lustre/ldlm/ldlm_lib.c +2 -2
index c5c86e7..7bcae30 100644
@@ -668,10 +668,10 @@ int target_send_reply_msg(struct ptlrpc_request *req, int rc, int fail_id)
 		DEBUG_REQ(D_NET, req, "processing error (%d)", rc);
 		req->rq_status = rc;
 		return ptlrpc_send_error(req, 1);
-	} else {
-		DEBUG_REQ(D_NET, req, "sending reply");
 	}
 
+	DEBUG_REQ(D_NET, req, "sending reply");
+
 	return ptlrpc_send_reply(req, PTLRPC_REPLY_MAYBE_DIFFICULT);
 }
 
drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +5 -5
index bd8d458..28f2639 100644
@@ -932,7 +932,8 @@ static void search_granted_lock(struct list_head *queue,
 			prev->mode_link = &mode_end->l_sl_mode;
 			prev->policy_link = &req->l_sl_policy;
 			return;
-		} else if (lock->l_resource->lr_type == LDLM_IBITS) {
+		}
+		if (lock->l_resource->lr_type == LDLM_IBITS) {
 			for (;;) {
 				policy_end =
 					list_entry(lock->l_sl_policy.prev,
@@ -968,11 +969,10 @@ static void search_granted_lock(struct list_head *queue,
 			prev->mode_link = &mode_end->l_sl_mode;
 			prev->policy_link = &req->l_sl_policy;
 			return;
-		} else {
-			LDLM_ERROR(lock,
-				   "is not LDLM_PLAIN or LDLM_IBITS lock");
-			LBUG();
 		}
+		LDLM_ERROR(lock,
+				"is not LDLM_PLAIN or LDLM_IBITS lock");
+		LBUG();
 	}
 
 	/* insert point is last lock on the queue,
drivers/staging/lustre/lustre/ldlm/ldlm_pool.c +1 -2
index 54e2478..bfdb2b3 100644
@@ -1363,8 +1363,7 @@ static int ldlm_pools_thread_main(void *arg)
 
 		if (thread_test_and_clear_flags(thread, SVC_STOPPING))
 			break;
-		else
-			thread_test_and_clear_flags(thread, SVC_EVENT);
+		thread_test_and_clear_flags(thread, SVC_EVENT);
 	}
 
 	thread_set_flags(thread, SVC_STOPPED);
Signature · 1 line
1.9.1
#12 lore raw

PATCH v3 5/5 Staging: lustre: Concatenate strings into single string

In reply to Haneen Mohammed

This patch concatenate two consecutive strings into one, addressing checkpatch.pl warning:
"Consecutive strings are generally better as a single string"

---
 drivers/staging/lustre/lustre/ldlm/ldlm_pool.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/ldlm/ldlm_pool.c +2 -2
index bfdb2b3..0d65d80 100644
@@ -688,8 +688,8 @@ static int lprocfs_pool_state_seq_show(struct seq_file *m, void *unused)
 			      "  GP:  %d\n",
 			      grant_step, grant_plan);
 	}
-	seq_printf(m, "  GR:  %d\n" "  CR:  %d\n" "  GS:  %d\n"
-		      "  G:   %d\n" "  L:   %d\n",
+	seq_printf(m, "  GR:  %d\n  CR:  %d\n  GS:  %d\n"
+		      "  G:   %d\n  L:   %d\n",
 		      grant_rate, cancel_rate, grant_speed,
 		      granted, limit);
 
Signature · 1 line
1.9.1