All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Replace printk() with pr_*() and define pr_fmt()
@ 2017-03-16 18:01 Narcisa Ana Maria Vasile
  2017-03-16 18:01 ` [PATCH 1/2] staging: lustre: libcfs: Replace printk() with pr_*() Narcisa Ana Maria Vasile
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Narcisa Ana Maria Vasile @ 2017-03-16 18:01 UTC (permalink / raw)
  To: oleg.drokin, andreas.dilger, jsimmons, gregkh
  Cc: outreachy-kernel, 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



^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/2] staging: lustre: libcfs: Replace printk() with pr_*()
  2017-03-16 18:01 [PATCH 0/2] Replace printk() with pr_*() and define pr_fmt() Narcisa Ana Maria Vasile
@ 2017-03-16 18:01 ` Narcisa Ana Maria Vasile
  2017-03-16 18:48   ` [Outreachy kernel] " Julia Lawall
  2017-03-16 18:01 ` [PATCH 2/2] staging: lustre: libcfs: Define pr_fmt() to include relevant name Narcisa Ana Maria Vasile
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 12+ messages in thread
From: Narcisa Ana Maria Vasile @ 2017-03-16 18:01 UTC (permalink / raw)
  To: oleg.drokin, andreas.dilger, jsimmons, gregkh
  Cc: outreachy-kernel, Narcisa Ana Maria Vasile

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

Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
---
 drivers/staging/lustre/lnet/libcfs/tracefile.c | 58 ++++++++++++--------------
 1 file changed, 26 insertions(+), 32 deletions(-)

diff --git a/drivers/staging/lustre/lnet/libcfs/tracefile.c b/drivers/staging/lustre/lnet/libcfs/tracefile.c
index d7b29f8..c70f36e 100644
--- a/drivers/staging/lustre/lnet/libcfs/tracefile.c
+++ b/drivers/staging/lustre/lnet/libcfs/tracefile.c
@@ -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;
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/2] staging: lustre: libcfs: Define pr_fmt() to include relevant name
  2017-03-16 18:01 [PATCH 0/2] Replace printk() with pr_*() and define pr_fmt() Narcisa Ana Maria Vasile
  2017-03-16 18:01 ` [PATCH 1/2] staging: lustre: libcfs: Replace printk() with pr_*() Narcisa Ana Maria Vasile
@ 2017-03-16 18:01 ` Narcisa Ana Maria Vasile
  2017-03-16 18:45   ` [Outreachy kernel] " Julia Lawall
  2017-03-16 18:48 ` [Outreachy kernel] [PATCH 0/2] Replace printk() with pr_*() and define pr_fmt() Julia Lawall
  2017-03-18 16:54 ` [PATCH v2 0/2] staging: lustre: libcfs: " Narcisa Ana Maria Vasile
  3 siblings, 1 reply; 12+ messages in thread
From: Narcisa Ana Maria Vasile @ 2017-03-16 18:01 UTC (permalink / raw)
  To: oleg.drokin, andreas.dilger, jsimmons, gregkh
  Cc: outreachy-kernel, Narcisa Ana Maria Vasile

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

Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
---
 drivers/staging/lustre/lnet/libcfs/tracefile.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/lustre/lnet/libcfs/tracefile.c b/drivers/staging/lustre/lnet/libcfs/tracefile.c
index c70f36e..72fd0c5 100644
--- a/drivers/staging/lustre/lnet/libcfs/tracefile.c
+++ b/drivers/staging/lustre/lnet/libcfs/tracefile.c
@@ -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;
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [Outreachy kernel] [PATCH 2/2] staging: lustre: libcfs: Define pr_fmt() to include relevant name
  2017-03-16 18:01 ` [PATCH 2/2] staging: lustre: libcfs: Define pr_fmt() to include relevant name Narcisa Ana Maria Vasile
@ 2017-03-16 18:45   ` Julia Lawall
  2017-03-17  4:29     ` Oleg Drokin
  0 siblings, 1 reply; 12+ messages in thread
From: Julia Lawall @ 2017-03-16 18:45 UTC (permalink / raw)
  To: Narcisa Ana Maria Vasile
  Cc: oleg.drokin, andreas.dilger, jsimmons, gregkh, outreachy-kernel



On Thu, 16 Mar 2017, Narcisa Ana Maria Vasile wrote:

> Define a pr_fmt() for tracefile.c
> Remove redundant prefix 'Lustre' from pr_*() calls.
>
> Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
> ---
>  drivers/staging/lustre/lnet/libcfs/tracefile.c | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/staging/lustre/lnet/libcfs/tracefile.c b/drivers/staging/lustre/lnet/libcfs/tracefile.c
> index c70f36e..72fd0c5 100644
> --- a/drivers/staging/lustre/lnet/libcfs/tracefile.c
> +++ b/drivers/staging/lustre/lnet/libcfs/tracefile.c
> @@ -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);

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

julia

>  		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 outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> 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.
>


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Outreachy kernel] [PATCH 1/2] staging: lustre: libcfs: Replace printk() with pr_*()
  2017-03-16 18:01 ` [PATCH 1/2] staging: lustre: libcfs: Replace printk() with pr_*() Narcisa Ana Maria Vasile
@ 2017-03-16 18:48   ` Julia Lawall
  2017-03-17 10:45     ` Narcisa Ana Maria Vasile
  0 siblings, 1 reply; 12+ messages in thread
From: Julia Lawall @ 2017-03-16 18:48 UTC (permalink / raw)
  To: Narcisa Ana Maria Vasile
  Cc: oleg.drokin, andreas.dilger, jsimmons, gregkh, outreachy-kernel



On Thu, 16 Mar 2017, Narcisa Ana Maria Vasile wrote:

> Convert printk() calls into corresponding pr_*() calls.
>
> Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
> ---
>  drivers/staging/lustre/lnet/libcfs/tracefile.c | 58 ++++++++++++--------------
>  1 file changed, 26 insertions(+), 32 deletions(-)
>
> diff --git a/drivers/staging/lustre/lnet/libcfs/tracefile.c b/drivers/staging/lustre/lnet/libcfs/tracefile.c
> index d7b29f8..c70f36e 100644
> --- a/drivers/staging/lustre/lnet/libcfs/tracefile.c
> +++ b/drivers/staging/lustre/lnet/libcfs/tracefile.c
> @@ -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);

This change is not covered by the log message.

julia


>  		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 outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> 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.
>


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Outreachy kernel] [PATCH 0/2] Replace printk() with pr_*() and define pr_fmt()
  2017-03-16 18:01 [PATCH 0/2] Replace printk() with pr_*() and define pr_fmt() Narcisa Ana Maria Vasile
  2017-03-16 18:01 ` [PATCH 1/2] staging: lustre: libcfs: Replace printk() with pr_*() Narcisa Ana Maria Vasile
  2017-03-16 18:01 ` [PATCH 2/2] staging: lustre: libcfs: Define pr_fmt() to include relevant name Narcisa Ana Maria Vasile
@ 2017-03-16 18:48 ` Julia Lawall
  2017-03-18 16:54 ` [PATCH v2 0/2] staging: lustre: libcfs: " Narcisa Ana Maria Vasile
  3 siblings, 0 replies; 12+ messages in thread
From: Julia Lawall @ 2017-03-16 18:48 UTC (permalink / raw)
  To: Narcisa Ana Maria Vasile
  Cc: oleg.drokin, andreas.dilger, jsimmons, gregkh, outreachy-kernel

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

julia

On Thu, 16 Mar 2017, Narcisa Ana Maria Vasile wrote:

> 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 outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> 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.
>


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Outreachy kernel] [PATCH 2/2] staging: lustre: libcfs: Define pr_fmt() to include relevant name
  2017-03-16 18:45   ` [Outreachy kernel] " Julia Lawall
@ 2017-03-17  4:29     ` Oleg Drokin
  2017-03-17 10:42       ` Narcisa Ana Maria Vasile
  0 siblings, 1 reply; 12+ messages in thread
From: Oleg Drokin @ 2017-03-17  4:29 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Narcisa Ana Maria Vasile, andreas.dilger, jsimmons, gregkh,
	outreachy-kernel


On Mar 16, 2017, at 2:45 PM, Julia Lawall wrote:

> 
> 
> On Thu, 16 Mar 2017, Narcisa Ana Maria Vasile wrote:
> 
>> Define a pr_fmt() for tracefile.c
>> Remove redundant prefix 'Lustre' from pr_*() calls.
>> 
>> Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
>> ---
>> drivers/staging/lustre/lnet/libcfs/tracefile.c | 13 +++++++------
>> 1 file changed, 7 insertions(+), 6 deletions(-)
>> 
>> diff --git a/drivers/staging/lustre/lnet/libcfs/tracefile.c b/drivers/staging/lustre/lnet/libcfs/tracefile.c
>> index c70f36e..72fd0c5 100644
>> --- a/drivers/staging/lustre/lnet/libcfs/tracefile.c
>> +++ b/drivers/staging/lustre/lnet/libcfs/tracefile.c
>> @@ -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);
> 
> 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.

> 
> julia
> 
>> 		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 outreachy-kernel+unsubscribe@googlegroups.com.
>> To post to this group, send email to outreachy-kernel@googlegroups.com.
>> 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.
>> 



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Outreachy kernel] [PATCH 2/2] staging: lustre: libcfs: Define pr_fmt() to include relevant name
  2017-03-17  4:29     ` Oleg Drokin
@ 2017-03-17 10:42       ` Narcisa Ana Maria Vasile
  0 siblings, 0 replies; 12+ messages in thread
From: Narcisa Ana Maria Vasile @ 2017-03-17 10:42 UTC (permalink / raw)
  To: Oleg Drokin
  Cc: Julia Lawall, andreas.dilger, jsimmons, gregkh, outreachy-kernel

On Fri, Mar 17, 2017 at 12:29:15AM -0400, Oleg Drokin wrote:
> 
> On Mar 16, 2017, at 2:45 PM, Julia Lawall wrote:
> 
> > 
> > 
> > On Thu, 16 Mar 2017, Narcisa Ana Maria Vasile wrote:
> > 
> >> Define a pr_fmt() for tracefile.c
> >> Remove redundant prefix 'Lustre' from pr_*() calls.
> >> 
> >> Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
> >> ---
> >> drivers/staging/lustre/lnet/libcfs/tracefile.c | 13 +++++++------
> >> 1 file changed, 7 insertions(+), 6 deletions(-)
> >> 
> >> diff --git a/drivers/staging/lustre/lnet/libcfs/tracefile.c b/drivers/staging/lustre/lnet/libcfs/tracefile.c
> >> index c70f36e..72fd0c5 100644
> >> --- a/drivers/staging/lustre/lnet/libcfs/tracefile.c
> >> +++ b/drivers/staging/lustre/lnet/libcfs/tracefile.c
> >> @@ -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);
> > 
> > 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.
> 
  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
> > 
> > julia
> > 
> >> 		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 outreachy-kernel+unsubscribe@googlegroups.com.
> >> To post to this group, send email to outreachy-kernel@googlegroups.com.
> >> 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.
> >> 
> 


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Outreachy kernel] [PATCH 1/2] staging: lustre: libcfs: Replace printk() with pr_*()
  2017-03-16 18:48   ` [Outreachy kernel] " Julia Lawall
@ 2017-03-17 10:45     ` Narcisa Ana Maria Vasile
  0 siblings, 0 replies; 12+ messages in thread
From: Narcisa Ana Maria Vasile @ 2017-03-17 10:45 UTC (permalink / raw)
  To: Julia Lawall
  Cc: oleg.drokin, andreas.dilger, jsimmons, gregkh, outreachy-kernel

On Thu, Mar 16, 2017 at 07:48:15PM +0100, Julia Lawall wrote:
> 
> 
> On Thu, 16 Mar 2017, Narcisa Ana Maria Vasile wrote:
> 
> > Convert printk() calls into corresponding pr_*() calls.
> >
> > Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
> > ---
> >  drivers/staging/lustre/lnet/libcfs/tracefile.c | 58 ++++++++++++--------------
> >  1 file changed, 26 insertions(+), 32 deletions(-)
> >
> > diff --git a/drivers/staging/lustre/lnet/libcfs/tracefile.c b/drivers/staging/lustre/lnet/libcfs/tracefile.c
> > index d7b29f8..c70f36e 100644
> > --- a/drivers/staging/lustre/lnet/libcfs/tracefile.c
> > +++ b/drivers/staging/lustre/lnet/libcfs/tracefile.c
> > @@ -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);
> 
> This change is not covered by the log message.
> 
> 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
> 
> >  		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 outreachy-kernel+unsubscribe@googlegroups.com.
> > To post to this group, send email to outreachy-kernel@googlegroups.com.
> > 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.
> >


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v2 0/2] staging: lustre: libcfs: Replace printk() with pr_*() and define pr_fmt()
  2017-03-16 18:01 [PATCH 0/2] Replace printk() with pr_*() and define pr_fmt() Narcisa Ana Maria Vasile
                   ` (2 preceding siblings ...)
  2017-03-16 18:48 ` [Outreachy kernel] [PATCH 0/2] Replace printk() with pr_*() and define pr_fmt() Julia Lawall
@ 2017-03-18 16:54 ` Narcisa Ana Maria Vasile
  2017-03-18 16:55   ` [PATCH v2 1/2] staging: lustre: libcfs: Replace printk() with pr_*() Narcisa Ana Maria Vasile
  2017-03-18 16:56   ` [PATCH v2 2/2] staging: lustre: libcfs: Define pr_fmt() to include relevant name Narcisa Ana Maria Vasile
  3 siblings, 2 replies; 12+ messages in thread
From: Narcisa Ana Maria Vasile @ 2017-03-18 16:54 UTC (permalink / raw)
  To: oleg.drokin, andreas.dilger, jsimmons, gregkh
  Cc: outreachy-kernel, 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(-)

-- 
1.9.1



^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v2 1/2] staging: lustre: libcfs: Replace printk() with pr_*()
  2017-03-18 16:54 ` [PATCH v2 0/2] staging: lustre: libcfs: " Narcisa Ana Maria Vasile
@ 2017-03-18 16:55   ` Narcisa Ana Maria Vasile
  2017-03-18 16:56   ` [PATCH v2 2/2] staging: lustre: libcfs: Define pr_fmt() to include relevant name Narcisa Ana Maria Vasile
  1 sibling, 0 replies; 12+ messages in thread
From: Narcisa Ana Maria Vasile @ 2017-03-18 16:55 UTC (permalink / raw)
  To: oleg.drokin, andreas.dilger, jsimmons, gregkh
  Cc: outreachy-kernel, Narcisa Ana Maria Vasile

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

Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
---
 drivers/staging/lustre/lnet/libcfs/tracefile.c | 50 ++++++++++++--------------
 1 file changed, 22 insertions(+), 28 deletions(-)

diff --git a/drivers/staging/lustre/lnet/libcfs/tracefile.c b/drivers/staging/lustre/lnet/libcfs/tracefile.c
index d7b29f8..5cc67d7 100644
--- a/drivers/staging/lustre/lnet/libcfs/tracefile.c
+++ b/drivers/staging/lustre/lnet/libcfs/tracefile.c
@@ -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;
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 2/2] staging: lustre: libcfs: Define pr_fmt() to include relevant name
  2017-03-18 16:54 ` [PATCH v2 0/2] staging: lustre: libcfs: " Narcisa Ana Maria Vasile
  2017-03-18 16:55   ` [PATCH v2 1/2] staging: lustre: libcfs: Replace printk() with pr_*() Narcisa Ana Maria Vasile
@ 2017-03-18 16:56   ` Narcisa Ana Maria Vasile
  1 sibling, 0 replies; 12+ messages in thread
From: Narcisa Ana Maria Vasile @ 2017-03-18 16:56 UTC (permalink / raw)
  To: oleg.drokin, andreas.dilger, jsimmons, gregkh
  Cc: outreachy-kernel, Narcisa Ana Maria Vasile

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

Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
---
 drivers/staging/lustre/lnet/libcfs/tracefile.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/lustre/lnet/libcfs/tracefile.c b/drivers/staging/lustre/lnet/libcfs/tracefile.c
index 5cc67d7..9599b74 100644
--- a/drivers/staging/lustre/lnet/libcfs/tracefile.c
+++ b/drivers/staging/lustre/lnet/libcfs/tracefile.c
@@ -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;
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2017-03-18 16:56 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-16 18:01 [PATCH 0/2] Replace printk() with pr_*() and define pr_fmt() Narcisa Ana Maria Vasile
2017-03-16 18:01 ` [PATCH 1/2] staging: lustre: libcfs: Replace printk() with pr_*() Narcisa Ana Maria Vasile
2017-03-16 18:48   ` [Outreachy kernel] " Julia Lawall
2017-03-17 10:45     ` Narcisa Ana Maria Vasile
2017-03-16 18:01 ` [PATCH 2/2] staging: lustre: libcfs: Define pr_fmt() to include relevant name Narcisa Ana Maria Vasile
2017-03-16 18:45   ` [Outreachy kernel] " Julia Lawall
2017-03-17  4:29     ` Oleg Drokin
2017-03-17 10:42       ` Narcisa Ana Maria Vasile
2017-03-16 18:48 ` [Outreachy kernel] [PATCH 0/2] Replace printk() with pr_*() and define pr_fmt() Julia Lawall
2017-03-18 16:54 ` [PATCH v2 0/2] staging: lustre: libcfs: " Narcisa Ana Maria Vasile
2017-03-18 16:55   ` [PATCH v2 1/2] staging: lustre: libcfs: Replace printk() with pr_*() Narcisa Ana Maria Vasile
2017-03-18 16:56   ` [PATCH v2 2/2] staging: lustre: libcfs: Define pr_fmt() to include relevant name Narcisa Ana Maria Vasile

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.