From 1e00d57694bc2f050f73b632ce3822fe28af63d2 Mon Sep 17 00:00:00 2001 From: Mike Snitzer Date: Wed, 14 Feb 2024 18:25:14 -0500 Subject: dm vdo logger: update logging to start with "device-mapper: vdo" 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 Signed-off-by: Bruce Johnston Signed-off-by: Matthew Sakai --- drivers/md/dm-vdo/logger.c | 10 +++++----- drivers/md/dm-vdo/logger.h | 8 +++----- 2 files changed, 8 insertions(+), 10 deletions(-) (limited to 'drivers/md') 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 #include +#include /* 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, ...) \ -- cgit v1.2.3