diff mbox series

[2/2] dm vdo logger: update logging to start with "device-mapper: vdo"

Message ID 339bd684f8ad3139f4bd4316af0175c6947dcdb3.1707952829.git.msakai@redhat.com (mailing list archive)
State Accepted, archived
Delegated to: Mike Snitzer
Headers show
Series dm vdo logger: standardize logging | expand

Commit Message

Matthew Sakai Feb. 14, 2024, 11:25 p.m. UTC
From: Mike Snitzer <snitzer@kernel.org>

Stops short of actually using DM's various logging macros (e.g. DMERR,
DMINFO, etc) because VDO's logger isn't quite compatible with them.

Also switch emit_log_message_to_kernel() from open-coding printk with
log-level to using corresponding pr_ macro.

Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Bruce Johnston <bjohnsto@redhat.com>
Signed-off-by: Matthew Sakai <msakai@redhat.com>
---
 drivers/md/dm-vdo/logger.c | 10 +++++-----
 drivers/md/dm-vdo/logger.h |  8 +++-----
 2 files changed, 8 insertions(+), 10 deletions(-)
diff mbox series

Patch

diff --git a/drivers/md/dm-vdo/logger.c b/drivers/md/dm-vdo/logger.c
index 322224a07cf5..1efbf8d52f2c 100644
--- a/drivers/md/dm-vdo/logger.c
+++ b/drivers/md/dm-vdo/logger.c
@@ -115,20 +115,20 @@  static void emit_log_message_to_kernel(int priority, const char *fmt, ...)
 	case UDS_LOG_EMERG:
 	case UDS_LOG_ALERT:
 	case UDS_LOG_CRIT:
-		printk(KERN_CRIT "%pV", &vaf);
+		pr_crit("%pV", &vaf);
 		break;
 	case UDS_LOG_ERR:
-		printk(KERN_ERR "%pV", &vaf);
+		pr_err("%pV", &vaf);
 		break;
 	case UDS_LOG_WARNING:
-		printk(KERN_WARNING "%pV", &vaf);
+		pr_warn("%pV", &vaf);
 		break;
 	case UDS_LOG_NOTICE:
 	case UDS_LOG_INFO:
-		printk(KERN_INFO "%pV", &vaf);
+		pr_info("%pV", &vaf);
 		break;
 	case UDS_LOG_DEBUG:
-		printk(KERN_DEBUG "%pV", &vaf);
+		pr_debug("%pV", &vaf);
 		break;
 	default:
 		printk(KERN_DEFAULT "%pV", &vaf);
diff --git a/drivers/md/dm-vdo/logger.h b/drivers/md/dm-vdo/logger.h
index 09d448ff9ca9..4e2f18042ba7 100644
--- a/drivers/md/dm-vdo/logger.h
+++ b/drivers/md/dm-vdo/logger.h
@@ -8,6 +8,7 @@ 
 
 #include <linux/module.h>
 #include <linux/ratelimit.h>
+#include <linux/device-mapper.h>
 
 /* Custom logging utilities for UDS */
 
@@ -20,11 +21,8 @@ 
 #define UDS_LOG_INFO 6
 #define UDS_LOG_DEBUG 7
 
-#if defined(MODULE)
-#define UDS_LOGGING_MODULE_NAME THIS_MODULE->name
-#else /* compiled into the kernel */
-#define UDS_LOGGING_MODULE_NAME "vdo"
-#endif
+#define DM_MSG_PREFIX "vdo"
+#define UDS_LOGGING_MODULE_NAME DM_NAME ": " DM_MSG_PREFIX
 
 /* Apply a rate limiter to a log method call. */
 #define uds_log_ratelimit(log_fn, ...)                                    \