Skip to contentSkip to conversation

Staging: lustre: lustre: ldlm: Fix coding style issues

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

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

cover Staging: lustre: lustre: ldlm: 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

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 1/5 Staging: lustre: lustre: ldlm: 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
#4 lore raw

PATCH 2/5 Staging: lustre: lustre: idlm: 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
#5 lore raw

PATCH 3/5 Staging: lustre: lustre: ldlm: 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
#7 lore raw

PATCH 4/5 Staging: lustre: lustre: ldlm: 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
#9 lore raw

PATCH 5/5 Staging: lustre: lustre: ldlm: 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
#10 lore raw

Re: [Outreachy kernel] [PATCH 5/5] Staging: lustre: lustre: ldlm: Concatenate strings into single string

Quoted 13 lines · 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 +0 -0
index bfdb2b3..0d65d80 100644

drivers/staging/lustre/lustre/ldlm/ldlm_pool.c static int lprocfs_pool_state_seq_show(struct seq_file *m, void *unused) · line 692

Quoted 7 lines
drivers/staging/lustre/lustre/ldlm/ldlm_pool.c +2 -2
@@ -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",

The two lines are consecutive strings also. Checkpatch should have given you a warning on your result.

julia

Quoted 13 lines
drivers/staging/lustre/lustre/ldlm/ldlm_pool.c +0 -1
 		      grant_rate, cancel_rate, grant_speed,
 		      granted, limit);
 
--

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/1425152027-31192-1-git-send-email-hamohammed.sa%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#2 lore raw

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

In reply to Haneen Mohammed

drivers/staging/lustre/lustre/ldlm/ldlm_flock.c ldlm_flock_completion_ast(struct ldlm_lock *lock, __u64 flags, void *data) · line 626

Quoted 3 lines
drivers/staging/lustre/lustre/ldlm/ldlm_flock.c +2 -1
-	LDLM_DEBUG(lock, "client-side enqueue returned a blocked lock, sleeping");
+	LDLM_DEBUG(lock,
+			"client-side enqueue returned a blocked lock, sleeping");

This doesn't look very nice. You could line the string up with the left side of lock.

julia

Quoted 248 lines
drivers/staging/lustre/lustre/ldlm/ldlm_flock.c +0 -0
 	fwd.fwd_lock = lock;
 	obd = class_exp2obd(lock->l_conn_export);
drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +32 -14
index 84b111e..bd8d458 100644
@@ -2229,13 +2229,16 @@ void _ldlm_lock_debug(struct ldlm_lock *lock,
 		libcfs_debug_vmsg2(msgdata, fmt, args,
 				   " ns: \?\? lock: %p/%#llx lrc: %d/%d,%d mode: %s/%s res: \?\? rrc=\?\? type: \?\?\? flags: %#llx nid: %s remote: %#llx expref: %d pid: %u timeout: %lu lvb_type: %d\n",
 				   lock,
-				   lock->l_handle.h_cookie, atomic_read(&lock->l_refc),
+				   lock->l_handle.h_cookie,
+				   atomic_read(&lock->l_refc),
 				   lock->l_readers, lock->l_writers,
 				   ldlm_lockname[lock->l_granted_mode],
 				   ldlm_lockname[lock->l_req_mode],
-				   lock->l_flags, nid, lock->l_remote_handle.cookie,
+				   lock->l_flags, nid,
+				   lock->l_remote_handle.cookie,
 				   exp ? atomic_read(&exp->exp_refcount) : -99,
-				   lock->l_pid, lock->l_callback_timeout, lock->l_lvb_type);
+				   lock->l_pid, lock->l_callback_timeout,
+				   lock->l_lvb_type);
 		va_end(args);
 		return;
 	}
@@ -2243,9 +2246,12 @@ void _ldlm_lock_debug(struct ldlm_lock *lock,
 	switch (resource->lr_type) {
 	case LDLM_EXTENT:
 		libcfs_debug_vmsg2(msgdata, fmt, args,
-				   " ns: %s lock: %p/%#llx lrc: %d/%d,%d mode: %s/%s res: " DLDLMRES " rrc: %d type: %s [%llu->%llu] (req %llu->%llu) flags: %#llx nid: %s remote: %#llx expref: %d pid: %u timeout: %lu lvb_type: %d\n",
+				   " ns: %s lock: %p/%#llx lrc: %d/%d,%d mode: %s/%s res: "
+				   DLDLMRES
+				   " rrc: %d type: %s [%llu->%llu] (req %llu->%llu) flags: %#llx nid: %s remote: %#llx expref: %d pid: %u timeout: %lu lvb_type: %d\n",
 				   ldlm_lock_to_ns_name(lock), lock,
-				   lock->l_handle.h_cookie, atomic_read(&lock->l_refc),
+				   lock->l_handle.h_cookie,
+				   atomic_read(&lock->l_refc),
 				   lock->l_readers, lock->l_writers,
 				   ldlm_lockname[lock->l_granted_mode],
 				   ldlm_lockname[lock->l_req_mode],
@@ -2254,8 +2260,10 @@ void _ldlm_lock_debug(struct ldlm_lock *lock,
 				   ldlm_typename[resource->lr_type],
 				   lock->l_policy_data.l_extent.start,
 				   lock->l_policy_data.l_extent.end,
-				   lock->l_req_extent.start, lock->l_req_extent.end,
-				   lock->l_flags, nid, lock->l_remote_handle.cookie,
+				   lock->l_req_extent.start,
+				   lock->l_req_extent.end,
+				   lock->l_flags, nid,
+				   lock->l_remote_handle.cookie,
 				   exp ? atomic_read(&exp->exp_refcount) : -99,
 				   lock->l_pid, lock->l_callback_timeout,
 				   lock->l_lvb_type);
@@ -2263,9 +2271,12 @@ void _ldlm_lock_debug(struct ldlm_lock *lock,
 
 	case LDLM_FLOCK:
 		libcfs_debug_vmsg2(msgdata, fmt, args,
-				   " ns: %s lock: %p/%#llx lrc: %d/%d,%d mode: %s/%s res: " DLDLMRES " rrc: %d type: %s pid: %d [%llu->%llu] flags: %#llx nid: %s remote: %#llx expref: %d pid: %u timeout: %lu\n",
+				   " ns: %s lock: %p/%#llx lrc: %d/%d,%d mode: %s/%s res: "
+				   DLDLMRES
+				   " rrc: %d type: %s pid: %d [%llu->%llu] flags: %#llx nid: %s remote: %#llx expref: %d pid: %u timeout: %lu\n",
 				   ldlm_lock_to_ns_name(lock), lock,
-				   lock->l_handle.h_cookie, atomic_read(&lock->l_refc),
+				   lock->l_handle.h_cookie,
+				   atomic_read(&lock->l_refc),
 				   lock->l_readers, lock->l_writers,
 				   ldlm_lockname[lock->l_granted_mode],
 				   ldlm_lockname[lock->l_req_mode],
@@ -2275,14 +2286,17 @@ void _ldlm_lock_debug(struct ldlm_lock *lock,
 				   lock->l_policy_data.l_flock.pid,
 				   lock->l_policy_data.l_flock.start,
 				   lock->l_policy_data.l_flock.end,
-				   lock->l_flags, nid, lock->l_remote_handle.cookie,
+				   lock->l_flags, nid,
+				   lock->l_remote_handle.cookie,
 				   exp ? atomic_read(&exp->exp_refcount) : -99,
 				   lock->l_pid, lock->l_callback_timeout);
 		break;
 
 	case LDLM_IBITS:
 		libcfs_debug_vmsg2(msgdata, fmt, args,
-				   " ns: %s lock: %p/%#llx lrc: %d/%d,%d mode: %s/%s res: " DLDLMRES " bits %#llx rrc: %d type: %s flags: %#llx nid: %s remote: %#llx expref: %d pid: %u timeout: %lu lvb_type: %d\n",
+				   " ns: %s lock: %p/%#llx lrc: %d/%d,%d mode: %s/%s res: "
+				   DLDLMRES
+				   " bits %#llx rrc: %d type: %s flags: %#llx nid: %s remote: %#llx expref: %d pid: %u timeout: %lu lvb_type: %d\n",
 				   ldlm_lock_to_ns_name(lock),
 				   lock, lock->l_handle.h_cookie,
 				   atomic_read(&lock->l_refc),
@@ -2293,7 +2307,8 @@ void _ldlm_lock_debug(struct ldlm_lock *lock,
 				   lock->l_policy_data.l_inodebits.bits,
 				   atomic_read(&resource->lr_refcount),
 				   ldlm_typename[resource->lr_type],
-				   lock->l_flags, nid, lock->l_remote_handle.cookie,
+				   lock->l_flags, nid,
+				   lock->l_remote_handle.cookie,
 				   exp ? atomic_read(&exp->exp_refcount) : -99,
 				   lock->l_pid, lock->l_callback_timeout,
 				   lock->l_lvb_type);
@@ -2301,7 +2316,9 @@ void _ldlm_lock_debug(struct ldlm_lock *lock,
 
 	default:
 		libcfs_debug_vmsg2(msgdata, fmt, args,
-				   " ns: %s lock: %p/%#llx lrc: %d/%d,%d mode: %s/%s res: " DLDLMRES " rrc: %d type: %s flags: %#llx nid: %s remote: %#llx expref: %d pid: %u timeout: %lu lvb_type: %d\n",
+				   " ns: %s lock: %p/%#llx lrc: %d/%d,%d mode: %s/%s res: "
+				   DLDLMRES
+				   " rrc: %d type: %s flags: %#llx nid: %s remote: %#llx expref: %d pid: %u timeout: %lu lvb_type: %d\n",
 				   ldlm_lock_to_ns_name(lock),
 				   lock, lock->l_handle.h_cookie,
 				   atomic_read(&lock->l_refc),
@@ -2311,7 +2328,8 @@ void _ldlm_lock_debug(struct ldlm_lock *lock,
 				   PLDLMRES(resource),
 				   atomic_read(&resource->lr_refcount),
 				   ldlm_typename[resource->lr_type],
-				   lock->l_flags, nid, lock->l_remote_handle.cookie,
+				   lock->l_flags,
+				   nid, lock->l_remote_handle.cookie,
 				   exp ? atomic_read(&exp->exp_refcount) : -99,
 				   lock->l_pid, lock->l_callback_timeout,
 				   lock->l_lvb_type);
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 -5
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;
 			}
--

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/1425151043-30881-1-git-send-email-hamohammed.sa%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#11 lore raw

Re: [Outreachy kernel] [PATCH 5/5] Staging: lustre: lustre: ldlm: Concatenate strings into single string

In reply to Julia Lawall
Quoted 26 lines · Julia Lawall
Quoted 13 lines · 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 +0 -0
index bfdb2b3..0d65d80 100644

drivers/staging/lustre/lustre/ldlm/ldlm_pool.c static int lprocfs_pool_state_seq_show(struct seq_file *m, void *unused) · line 692

Quoted 7 lines
drivers/staging/lustre/lustre/ldlm/ldlm_pool.c +2 -2
@@ -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",

The two lines are consecutive strings also. Checkpatch should have given you a warning on your result.

Quoted 2 lines

julia

Strangely it didn't so I thought that was special case. Should I combine them all into one?

Thanks,
Haneen

Quoted 13 lines
Quoted 13 lines
drivers/staging/lustre/lustre/ldlm/ldlm_pool.c +0 -1
 		      grant_rate, cancel_rate, grant_speed,
 		      granted, limit);
 
--

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/1425152027-31192-1-git-send-email-hamohammed.sa%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#12 lore raw

Re: [Outreachy kernel] [PATCH 5/5] Staging: lustre: lustre: ldlm: Concatenate strings into single string

Quoted 27 lines · Haneen Mohammed
Quoted 26 lines · Julia Lawall
Quoted 13 lines · 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 +0 -0
index bfdb2b3..0d65d80 100644

drivers/staging/lustre/lustre/ldlm/ldlm_pool.c static int lprocfs_pool_state_seq_show(struct seq_file *m, void *unused) · line 692

Quoted 7 lines
drivers/staging/lustre/lustre/ldlm/ldlm_pool.c +2 -2
@@ -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",

The two lines are consecutive strings also. Checkpatch should have given you a warning on your result.

Quoted 5 lines
Quoted 2 lines

julia

Strangely it didn't so I thought that was special case. Should I combine them all into one?

OK, maybe it doesn't because of the \n? The idea of combining the strings is so that one can grep for what one sees on a line. But with the \n's that is already the case. So maybe it is OK as is.

julia

Quoted 24 lines

Thanks,
Haneen

Quoted 6 lines
Quoted 6 lines
drivers/staging/lustre/lustre/ldlm/ldlm_pool.c +0 -1
 		      grant_rate, cancel_rate, grant_speed,
 		      granted, limit);
 
--

1.9.1

Quoted 7 lines
Quoted 7 lines

--
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/1425152027-31192-1-git-send-email-hamohammed.sa%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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/20150228200158.GA12813%40example.com.
For more options, visit https://groups.google.com/d/optout.

#3 lore raw

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

In reply to Julia Lawall
Quoted 10 lines · Julia Lawall

drivers/staging/lustre/lustre/ldlm/ldlm_flock.c ldlm_flock_completion_ast(struct ldlm_lock *lock, __u64 flags, void *data) · line 626

Quoted 3 lines
drivers/staging/lustre/lustre/ldlm/ldlm_flock.c +2 -1
-	LDLM_DEBUG(lock, "client-side enqueue returned a blocked lock, sleeping");
+	LDLM_DEBUG(lock,
+			"client-side enqueue returned a blocked lock, sleeping");

This doesn't look very nice. You could line the string up with the left side of lock.

julia

I don't know why, but this is lined right with lock in my editor. why does it change when I send it out?

Thanks,
Haneen

Quoted 248 lines
Quoted 248 lines
drivers/staging/lustre/lustre/ldlm/ldlm_flock.c +0 -0
 	fwd.fwd_lock = lock;
 	obd = class_exp2obd(lock->l_conn_export);
drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +32 -14
index 84b111e..bd8d458 100644
@@ -2229,13 +2229,16 @@ void _ldlm_lock_debug(struct ldlm_lock *lock,
 		libcfs_debug_vmsg2(msgdata, fmt, args,
 				   " ns: \?\? lock: %p/%#llx lrc: %d/%d,%d mode: %s/%s res: \?\? rrc=\?\? type: \?\?\? flags: %#llx nid: %s remote: %#llx expref: %d pid: %u timeout: %lu lvb_type: %d\n",
 				   lock,
-				   lock->l_handle.h_cookie, atomic_read(&lock->l_refc),
+				   lock->l_handle.h_cookie,
+				   atomic_read(&lock->l_refc),
 				   lock->l_readers, lock->l_writers,
 				   ldlm_lockname[lock->l_granted_mode],
 				   ldlm_lockname[lock->l_req_mode],
-				   lock->l_flags, nid, lock->l_remote_handle.cookie,
+				   lock->l_flags, nid,
+				   lock->l_remote_handle.cookie,
 				   exp ? atomic_read(&exp->exp_refcount) : -99,
-				   lock->l_pid, lock->l_callback_timeout, lock->l_lvb_type);
+				   lock->l_pid, lock->l_callback_timeout,
+				   lock->l_lvb_type);
 		va_end(args);
 		return;
 	}
@@ -2243,9 +2246,12 @@ void _ldlm_lock_debug(struct ldlm_lock *lock,
 	switch (resource->lr_type) {
 	case LDLM_EXTENT:
 		libcfs_debug_vmsg2(msgdata, fmt, args,
-				   " ns: %s lock: %p/%#llx lrc: %d/%d,%d mode: %s/%s res: " DLDLMRES " rrc: %d type: %s [%llu->%llu] (req %llu->%llu) flags: %#llx nid: %s remote: %#llx expref: %d pid: %u timeout: %lu lvb_type: %d\n",
+				   " ns: %s lock: %p/%#llx lrc: %d/%d,%d mode: %s/%s res: "
+				   DLDLMRES
+				   " rrc: %d type: %s [%llu->%llu] (req %llu->%llu) flags: %#llx nid: %s remote: %#llx expref: %d pid: %u timeout: %lu lvb_type: %d\n",
 				   ldlm_lock_to_ns_name(lock), lock,
-				   lock->l_handle.h_cookie, atomic_read(&lock->l_refc),
+				   lock->l_handle.h_cookie,
+				   atomic_read(&lock->l_refc),
 				   lock->l_readers, lock->l_writers,
 				   ldlm_lockname[lock->l_granted_mode],
 				   ldlm_lockname[lock->l_req_mode],
@@ -2254,8 +2260,10 @@ void _ldlm_lock_debug(struct ldlm_lock *lock,
 				   ldlm_typename[resource->lr_type],
 				   lock->l_policy_data.l_extent.start,
 				   lock->l_policy_data.l_extent.end,
-				   lock->l_req_extent.start, lock->l_req_extent.end,
-				   lock->l_flags, nid, lock->l_remote_handle.cookie,
+				   lock->l_req_extent.start,
+				   lock->l_req_extent.end,
+				   lock->l_flags, nid,
+				   lock->l_remote_handle.cookie,
 				   exp ? atomic_read(&exp->exp_refcount) : -99,
 				   lock->l_pid, lock->l_callback_timeout,
 				   lock->l_lvb_type);
@@ -2263,9 +2271,12 @@ void _ldlm_lock_debug(struct ldlm_lock *lock,
 
 	case LDLM_FLOCK:
 		libcfs_debug_vmsg2(msgdata, fmt, args,
-				   " ns: %s lock: %p/%#llx lrc: %d/%d,%d mode: %s/%s res: " DLDLMRES " rrc: %d type: %s pid: %d [%llu->%llu] flags: %#llx nid: %s remote: %#llx expref: %d pid: %u timeout: %lu\n",
+				   " ns: %s lock: %p/%#llx lrc: %d/%d,%d mode: %s/%s res: "
+				   DLDLMRES
+				   " rrc: %d type: %s pid: %d [%llu->%llu] flags: %#llx nid: %s remote: %#llx expref: %d pid: %u timeout: %lu\n",
 				   ldlm_lock_to_ns_name(lock), lock,
-				   lock->l_handle.h_cookie, atomic_read(&lock->l_refc),
+				   lock->l_handle.h_cookie,
+				   atomic_read(&lock->l_refc),
 				   lock->l_readers, lock->l_writers,
 				   ldlm_lockname[lock->l_granted_mode],
 				   ldlm_lockname[lock->l_req_mode],
@@ -2275,14 +2286,17 @@ void _ldlm_lock_debug(struct ldlm_lock *lock,
 				   lock->l_policy_data.l_flock.pid,
 				   lock->l_policy_data.l_flock.start,
 				   lock->l_policy_data.l_flock.end,
-				   lock->l_flags, nid, lock->l_remote_handle.cookie,
+				   lock->l_flags, nid,
+				   lock->l_remote_handle.cookie,
 				   exp ? atomic_read(&exp->exp_refcount) : -99,
 				   lock->l_pid, lock->l_callback_timeout);
 		break;
 
 	case LDLM_IBITS:
 		libcfs_debug_vmsg2(msgdata, fmt, args,
-				   " ns: %s lock: %p/%#llx lrc: %d/%d,%d mode: %s/%s res: " DLDLMRES " bits %#llx rrc: %d type: %s flags: %#llx nid: %s remote: %#llx expref: %d pid: %u timeout: %lu lvb_type: %d\n",
+				   " ns: %s lock: %p/%#llx lrc: %d/%d,%d mode: %s/%s res: "
+				   DLDLMRES
+				   " bits %#llx rrc: %d type: %s flags: %#llx nid: %s remote: %#llx expref: %d pid: %u timeout: %lu lvb_type: %d\n",
 				   ldlm_lock_to_ns_name(lock),
 				   lock, lock->l_handle.h_cookie,
 				   atomic_read(&lock->l_refc),
@@ -2293,7 +2307,8 @@ void _ldlm_lock_debug(struct ldlm_lock *lock,
 				   lock->l_policy_data.l_inodebits.bits,
 				   atomic_read(&resource->lr_refcount),
 				   ldlm_typename[resource->lr_type],
-				   lock->l_flags, nid, lock->l_remote_handle.cookie,
+				   lock->l_flags, nid,
+				   lock->l_remote_handle.cookie,
 				   exp ? atomic_read(&exp->exp_refcount) : -99,
 				   lock->l_pid, lock->l_callback_timeout,
 				   lock->l_lvb_type);
@@ -2301,7 +2316,9 @@ void _ldlm_lock_debug(struct ldlm_lock *lock,
 
 	default:
 		libcfs_debug_vmsg2(msgdata, fmt, args,
-				   " ns: %s lock: %p/%#llx lrc: %d/%d,%d mode: %s/%s res: " DLDLMRES " rrc: %d type: %s flags: %#llx nid: %s remote: %#llx expref: %d pid: %u timeout: %lu lvb_type: %d\n",
+				   " ns: %s lock: %p/%#llx lrc: %d/%d,%d mode: %s/%s res: "
+				   DLDLMRES
+				   " rrc: %d type: %s flags: %#llx nid: %s remote: %#llx expref: %d pid: %u timeout: %lu lvb_type: %d\n",
 				   ldlm_lock_to_ns_name(lock),
 				   lock, lock->l_handle.h_cookie,
 				   atomic_read(&lock->l_refc),
@@ -2311,7 +2328,8 @@ void _ldlm_lock_debug(struct ldlm_lock *lock,
 				   PLDLMRES(resource),
 				   atomic_read(&resource->lr_refcount),
 				   ldlm_typename[resource->lr_type],
-				   lock->l_flags, nid, lock->l_remote_handle.cookie,
+				   lock->l_flags,
+				   nid, lock->l_remote_handle.cookie,
 				   exp ? atomic_read(&exp->exp_refcount) : -99,
 				   lock->l_pid, lock->l_callback_timeout,
 				   lock->l_lvb_type);
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 -5
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;
 			}
--

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/1425151043-30881-1-git-send-email-hamohammed.sa%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

maintainer
#6 lore raw

Re: [Outreachy kernel] [PATCH 3/5] Staging: lustre: lustre: ldlm: Fix externs should be avoided in .c

In reply to Haneen Mohammed
Quoted 28 lines · 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 -0
index 3af2687..54e2478 100644

drivers/staging/lustre/lustre/ldlm/ldlm_pool.c line 145

Quoted 5 lines
drivers/staging/lustre/lustre/ldlm/ldlm_pool.c +0 -2
@@ -141,8 +141,6 @@
  */
 #define LDLM_POOL_SLV_SHIFT (10)
 
-extern struct proc_dir_entry *ldlm_ns_proc_dir;
-

This variable isn't used in this file, so this line can just be removed, and the variable make static in the file it is created in, don't make it global.

thanks,

greg k-h

maintainer
#8 lore raw

Re: [Outreachy kernel] [PATCH 4/5] Staging: lustre: lustre: ldlm: Remove unnecessary else after return

In reply to Haneen Mohammed
Quoted 68 lines · 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 +0 -3
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

drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c static int ldlm_bl_to_thread(struct ldlm_namespace *ns, · line 462

Quoted 10 lines
drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c +3 -6
-		 */
-		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
+	*/

Formatting of this comment block changed :(