diff options
author | Mike Snitzer <snitzer@kernel.org> | 2024-02-10 19:42:00 +0300 |
---|---|---|
committer | Mike Snitzer <snitzer@kernel.org> | 2024-03-04 23:07:56 +0300 |
commit | 25315e967aab0a3b732c076e4cbce52bd0fa4385 (patch) | |
tree | 7dcb433c23ea7a6b352672ec63d4da24d06f5312 /drivers/md/dm-vdo/logger.c | |
parent | a9da0fb6d8c61e354611c181d505fd417aad51f5 (diff) | |
download | linux-25315e967aab0a3b732c076e4cbce52bd0fa4385.tar.xz |
dm vdo: add 'log_level' module parameter
Expose control over dm-vdo's log-level in terms of a module param. It
can be read and written via /sys/module/dm_vdo/parameters/log_level.
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Ken Raeburn <raeburn@redhat.com>
Signed-off-by: Matthew Sakai <msakai@redhat.com>
Diffstat (limited to 'drivers/md/dm-vdo/logger.c')
-rw-r--r-- | drivers/md/dm-vdo/logger.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/md/dm-vdo/logger.c b/drivers/md/dm-vdo/logger.c index bac28fff622d..5d27cd6483a9 100644 --- a/drivers/md/dm-vdo/logger.c +++ b/drivers/md/dm-vdo/logger.c @@ -49,11 +49,17 @@ static const char *const PRIORITY_STRINGS[] = { "DEBUG", }; -static int log_level = UDS_LOG_INFO; +int vdo_log_level = UDS_LOG_DEFAULT; int uds_get_log_level(void) { - return log_level; + int log_level_latch = READ_ONCE(vdo_log_level); + + if (unlikely(log_level_latch > UDS_LOG_MAX)) { + log_level_latch = UDS_LOG_DEFAULT; + WRITE_ONCE(vdo_log_level, log_level_latch); + } + return log_level_latch; } int uds_log_string_to_priority(const char *string) |