Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[VDO-5677] Upstream logger simplifications #36

Merged
merged 2 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion drivers/md/dm-vdo/index-session.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ int uds_open_index(enum uds_open_index_type open_type,

session->parameters = *parameters;
format_dev_t(name, parameters->bdev->bd_dev);
uds_log_notice("%s: %s", get_open_type_string(open_type), name);
uds_log_info("%s: %s", get_open_type_string(open_type), name);

result = initialize_index_session(session, open_type);
if (result != UDS_SUCCESS)
Expand Down
12 changes: 5 additions & 7 deletions drivers/md/dm-vdo/logger.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,22 +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:
printk(KERN_NOTICE "%pV", &vaf);
break;
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);
Expand Down
13 changes: 3 additions & 10 deletions drivers/md/dm-vdo/logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include <linux/module.h>
#include <linux/ratelimit.h>
#include <linux/device-mapper.h>

/* Custom logging utilities for UDS */

Expand All @@ -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, ...) \
Expand Down Expand Up @@ -74,9 +72,6 @@ int uds_vlog_strerror(int priority, int errnum, const char *module, const char *
#define uds_log_info_strerror(errnum, ...) \
uds_log_strerror(UDS_LOG_INFO, errnum, __VA_ARGS__)

#define uds_log_notice_strerror(errnum, ...) \
uds_log_strerror(UDS_LOG_NOTICE, errnum, __VA_ARGS__)

#define uds_log_warning_strerror(errnum, ...) \
uds_log_strerror(UDS_LOG_WARNING, errnum, __VA_ARGS__)

Expand All @@ -93,8 +88,6 @@ void __uds_log_message(int priority, const char *module, const char *format, ...

#define uds_log_info(...) uds_log_message(UDS_LOG_INFO, __VA_ARGS__)

#define uds_log_notice(...) uds_log_message(UDS_LOG_NOTICE, __VA_ARGS__)

#define uds_log_warning(...) uds_log_message(UDS_LOG_WARNING, __VA_ARGS__)

#define uds_log_error(...) uds_log_message(UDS_LOG_ERR, __VA_ARGS__)
Expand Down
Loading