Skip to contentSkip to conversation

Replace printk() with pr_*() and define pr_fmt()

PATCH Superseded Narcisa Ana Maria Vasile 3 participants 12 messages Mar 16, 2017 – Mar 18, 2017 Staging

lore
Share & tools
lore
#0 lore raw

cover Replace printk() with pr_*() and define pr_fmt()

Convert the printk() calls to corresponding pr_*() calls and define pr_fmt() to easily introduce the name of the module.

Narcisa Ana Maria Vasile (2):
staging: lustre: libcfs: Replace printk() with pr_*()
staging: lustre: libcfs: Define pr_fmt() to include relevant name

 drivers/staging/lustre/lnet/libcfs/tracefile.c | 59 ++++++++++++--------------
 1 file changed, 27 insertions(+), 32 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/2 staging: lustre: libcfs: Replace printk() with pr_*()

Convert printk() calls into corresponding pr_*() calls.

---
 drivers/staging/lustre/lnet/libcfs/tracefile.c | 58 ++++++++++++--------------
 1 file changed, 26 insertions(+), 32 deletions(-)
drivers/staging/lustre/lnet/libcfs/tracefile.c +26 -32
index d7b29f8..c70f36e 100644
@@ -192,9 +192,8 @@ int cfs_trace_refill_stock(struct cfs_trace_cpu_data *tcd, gfp_t gfp,
 			if (unlikely(!tage)) {
 				if ((!memory_pressure_get() ||
 				     in_interrupt()) && printk_ratelimit())
-					printk(KERN_WARNING
-					       "cannot allocate a tage (%ld)\n",
-					       tcd->tcd_cur_pages);
+					pr_warn("cannot allocate a tage (%ld)\n",
+						tcd->tcd_cur_pages);
 				return NULL;
 			}
 		}
@@ -230,8 +229,8 @@ static void cfs_tcd_shrink(struct cfs_trace_cpu_data *tcd)
 	 */
 
 	if (printk_ratelimit())
-		printk(KERN_WARNING "debug daemon buffer overflowed; discarding 10%% of pages (%d of %ld)\n",
-		       pgcount + 1, tcd->tcd_cur_pages);
+		pr_warn("debug daemon buffer overflowed; discarding 10%% of pages (%d of %ld)\n",
+			pgcount + 1, tcd->tcd_cur_pages);
 
 	INIT_LIST_HEAD(&pc.pc_pages);
 
@@ -358,8 +357,7 @@ int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata,
 
 		max_nob = PAGE_SIZE - tage->used - known_size;
 		if (max_nob <= 0) {
-			printk(KERN_EMERG "negative max_nob: %d\n",
-			       max_nob);
+			pr_emerg("negative max_nob: %d\n", max_nob);
 			mask |= D_ERROR;
 			cfs_trace_put_tcd(tcd);
 			tcd = NULL;
@@ -389,8 +387,8 @@ int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata,
 	}
 
 	if (*(string_buf + needed - 1) != '\n')
-		printk(KERN_INFO "format at %s:%d:%s doesn't end in newline\n",
-		       file, msgdata->msg_line, msgdata->msg_fn);
+		pr_info("format at %s:%d:%s doesn't end in newline\n", file,
+			msgdata->msg_line, msgdata->msg_fn);
 
 	header.ph_len = known_size + needed;
 	debug_buf = (char *)page_address(tage->page) + tage->used;
@@ -713,8 +711,8 @@ int cfs_tracefile_dump_all_pages(char *filename)
 	if (IS_ERR(filp)) {
 		rc = PTR_ERR(filp);
 		filp = NULL;
-		pr_err("LustreError: can't open %s for dump: rc %d\n",
-		       filename, rc);
+		pr_err("LustreError: can't open %s for dump: rc %d\n", filename,
+		       rc);
 		goto out;
 	}
 
@@ -739,8 +737,8 @@ int cfs_tracefile_dump_all_pages(char *filename)
 		kunmap(tage->page);
 
 		if (rc != (int)tage->used) {
-			printk(KERN_WARNING "wanted to write %u but wrote %d\n",
-			       tage->used, rc);
+			pr_warn("wanted to write %u but wrote %d\n", tage->used,
+				rc);
 			put_pages_back(&pc);
 			__LASSERT(list_empty(&pc.pc_pages));
 			break;
@@ -894,10 +892,9 @@ int cfs_trace_daemon_command(char *str)
 	} else {
 		strcpy(cfs_tracefile, str);
 
-		printk(KERN_INFO
-		       "Lustre: debug daemon will attempt to start writing to %s (%lukB max)\n",
-		       cfs_tracefile,
-		       (long)(cfs_tracefile_size >> 10));
+		pr_info("Lustre: debug daemon will attempt to start writing to %s (%lukB max)\n",
+			cfs_tracefile,
+			(long)(cfs_tracefile_size >> 10));
 
 		cfs_trace_start_thread();
 	}
@@ -933,16 +930,14 @@ int cfs_trace_set_debug_mb(int mb)
 	struct cfs_trace_cpu_data *tcd;
 
 	if (mb < num_possible_cpus()) {
-		printk(KERN_WARNING
-		       "Lustre: %d MB is too small for debug buffer size, setting it to %d MB.\n",
-		       mb, num_possible_cpus());
+		pr_warn("Lustre: %d MB is too small for debug buffer size, setting it to %d MB.\n",
+			mb, num_possible_cpus());
 		mb = num_possible_cpus();
 	}
 
 	if (mb > limit) {
-		printk(KERN_WARNING
-		       "Lustre: %d MB is too large for debug buffer size, setting it to %d MB.\n",
-		       mb, limit);
+		pr_warn("Lustre: %d MB is too large for debug buffer size, setting it to %d MB.\n",
+			mb, limit);
 		mb = limit;
 	}
 
@@ -1010,8 +1005,8 @@ static int tracefiled(void *arg)
 			if (IS_ERR(filp)) {
 				rc = PTR_ERR(filp);
 				filp = NULL;
-				printk(KERN_WARNING "couldn't open %s: %d\n",
-				       cfs_tracefile, rc);
+				pr_warn("couldn't open %s: %d\n", cfs_tracefile,
+					rc);
 			}
 		}
 		cfs_tracefile_read_unlock();
@@ -1039,8 +1034,8 @@ static int tracefiled(void *arg)
 			kunmap(tage->page);
 
 			if (rc != (int)tage->used) {
-				printk(KERN_WARNING "wanted to write %u but wrote %d\n",
-				       tage->used, rc);
+				pr_warn("wanted to write %u but wrote %d\n",
+					tage->used, rc);
 				put_pages_back(&pc);
 				__LASSERT(list_empty(&pc.pc_pages));
 				break;
@@ -1053,7 +1048,7 @@ static int tracefiled(void *arg)
 		if (!list_empty(&pc.pc_pages)) {
 			int i;
 
-			printk(KERN_ALERT "Lustre: trace pages aren't empty\n");
+			pr_alert("Lustre: trace pages aren't empty\n");
 			pr_err("total cpus(%d): ", num_possible_cpus());
 			for (i = 0; i < num_possible_cpus(); i++)
 				if (cpu_online(i))
@@ -1065,8 +1060,8 @@ static int tracefiled(void *arg)
 			i = 0;
 			list_for_each_entry_safe(tage, tmp, &pc.pc_pages,
 						 linkage)
-				pr_err("page %d belongs to cpu %d\n",
-				       ++i, tage->cpu);
+				pr_err("page %d belongs to cpu %d\n", ++i,
+				       tage->cpu);
 			pr_err("There are %d pages unwritten\n", i);
 		}
 		__LASSERT(list_empty(&pc.pc_pages));
@@ -1123,8 +1118,7 @@ void cfs_trace_stop_thread(void)
 
 	mutex_lock(&cfs_trace_thread_mutex);
 	if (thread_running) {
-		printk(KERN_INFO
-		       "Lustre: shutting down debug daemon thread...\n");
+		pr_info("Lustre: shutting down debug daemon thread...\n");
 		atomic_set(&tctl->tctl_shutdown, 1);
 		wait_for_completion(&tctl->tctl_stop);
 		thread_running = 0;
Signature · 1 line
1.9.1
#2 lore raw

Re: [Outreachy kernel] [PATCH 1/2] staging: lustre: libcfs: Replace printk() with pr_*()

Quoted 56 lines · Narcisa Ana Maria Vasile

Convert printk() calls into corresponding pr_*() calls.

---
 drivers/staging/lustre/lnet/libcfs/tracefile.c | 58 ++++++++++++--------------
 1 file changed, 26 insertions(+), 32 deletions(-)
drivers/staging/lustre/lnet/libcfs/tracefile.c +7 -9
index d7b29f8..c70f36e 100644
@@ -192,9 +192,8 @@ int cfs_trace_refill_stock(struct cfs_trace_cpu_data *tcd, gfp_t gfp,
 			if (unlikely(!tage)) {
 				if ((!memory_pressure_get() ||
 				     in_interrupt()) && printk_ratelimit())
-					printk(KERN_WARNING
-					       "cannot allocate a tage (%ld)\n",
-					       tcd->tcd_cur_pages);
+					pr_warn("cannot allocate a tage (%ld)\n",
+						tcd->tcd_cur_pages);
 				return NULL;
 			}
 		}
@@ -230,8 +229,8 @@ static void cfs_tcd_shrink(struct cfs_trace_cpu_data *tcd)
 	 */
 
 	if (printk_ratelimit())
-		printk(KERN_WARNING "debug daemon buffer overflowed; discarding 10%% of pages (%d of %ld)\n",
-		       pgcount + 1, tcd->tcd_cur_pages);
+		pr_warn("debug daemon buffer overflowed; discarding 10%% of pages (%d of %ld)\n",
+			pgcount + 1, tcd->tcd_cur_pages);
 
 	INIT_LIST_HEAD(&pc.pc_pages);
 
@@ -358,8 +357,7 @@ int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata,
 
 		max_nob = PAGE_SIZE - tage->used - known_size;
 		if (max_nob <= 0) {
-			printk(KERN_EMERG "negative max_nob: %d\n",
-			       max_nob);
+			pr_emerg("negative max_nob: %d\n", max_nob);
 			mask |= D_ERROR;
 			cfs_trace_put_tcd(tcd);
 			tcd = NULL;
@@ -389,8 +387,8 @@ int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata,
 	}
 
 	if (*(string_buf + needed - 1) != '\n')
-		printk(KERN_INFO "format at %s:%d:%s doesn't end in newline\n",
-		       file, msgdata->msg_line, msgdata->msg_fn);
+		pr_info("format at %s:%d:%s doesn't end in newline\n", file,
+			msgdata->msg_line, msgdata->msg_fn);
 
 	header.ph_len = known_size + needed;
 	debug_buf = (char *)page_address(tage->page) + tage->used;

drivers/staging/lustre/lnet/libcfs/tracefile.c int cfs_tracefile_dump_all_pages(char *filename) · line 715

Quoted 7 lines
drivers/staging/lustre/lnet/libcfs/tracefile.c +2 -2
@@ -713,8 +711,8 @@ int cfs_tracefile_dump_all_pages(char *filename)
 	if (IS_ERR(filp)) {
 		rc = PTR_ERR(filp);
 		filp = NULL;
-		pr_err("LustreError: can't open %s for dump: rc %d\n",
-		       filename, rc);
+		pr_err("LustreError: can't open %s for dump: rc %d\n", filename,
+		       rc);

This change is not covered by the log message.

julia

Quoted 111 lines
drivers/staging/lustre/lnet/libcfs/tracefile.c +17 -22
 		goto out;
 	}
 
@@ -739,8 +737,8 @@ int cfs_tracefile_dump_all_pages(char *filename)
 		kunmap(tage->page);
 
 		if (rc != (int)tage->used) {
-			printk(KERN_WARNING "wanted to write %u but wrote %d\n",
-			       tage->used, rc);
+			pr_warn("wanted to write %u but wrote %d\n", tage->used,
+				rc);
 			put_pages_back(&pc);
 			__LASSERT(list_empty(&pc.pc_pages));
 			break;
@@ -894,10 +892,9 @@ int cfs_trace_daemon_command(char *str)
 	} else {
 		strcpy(cfs_tracefile, str);
 
-		printk(KERN_INFO
-		       "Lustre: debug daemon will attempt to start writing to %s (%lukB max)\n",
-		       cfs_tracefile,
-		       (long)(cfs_tracefile_size >> 10));
+		pr_info("Lustre: debug daemon will attempt to start writing to %s (%lukB max)\n",
+			cfs_tracefile,
+			(long)(cfs_tracefile_size >> 10));
 
 		cfs_trace_start_thread();
 	}
@@ -933,16 +930,14 @@ int cfs_trace_set_debug_mb(int mb)
 	struct cfs_trace_cpu_data *tcd;
 
 	if (mb < num_possible_cpus()) {
-		printk(KERN_WARNING
-		       "Lustre: %d MB is too small for debug buffer size, setting it to %d MB.\n",
-		       mb, num_possible_cpus());
+		pr_warn("Lustre: %d MB is too small for debug buffer size, setting it to %d MB.\n",
+			mb, num_possible_cpus());
 		mb = num_possible_cpus();
 	}
 
 	if (mb > limit) {
-		printk(KERN_WARNING
-		       "Lustre: %d MB is too large for debug buffer size, setting it to %d MB.\n",
-		       mb, limit);
+		pr_warn("Lustre: %d MB is too large for debug buffer size, setting it to %d MB.\n",
+			mb, limit);
 		mb = limit;
 	}
 
@@ -1010,8 +1005,8 @@ static int tracefiled(void *arg)
 			if (IS_ERR(filp)) {
 				rc = PTR_ERR(filp);
 				filp = NULL;
-				printk(KERN_WARNING "couldn't open %s: %d\n",
-				       cfs_tracefile, rc);
+				pr_warn("couldn't open %s: %d\n", cfs_tracefile,
+					rc);
 			}
 		}
 		cfs_tracefile_read_unlock();
@@ -1039,8 +1034,8 @@ static int tracefiled(void *arg)
 			kunmap(tage->page);
 
 			if (rc != (int)tage->used) {
-				printk(KERN_WARNING "wanted to write %u but wrote %d\n",
-				       tage->used, rc);
+				pr_warn("wanted to write %u but wrote %d\n",
+					tage->used, rc);
 				put_pages_back(&pc);
 				__LASSERT(list_empty(&pc.pc_pages));
 				break;
@@ -1053,7 +1048,7 @@ static int tracefiled(void *arg)
 		if (!list_empty(&pc.pc_pages)) {
 			int i;
 
-			printk(KERN_ALERT "Lustre: trace pages aren't empty\n");
+			pr_alert("Lustre: trace pages aren't empty\n");
 			pr_err("total cpus(%d): ", num_possible_cpus());
 			for (i = 0; i < num_possible_cpus(); i++)
 				if (cpu_online(i))
@@ -1065,8 +1060,8 @@ static int tracefiled(void *arg)
 			i = 0;
 			list_for_each_entry_safe(tage, tmp, &pc.pc_pages,
 						 linkage)
-				pr_err("page %d belongs to cpu %d\n",
-				       ++i, tage->cpu);
+				pr_err("page %d belongs to cpu %d\n", ++i,
+				       tage->cpu);
 			pr_err("There are %d pages unwritten\n", i);
 		}
 		__LASSERT(list_empty(&pc.pc_pages));
@@ -1123,8 +1118,7 @@ void cfs_trace_stop_thread(void)
 
 	mutex_lock(&cfs_trace_thread_mutex);
 	if (thread_running) {
-		printk(KERN_INFO
-		       "Lustre: shutting down debug daemon thread...\n");
+		pr_info("Lustre: shutting down debug daemon thread...\n");
 		atomic_set(&tctl->tctl_shutdown, 1);
 		wait_for_completion(&tctl->tctl_stop);
 		thread_running = 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/3c4911bf09b417670534bd51af9daa60bf2a3329.1489686964.git.narcisaanamaria12%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#3 lore raw

Re: [Outreachy kernel] [PATCH 1/2] staging: lustre: libcfs: Replace printk() with pr_*()

Quoted 70 lines · Julia Lawall
Quoted 56 lines · Narcisa Ana Maria Vasile

Convert printk() calls into corresponding pr_*() calls.

---
 drivers/staging/lustre/lnet/libcfs/tracefile.c | 58 ++++++++++++--------------
 1 file changed, 26 insertions(+), 32 deletions(-)
drivers/staging/lustre/lnet/libcfs/tracefile.c +7 -9
index d7b29f8..c70f36e 100644
@@ -192,9 +192,8 @@ int cfs_trace_refill_stock(struct cfs_trace_cpu_data *tcd, gfp_t gfp,
 			if (unlikely(!tage)) {
 				if ((!memory_pressure_get() ||
 				     in_interrupt()) && printk_ratelimit())
-					printk(KERN_WARNING
-					       "cannot allocate a tage (%ld)\n",
-					       tcd->tcd_cur_pages);
+					pr_warn("cannot allocate a tage (%ld)\n",
+						tcd->tcd_cur_pages);
 				return NULL;
 			}
 		}
@@ -230,8 +229,8 @@ static void cfs_tcd_shrink(struct cfs_trace_cpu_data *tcd)
 	 */
 
 	if (printk_ratelimit())
-		printk(KERN_WARNING "debug daemon buffer overflowed; discarding 10%% of pages (%d of %ld)\n",
-		       pgcount + 1, tcd->tcd_cur_pages);
+		pr_warn("debug daemon buffer overflowed; discarding 10%% of pages (%d of %ld)\n",
+			pgcount + 1, tcd->tcd_cur_pages);
 
 	INIT_LIST_HEAD(&pc.pc_pages);
 
@@ -358,8 +357,7 @@ int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata,
 
 		max_nob = PAGE_SIZE - tage->used - known_size;
 		if (max_nob <= 0) {
-			printk(KERN_EMERG "negative max_nob: %d\n",
-			       max_nob);
+			pr_emerg("negative max_nob: %d\n", max_nob);
 			mask |= D_ERROR;
 			cfs_trace_put_tcd(tcd);
 			tcd = NULL;
@@ -389,8 +387,8 @@ int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata,
 	}
 
 	if (*(string_buf + needed - 1) != '\n')
-		printk(KERN_INFO "format at %s:%d:%s doesn't end in newline\n",
-		       file, msgdata->msg_line, msgdata->msg_fn);
+		pr_info("format at %s:%d:%s doesn't end in newline\n", file,
+			msgdata->msg_line, msgdata->msg_fn);
 
 	header.ph_len = known_size + needed;
 	debug_buf = (char *)page_address(tage->page) + tage->used;

drivers/staging/lustre/lnet/libcfs/tracefile.c int cfs_tracefile_dump_all_pages(char *filename) · line 715

Quoted 7 lines
drivers/staging/lustre/lnet/libcfs/tracefile.c +2 -2
@@ -713,8 +711,8 @@ int cfs_tracefile_dump_all_pages(char *filename)
 	if (IS_ERR(filp)) {
 		rc = PTR_ERR(filp);
 		filp = NULL;
-		pr_err("LustreError: can't open %s for dump: rc %d\n",
-		       filename, rc);
+		pr_err("LustreError: can't open %s for dump: rc %d\n", filename,
+		       rc);

This change is not covered by the log message.

Quoted 2 lines

julia

Sorry about this, I thought this was one of the places where I've made a replacement. I'll remove this from this patch.

Narcisa

Quoted 112 lines
Quoted 112 lines
drivers/staging/lustre/lnet/libcfs/tracefile.c +17 -22
 		goto out;
 	}
 
@@ -739,8 +737,8 @@ int cfs_tracefile_dump_all_pages(char *filename)
 		kunmap(tage->page);
 
 		if (rc != (int)tage->used) {
-			printk(KERN_WARNING "wanted to write %u but wrote %d\n",
-			       tage->used, rc);
+			pr_warn("wanted to write %u but wrote %d\n", tage->used,
+				rc);
 			put_pages_back(&pc);
 			__LASSERT(list_empty(&pc.pc_pages));
 			break;
@@ -894,10 +892,9 @@ int cfs_trace_daemon_command(char *str)
 	} else {
 		strcpy(cfs_tracefile, str);
 
-		printk(KERN_INFO
-		       "Lustre: debug daemon will attempt to start writing to %s (%lukB max)\n",
-		       cfs_tracefile,
-		       (long)(cfs_tracefile_size >> 10));
+		pr_info("Lustre: debug daemon will attempt to start writing to %s (%lukB max)\n",
+			cfs_tracefile,
+			(long)(cfs_tracefile_size >> 10));
 
 		cfs_trace_start_thread();
 	}
@@ -933,16 +930,14 @@ int cfs_trace_set_debug_mb(int mb)
 	struct cfs_trace_cpu_data *tcd;
 
 	if (mb < num_possible_cpus()) {
-		printk(KERN_WARNING
-		       "Lustre: %d MB is too small for debug buffer size, setting it to %d MB.\n",
-		       mb, num_possible_cpus());
+		pr_warn("Lustre: %d MB is too small for debug buffer size, setting it to %d MB.\n",
+			mb, num_possible_cpus());
 		mb = num_possible_cpus();
 	}
 
 	if (mb > limit) {
-		printk(KERN_WARNING
-		       "Lustre: %d MB is too large for debug buffer size, setting it to %d MB.\n",
-		       mb, limit);
+		pr_warn("Lustre: %d MB is too large for debug buffer size, setting it to %d MB.\n",
+			mb, limit);
 		mb = limit;
 	}
 
@@ -1010,8 +1005,8 @@ static int tracefiled(void *arg)
 			if (IS_ERR(filp)) {
 				rc = PTR_ERR(filp);
 				filp = NULL;
-				printk(KERN_WARNING "couldn't open %s: %d\n",
-				       cfs_tracefile, rc);
+				pr_warn("couldn't open %s: %d\n", cfs_tracefile,
+					rc);
 			}
 		}
 		cfs_tracefile_read_unlock();
@@ -1039,8 +1034,8 @@ static int tracefiled(void *arg)
 			kunmap(tage->page);
 
 			if (rc != (int)tage->used) {
-				printk(KERN_WARNING "wanted to write %u but wrote %d\n",
-				       tage->used, rc);
+				pr_warn("wanted to write %u but wrote %d\n",
+					tage->used, rc);
 				put_pages_back(&pc);
 				__LASSERT(list_empty(&pc.pc_pages));
 				break;
@@ -1053,7 +1048,7 @@ static int tracefiled(void *arg)
 		if (!list_empty(&pc.pc_pages)) {
 			int i;
 
-			printk(KERN_ALERT "Lustre: trace pages aren't empty\n");
+			pr_alert("Lustre: trace pages aren't empty\n");
 			pr_err("total cpus(%d): ", num_possible_cpus());
 			for (i = 0; i < num_possible_cpus(); i++)
 				if (cpu_online(i))
@@ -1065,8 +1060,8 @@ static int tracefiled(void *arg)
 			i = 0;
 			list_for_each_entry_safe(tage, tmp, &pc.pc_pages,
 						 linkage)
-				pr_err("page %d belongs to cpu %d\n",
-				       ++i, tage->cpu);
+				pr_err("page %d belongs to cpu %d\n", ++i,
+				       tage->cpu);
 			pr_err("There are %d pages unwritten\n", i);
 		}
 		__LASSERT(list_empty(&pc.pc_pages));
@@ -1123,8 +1118,7 @@ void cfs_trace_stop_thread(void)
 
 	mutex_lock(&cfs_trace_thread_mutex);
 	if (thread_running) {
-		printk(KERN_INFO
-		       "Lustre: shutting down debug daemon thread...\n");
+		pr_info("Lustre: shutting down debug daemon thread...\n");
 		atomic_set(&tctl->tctl_shutdown, 1);
 		wait_for_completion(&tctl->tctl_stop);
 		thread_running = 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/3c4911bf09b417670534bd51af9daa60bf2a3329.1489686964.git.narcisaanamaria12%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#4 lore raw

PATCH 2/2 staging: lustre: libcfs: Define pr_fmt() to include relevant name

In reply to Narcisa Ana Maria Vasile

Define a pr_fmt() for tracefile.c
Remove redundant prefix 'Lustre' from pr_*() calls.

---
 drivers/staging/lustre/lnet/libcfs/tracefile.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/staging/lustre/lnet/libcfs/tracefile.c +7 -6
index c70f36e..72fd0c5 100644
@@ -37,6 +37,7 @@
 
 #define DEBUG_SUBSYSTEM S_LNET
 #define LUSTRE_TRACEFILE_PRIVATE
+#define pr_fmt(fmt) "Lustre: " fmt
 #include "tracefile.h"
 
 #include "../../include/linux/libcfs/libcfs.h"
@@ -711,7 +712,7 @@ int cfs_tracefile_dump_all_pages(char *filename)
 	if (IS_ERR(filp)) {
 		rc = PTR_ERR(filp);
 		filp = NULL;
-		pr_err("LustreError: can't open %s for dump: rc %d\n", filename,
+		pr_err("Error: can't open %s for dump: rc %d\n", filename,
 		       rc);
 		goto out;
 	}
@@ -892,7 +893,7 @@ int cfs_trace_daemon_command(char *str)
 	} else {
 		strcpy(cfs_tracefile, str);
 
-		pr_info("Lustre: debug daemon will attempt to start writing to %s (%lukB max)\n",
+		pr_info("debug daemon will attempt to start writing to %s (%lukB max)\n",
 			cfs_tracefile,
 			(long)(cfs_tracefile_size >> 10));
 
@@ -930,13 +931,13 @@ int cfs_trace_set_debug_mb(int mb)
 	struct cfs_trace_cpu_data *tcd;
 
 	if (mb < num_possible_cpus()) {
-		pr_warn("Lustre: %d MB is too small for debug buffer size, setting it to %d MB.\n",
+		pr_warn("%d MB is too small for debug buffer size, setting it to %d MB.\n",
 			mb, num_possible_cpus());
 		mb = num_possible_cpus();
 	}
 
 	if (mb > limit) {
-		pr_warn("Lustre: %d MB is too large for debug buffer size, setting it to %d MB.\n",
+		pr_warn("%d MB is too large for debug buffer size, setting it to %d MB.\n",
 			mb, limit);
 		mb = limit;
 	}
@@ -1048,7 +1049,7 @@ static int tracefiled(void *arg)
 		if (!list_empty(&pc.pc_pages)) {
 			int i;
 
-			pr_alert("Lustre: trace pages aren't empty\n");
+			pr_alert("trace pages aren't empty\n");
 			pr_err("total cpus(%d): ", num_possible_cpus());
 			for (i = 0; i < num_possible_cpus(); i++)
 				if (cpu_online(i))
@@ -1118,7 +1119,7 @@ void cfs_trace_stop_thread(void)
 
 	mutex_lock(&cfs_trace_thread_mutex);
 	if (thread_running) {
-		pr_info("Lustre: shutting down debug daemon thread...\n");
+		pr_info("shutting down debug daemon thread...\n");
 		atomic_set(&tctl->tctl_shutdown, 1);
 		wait_for_completion(&tctl->tctl_stop);
 		thread_running = 0;
Signature · 1 line
1.9.1
#5 lore raw

Re: [Outreachy kernel] [PATCH 2/2] staging: lustre: libcfs: Define pr_fmt() to include relevant name

Quoted 21 lines · Narcisa Ana Maria Vasile

Define a pr_fmt() for tracefile.c
Remove redundant prefix 'Lustre' from pr_*() calls.

---
 drivers/staging/lustre/lnet/libcfs/tracefile.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/staging/lustre/lnet/libcfs/tracefile.c +1 -0
index c70f36e..72fd0c5 100644
@@ -37,6 +37,7 @@
 
 #define DEBUG_SUBSYSTEM S_LNET
 #define LUSTRE_TRACEFILE_PRIVATE
+#define pr_fmt(fmt) "Lustre: " fmt
 #include "tracefile.h"
 
 #include "../../include/linux/libcfs/libcfs.h"

drivers/staging/lustre/lnet/libcfs/tracefile.c int cfs_tracefile_dump_all_pages(char *filename) · line 716

Quoted 6 lines
drivers/staging/lustre/lnet/libcfs/tracefile.c +1 -1
@@ -711,7 +712,7 @@ int cfs_tracefile_dump_all_pages(char *filename)
 	if (IS_ERR(filp)) {
 		rc = PTR_ERR(filp);
 		filp = NULL;
-		pr_err("LustreError: can't open %s for dump: rc %d\n", filename,
+		pr_err("Error: can't open %s for dump: rc %d\n", filename,
 		       rc);

Maybe you don't really need the word Error. It is not so common in pr_err calls.

julia

Quoted 55 lines
drivers/staging/lustre/lnet/libcfs/tracefile.c +5 -6
 		goto out;
 	}
@@ -892,7 +893,7 @@ int cfs_trace_daemon_command(char *str)
 	} else {
 		strcpy(cfs_tracefile, str);
 
-		pr_info("Lustre: debug daemon will attempt to start writing to %s (%lukB max)\n",
+		pr_info("debug daemon will attempt to start writing to %s (%lukB max)\n",
 			cfs_tracefile,
 			(long)(cfs_tracefile_size >> 10));
 
@@ -930,13 +931,13 @@ int cfs_trace_set_debug_mb(int mb)
 	struct cfs_trace_cpu_data *tcd;
 
 	if (mb < num_possible_cpus()) {
-		pr_warn("Lustre: %d MB is too small for debug buffer size, setting it to %d MB.\n",
+		pr_warn("%d MB is too small for debug buffer size, setting it to %d MB.\n",
 			mb, num_possible_cpus());
 		mb = num_possible_cpus();
 	}
 
 	if (mb > limit) {
-		pr_warn("Lustre: %d MB is too large for debug buffer size, setting it to %d MB.\n",
+		pr_warn("%d MB is too large for debug buffer size, setting it to %d MB.\n",
 			mb, limit);
 		mb = limit;
 	}
@@ -1048,7 +1049,7 @@ static int tracefiled(void *arg)
 		if (!list_empty(&pc.pc_pages)) {
 			int i;
 
-			pr_alert("Lustre: trace pages aren't empty\n");
+			pr_alert("trace pages aren't empty\n");
 			pr_err("total cpus(%d): ", num_possible_cpus());
 			for (i = 0; i < num_possible_cpus(); i++)
 				if (cpu_online(i))
@@ -1118,7 +1119,7 @@ void cfs_trace_stop_thread(void)
 
 	mutex_lock(&cfs_trace_thread_mutex);
 	if (thread_running) {
-		pr_info("Lustre: shutting down debug daemon thread...\n");
+		pr_info("shutting down debug daemon thread...\n");
 		atomic_set(&tctl->tctl_shutdown, 1);
 		wait_for_completion(&tctl->tctl_stop);
 		thread_running = 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/c9dc3ba5eb0d36a8ac8bef36d007d9715075af5b.1489686964.git.narcisaanamaria12%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#6 lore raw

Re: [Outreachy kernel] [PATCH 2/2] staging: lustre: libcfs: Define pr_fmt() to include relevant name

Quoted 23 lines · Julia Lawall
Quoted 19 lines · Narcisa Ana Maria Vasile

Define a pr_fmt() for tracefile.c
Remove redundant prefix 'Lustre' from pr_*() calls.

---
drivers/staging/lustre/lnet/libcfs/tracefile.c | 13 +++++++------

1 file changed, 7 insertions(+), 6 deletions(-)
drivers/staging/lustre/lnet/libcfs/tracefile.c +1 -0
index c70f36e..72fd0c5 100644
@@ -37,6 +37,7 @@
 
 #define DEBUG_SUBSYSTEM S_LNET
 #define LUSTRE_TRACEFILE_PRIVATE
+#define pr_fmt(fmt) "Lustre: " fmt
 #include "tracefile.h"
 
Quoted 11 lines

drivers/staging/lustre/lnet/libcfs/tracefile.c int cfs_tracefile_dump_all_pages(char *filename) · line 716

Quoted 8 lines
drivers/staging/lustre/lnet/libcfs/tracefile.c +1 -1
 #include "../../include/linux/libcfs/libcfs.h"
@@ -711,7 +712,7 @@ int cfs_tracefile_dump_all_pages(char *filename)
 	if (IS_ERR(filp)) {
 		rc = PTR_ERR(filp);
 		filp = NULL;
-		pr_err("LustreError: can't open %s for dump: rc %d\n", filename,
+		pr_err("Error: can't open %s for dump: rc %d\n", filename,
 		       rc);

Maybe you don't really need the word Error. It is not so common in pr_err calls.

In a way it does make one's life easier.
Typically when examining a log from a bugreport, first thing I do is search for "LustreError" in it.
I guess I can search for just Lustre too, but that tends to hit a bunch of false positives esp. if it's a long syslog with all sorts of other messages intermixed.

Quoted 58 lines

julia

Quoted 55 lines
drivers/staging/lustre/lnet/libcfs/tracefile.c +5 -6
 		goto out;
 	}
@@ -892,7 +893,7 @@ int cfs_trace_daemon_command(char *str)
 	} else {
 		strcpy(cfs_tracefile, str);
 
-		pr_info("Lustre: debug daemon will attempt to start writing to %s (%lukB max)\n",
+		pr_info("debug daemon will attempt to start writing to %s (%lukB max)\n",
 			cfs_tracefile,
 			(long)(cfs_tracefile_size >> 10));
 
@@ -930,13 +931,13 @@ int cfs_trace_set_debug_mb(int mb)
 	struct cfs_trace_cpu_data *tcd;
 
 	if (mb < num_possible_cpus()) {
-		pr_warn("Lustre: %d MB is too small for debug buffer size, setting it to %d MB.\n",
+		pr_warn("%d MB is too small for debug buffer size, setting it to %d MB.\n",
 			mb, num_possible_cpus());
 		mb = num_possible_cpus();
 	}
 
 	if (mb > limit) {
-		pr_warn("Lustre: %d MB is too large for debug buffer size, setting it to %d MB.\n",
+		pr_warn("%d MB is too large for debug buffer size, setting it to %d MB.\n",
 			mb, limit);
 		mb = limit;
 	}
@@ -1048,7 +1049,7 @@ static int tracefiled(void *arg)
 		if (!list_empty(&pc.pc_pages)) {
 			int i;
 
-			pr_alert("Lustre: trace pages aren't empty\n");
+			pr_alert("trace pages aren't empty\n");
 			pr_err("total cpus(%d): ", num_possible_cpus());
 			for (i = 0; i < num_possible_cpus(); i++)
 				if (cpu_online(i))
@@ -1118,7 +1119,7 @@ void cfs_trace_stop_thread(void)
 
 	mutex_lock(&cfs_trace_thread_mutex);
 	if (thread_running) {
-		pr_info("Lustre: shutting down debug daemon thread...\n");
+		pr_info("shutting down debug daemon thread...\n");
 		atomic_set(&tctl->tctl_shutdown, 1);
 		wait_for_completion(&tctl->tctl_stop);
 		thread_running = 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/c9dc3ba5eb0d36a8ac8bef36d007d9715075af5b.1489686964.git.narcisaanamaria12%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#7 lore raw

Re: [Outreachy kernel] [PATCH 2/2] staging: lustre: libcfs: Define pr_fmt() to include relevant name

Quoted 38 lines · Oleg Drokin
Quoted 23 lines · Julia Lawall
Quoted 19 lines · Narcisa Ana Maria Vasile

Define a pr_fmt() for tracefile.c
Remove redundant prefix 'Lustre' from pr_*() calls.

---
drivers/staging/lustre/lnet/libcfs/tracefile.c | 13 +++++++------

1 file changed, 7 insertions(+), 6 deletions(-)
drivers/staging/lustre/lnet/libcfs/tracefile.c +1 -0
index c70f36e..72fd0c5 100644
@@ -37,6 +37,7 @@
 
 #define DEBUG_SUBSYSTEM S_LNET
 #define LUSTRE_TRACEFILE_PRIVATE
+#define pr_fmt(fmt) "Lustre: " fmt
 #include "tracefile.h"
 
Quoted 11 lines

drivers/staging/lustre/lnet/libcfs/tracefile.c int cfs_tracefile_dump_all_pages(char *filename) · line 716

Quoted 8 lines
drivers/staging/lustre/lnet/libcfs/tracefile.c +1 -1
 #include "../../include/linux/libcfs/libcfs.h"
@@ -711,7 +712,7 @@ int cfs_tracefile_dump_all_pages(char *filename)
 	if (IS_ERR(filp)) {
 		rc = PTR_ERR(filp);
 		filp = NULL;
-		pr_err("LustreError: can't open %s for dump: rc %d\n", filename,
+		pr_err("Error: can't open %s for dump: rc %d\n", filename,
 		       rc);

Maybe you don't really need the word Error. It is not so common in pr_err calls.

Quoted 6 lines

In a way it does make one's life easier.
Typically when examining a log from a bugreport, first thing I do is search for "LustreError" in it.
I guess I can search for just Lustre too, but that tends to hit a bunch of false positives esp. if it's a long syslog with all sorts of other messages intermixed.

Taking this into consideration, I'm thinking I should keep 'LustreError' just like it was, even though it will cause a little redundancy with the preceding 'Lustre: ' word, in order to make search faster in case of examining bugreports. In the version that it is now (Lustre: Error:) it might not be so helpful, since people are used to search for 'LustreError' instead.
Do you think this is a good idea?

Narcisa

Quoted 59 lines
Quoted 58 lines

julia

Quoted 55 lines
drivers/staging/lustre/lnet/libcfs/tracefile.c +5 -6
 		goto out;
 	}
@@ -892,7 +893,7 @@ int cfs_trace_daemon_command(char *str)
 	} else {
 		strcpy(cfs_tracefile, str);
 
-		pr_info("Lustre: debug daemon will attempt to start writing to %s (%lukB max)\n",
+		pr_info("debug daemon will attempt to start writing to %s (%lukB max)\n",
 			cfs_tracefile,
 			(long)(cfs_tracefile_size >> 10));
 
@@ -930,13 +931,13 @@ int cfs_trace_set_debug_mb(int mb)
 	struct cfs_trace_cpu_data *tcd;
 
 	if (mb < num_possible_cpus()) {
-		pr_warn("Lustre: %d MB is too small for debug buffer size, setting it to %d MB.\n",
+		pr_warn("%d MB is too small for debug buffer size, setting it to %d MB.\n",
 			mb, num_possible_cpus());
 		mb = num_possible_cpus();
 	}
 
 	if (mb > limit) {
-		pr_warn("Lustre: %d MB is too large for debug buffer size, setting it to %d MB.\n",
+		pr_warn("%d MB is too large for debug buffer size, setting it to %d MB.\n",
 			mb, limit);
 		mb = limit;
 	}
@@ -1048,7 +1049,7 @@ static int tracefiled(void *arg)
 		if (!list_empty(&pc.pc_pages)) {
 			int i;
 
-			pr_alert("Lustre: trace pages aren't empty\n");
+			pr_alert("trace pages aren't empty\n");
 			pr_err("total cpus(%d): ", num_possible_cpus());
 			for (i = 0; i < num_possible_cpus(); i++)
 				if (cpu_online(i))
@@ -1118,7 +1119,7 @@ void cfs_trace_stop_thread(void)
 
 	mutex_lock(&cfs_trace_thread_mutex);
 	if (thread_running) {
-		pr_info("Lustre: shutting down debug daemon thread...\n");
+		pr_info("shutting down debug daemon thread...\n");
 		atomic_set(&tctl->tctl_shutdown, 1);
 		wait_for_completion(&tctl->tctl_stop);
 		thread_running = 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/c9dc3ba5eb0d36a8ac8bef36d007d9715075af5b.1489686964.git.narcisaanamaria12%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#8 lore raw
In reply to Narcisa Ana Maria Vasile

Remember to put the subsystem name in the cover letter as well.

julia

Quoted 20 lines · Narcisa Ana Maria Vasile

Convert the printk() calls to corresponding pr_*() calls and define pr_fmt() to easily introduce the name of the module.

Narcisa Ana Maria Vasile (2):
staging: lustre: libcfs: Replace printk() with pr_*()
staging: lustre: libcfs: Define pr_fmt() to include relevant name

 drivers/staging/lustre/lnet/libcfs/tracefile.c | 59 ++++++++++++--------------
 1 file changed, 27 insertions(+), 32 deletions(-)

--
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/cover.1489686964.git.narcisaanamaria12%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#9 lore raw

v2 cover staging: lustre: libcfs: Replace printk() with pr_*() and define pr_fmt()

In reply to Narcisa Ana Maria Vasile

Convert the printk() calls to corresponding pr_*() calls and define pr_fmt() to easily introduce the name of the module. Remove redundant prefixes 'Lustre:' from pr_*() calls, since now the pr_fmt() define will provide it.

---
Changes in v2:
- Add the subsystem name to the cover letter as well
- Remove whitespace change that was not covered by the log message
- Keep the original 'LustreError' prefix for making searching through the logs faster

Narcisa Ana Maria Vasile (2):
staging: lustre: libcfs: Replace printk() with pr_*()
staging: lustre: libcfs: Define pr_fmt() to include relevant name

 drivers/staging/lustre/lnet/libcfs/tracefile.c | 51 ++++++++++++--------------
 1 file changed, 23 insertions(+), 28 deletions(-)
Signature · 1 line
1.9.1
#10 lore raw

PATCH v2 1/2 staging: lustre: libcfs: Replace printk() with pr_*()

Convert printk() calls into corresponding pr_*() calls.

---
 drivers/staging/lustre/lnet/libcfs/tracefile.c | 50 ++++++++++++--------------
 1 file changed, 22 insertions(+), 28 deletions(-)
drivers/staging/lustre/lnet/libcfs/tracefile.c +22 -28
index d7b29f8..5cc67d7 100644
@@ -192,9 +192,8 @@ int cfs_trace_refill_stock(struct cfs_trace_cpu_data *tcd, gfp_t gfp,
 			if (unlikely(!tage)) {
 				if ((!memory_pressure_get() ||
 				     in_interrupt()) && printk_ratelimit())
-					printk(KERN_WARNING
-					       "cannot allocate a tage (%ld)\n",
-					       tcd->tcd_cur_pages);
+					pr_warn("cannot allocate a tage (%ld)\n",
+						tcd->tcd_cur_pages);
 				return NULL;
 			}
 		}
@@ -230,8 +229,8 @@ static void cfs_tcd_shrink(struct cfs_trace_cpu_data *tcd)
 	 */
 
 	if (printk_ratelimit())
-		printk(KERN_WARNING "debug daemon buffer overflowed; discarding 10%% of pages (%d of %ld)\n",
-		       pgcount + 1, tcd->tcd_cur_pages);
+		pr_warn("debug daemon buffer overflowed; discarding 10%% of pages (%d of %ld)\n",
+			pgcount + 1, tcd->tcd_cur_pages);
 
 	INIT_LIST_HEAD(&pc.pc_pages);
 
@@ -358,8 +357,7 @@ int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata,
 
 		max_nob = PAGE_SIZE - tage->used - known_size;
 		if (max_nob <= 0) {
-			printk(KERN_EMERG "negative max_nob: %d\n",
-			       max_nob);
+			pr_emerg("negative max_nob: %d\n", max_nob);
 			mask |= D_ERROR;
 			cfs_trace_put_tcd(tcd);
 			tcd = NULL;
@@ -389,8 +387,8 @@ int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata,
 	}
 
 	if (*(string_buf + needed - 1) != '\n')
-		printk(KERN_INFO "format at %s:%d:%s doesn't end in newline\n",
-		       file, msgdata->msg_line, msgdata->msg_fn);
+		pr_info("format at %s:%d:%s doesn't end in newline\n", file,
+			msgdata->msg_line, msgdata->msg_fn);
 
 	header.ph_len = known_size + needed;
 	debug_buf = (char *)page_address(tage->page) + tage->used;
@@ -739,8 +737,8 @@ int cfs_tracefile_dump_all_pages(char *filename)
 		kunmap(tage->page);
 
 		if (rc != (int)tage->used) {
-			printk(KERN_WARNING "wanted to write %u but wrote %d\n",
-			       tage->used, rc);
+			pr_warn("wanted to write %u but wrote %d\n", tage->used,
+				rc);
 			put_pages_back(&pc);
 			__LASSERT(list_empty(&pc.pc_pages));
 			break;
@@ -894,10 +892,9 @@ int cfs_trace_daemon_command(char *str)
 	} else {
 		strcpy(cfs_tracefile, str);
 
-		printk(KERN_INFO
-		       "Lustre: debug daemon will attempt to start writing to %s (%lukB max)\n",
-		       cfs_tracefile,
-		       (long)(cfs_tracefile_size >> 10));
+		pr_info("Lustre: debug daemon will attempt to start writing to %s (%lukB max)\n",
+			cfs_tracefile,
+			(long)(cfs_tracefile_size >> 10));
 
 		cfs_trace_start_thread();
 	}
@@ -933,16 +930,14 @@ int cfs_trace_set_debug_mb(int mb)
 	struct cfs_trace_cpu_data *tcd;
 
 	if (mb < num_possible_cpus()) {
-		printk(KERN_WARNING
-		       "Lustre: %d MB is too small for debug buffer size, setting it to %d MB.\n",
-		       mb, num_possible_cpus());
+		pr_warn("Lustre: %d MB is too small for debug buffer size, setting it to %d MB.\n",
+			mb, num_possible_cpus());
 		mb = num_possible_cpus();
 	}
 
 	if (mb > limit) {
-		printk(KERN_WARNING
-		       "Lustre: %d MB is too large for debug buffer size, setting it to %d MB.\n",
-		       mb, limit);
+		pr_warn("Lustre: %d MB is too large for debug buffer size, setting it to %d MB.\n",
+			mb, limit);
 		mb = limit;
 	}
 
@@ -1010,8 +1005,8 @@ static int tracefiled(void *arg)
 			if (IS_ERR(filp)) {
 				rc = PTR_ERR(filp);
 				filp = NULL;
-				printk(KERN_WARNING "couldn't open %s: %d\n",
-				       cfs_tracefile, rc);
+				pr_warn("couldn't open %s: %d\n", cfs_tracefile,
+					rc);
 			}
 		}
 		cfs_tracefile_read_unlock();
@@ -1039,8 +1034,8 @@ static int tracefiled(void *arg)
 			kunmap(tage->page);
 
 			if (rc != (int)tage->used) {
-				printk(KERN_WARNING "wanted to write %u but wrote %d\n",
-				       tage->used, rc);
+				pr_warn("wanted to write %u but wrote %d\n",
+					tage->used, rc);
 				put_pages_back(&pc);
 				__LASSERT(list_empty(&pc.pc_pages));
 				break;
@@ -1053,7 +1048,7 @@ static int tracefiled(void *arg)
 		if (!list_empty(&pc.pc_pages)) {
 			int i;
 
-			printk(KERN_ALERT "Lustre: trace pages aren't empty\n");
+			pr_alert("Lustre: trace pages aren't empty\n");
 			pr_err("total cpus(%d): ", num_possible_cpus());
 			for (i = 0; i < num_possible_cpus(); i++)
 				if (cpu_online(i))
@@ -1123,8 +1118,7 @@ void cfs_trace_stop_thread(void)
 
 	mutex_lock(&cfs_trace_thread_mutex);
 	if (thread_running) {
-		printk(KERN_INFO
-		       "Lustre: shutting down debug daemon thread...\n");
+		pr_info("Lustre: shutting down debug daemon thread...\n");
 		atomic_set(&tctl->tctl_shutdown, 1);
 		wait_for_completion(&tctl->tctl_stop);
 		thread_running = 0;
Signature · 1 line
1.9.1
#11 lore raw

PATCH v2 2/2 staging: lustre: libcfs: Define pr_fmt() to include relevant name

In reply to Narcisa Ana Maria Vasile

Define a pr_fmt() for tracefile.c
Remove redundant prefix 'Lustre' from pr_*() calls.

---
 drivers/staging/lustre/lnet/libcfs/tracefile.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/staging/lustre/lnet/libcfs/tracefile.c +6 -5
index 5cc67d7..9599b74 100644
@@ -37,6 +37,7 @@
 
 #define DEBUG_SUBSYSTEM S_LNET
 #define LUSTRE_TRACEFILE_PRIVATE
+#define pr_fmt(fmt) "Lustre: " fmt
 #include "tracefile.h"
 
 #include "../../include/linux/libcfs/libcfs.h"
@@ -892,7 +893,7 @@ int cfs_trace_daemon_command(char *str)
 	} else {
 		strcpy(cfs_tracefile, str);
 
-		pr_info("Lustre: debug daemon will attempt to start writing to %s (%lukB max)\n",
+		pr_info("debug daemon will attempt to start writing to %s (%lukB max)\n",
 			cfs_tracefile,
 			(long)(cfs_tracefile_size >> 10));
 
@@ -930,13 +931,13 @@ int cfs_trace_set_debug_mb(int mb)
 	struct cfs_trace_cpu_data *tcd;
 
 	if (mb < num_possible_cpus()) {
-		pr_warn("Lustre: %d MB is too small for debug buffer size, setting it to %d MB.\n",
+		pr_warn("%d MB is too small for debug buffer size, setting it to %d MB.\n",
 			mb, num_possible_cpus());
 		mb = num_possible_cpus();
 	}
 
 	if (mb > limit) {
-		pr_warn("Lustre: %d MB is too large for debug buffer size, setting it to %d MB.\n",
+		pr_warn("%d MB is too large for debug buffer size, setting it to %d MB.\n",
 			mb, limit);
 		mb = limit;
 	}
@@ -1048,7 +1049,7 @@ static int tracefiled(void *arg)
 		if (!list_empty(&pc.pc_pages)) {
 			int i;
 
-			pr_alert("Lustre: trace pages aren't empty\n");
+			pr_alert("trace pages aren't empty\n");
 			pr_err("total cpus(%d): ", num_possible_cpus());
 			for (i = 0; i < num_possible_cpus(); i++)
 				if (cpu_online(i))
@@ -1118,7 +1119,7 @@ void cfs_trace_stop_thread(void)
 
 	mutex_lock(&cfs_trace_thread_mutex);
 	if (thread_running) {
-		pr_info("Lustre: shutting down debug daemon thread...\n");
+		pr_info("shutting down debug daemon thread...\n");
 		atomic_set(&tctl->tctl_shutdown, 1);
 		wait_for_completion(&tctl->tctl_stop);
 		thread_running = 0;
Signature · 1 line
1.9.1