diff options
author | Mike Snitzer <snitzer@redhat.com> | 2019-07-17 12:57:06 -0400 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2019-07-17 13:09:32 -0400 |
commit | 733232f8c852bcc2ad6fc1db7f4c43eb01c7c217 (patch) | |
tree | 712122bb8f1bf479ca5ddee13201e013b190132a /include/linux/device-mapper.h | |
parent | c663e04097f4e286fc146f79eb5ef6a47c01d337 (diff) |
dm: use printk ratelimiting functions
DM provided its own ratelimiting printk wrapper but given printk
advances this is no longer needed.
Also, switching DMDEBUG_LIMIT to using pr_debug_ratelimited() fixes the
reported issue where DMDEBUG_LIMIT() still caused a flood of "callbacks
suppressed" messages.
Reported-by: Milan Broz <gmazyland@gmail.com>
Depends-on: 29fc2bc7539386 ("printk: pr_debug_ratelimited: check state first to reduce "callbacks suppressed" messages")
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'include/linux/device-mapper.h')
-rw-r--r-- | include/linux/device-mapper.h | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h index e1f51d607cc5..603ce5bb4fac 100644 --- a/include/linux/device-mapper.h +++ b/include/linux/device-mapper.h | |||
@@ -530,29 +530,20 @@ void *dm_vcalloc(unsigned long nmemb, unsigned long elem_size); | |||
530 | *---------------------------------------------------------------*/ | 530 | *---------------------------------------------------------------*/ |
531 | #define DM_NAME "device-mapper" | 531 | #define DM_NAME "device-mapper" |
532 | 532 | ||
533 | #define DM_RATELIMIT(pr_func, fmt, ...) \ | ||
534 | do { \ | ||
535 | static DEFINE_RATELIMIT_STATE(rs, DEFAULT_RATELIMIT_INTERVAL, \ | ||
536 | DEFAULT_RATELIMIT_BURST); \ | ||
537 | \ | ||
538 | if (__ratelimit(&rs)) \ | ||
539 | pr_func(DM_FMT(fmt), ##__VA_ARGS__); \ | ||
540 | } while (0) | ||
541 | |||
542 | #define DM_FMT(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt "\n" | 533 | #define DM_FMT(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt "\n" |
543 | 534 | ||
544 | #define DMCRIT(fmt, ...) pr_crit(DM_FMT(fmt), ##__VA_ARGS__) | 535 | #define DMCRIT(fmt, ...) pr_crit(DM_FMT(fmt), ##__VA_ARGS__) |
545 | 536 | ||
546 | #define DMERR(fmt, ...) pr_err(DM_FMT(fmt), ##__VA_ARGS__) | 537 | #define DMERR(fmt, ...) pr_err(DM_FMT(fmt), ##__VA_ARGS__) |
547 | #define DMERR_LIMIT(fmt, ...) DM_RATELIMIT(pr_err, fmt, ##__VA_ARGS__) | 538 | #define DMERR_LIMIT(fmt, ...) pr_err_ratelimited(DM_FMT(fmt), ##__VA_ARGS__) |
548 | #define DMWARN(fmt, ...) pr_warn(DM_FMT(fmt), ##__VA_ARGS__) | 539 | #define DMWARN(fmt, ...) pr_warn(DM_FMT(fmt), ##__VA_ARGS__) |
549 | #define DMWARN_LIMIT(fmt, ...) DM_RATELIMIT(pr_warn, fmt, ##__VA_ARGS__) | 540 | #define DMWARN_LIMIT(fmt, ...) pr_warn_ratelimited(DM_FMT(fmt), ##__VA_ARGS__) |
550 | #define DMINFO(fmt, ...) pr_info(DM_FMT(fmt), ##__VA_ARGS__) | 541 | #define DMINFO(fmt, ...) pr_info(DM_FMT(fmt), ##__VA_ARGS__) |
551 | #define DMINFO_LIMIT(fmt, ...) DM_RATELIMIT(pr_info, fmt, ##__VA_ARGS__) | 542 | #define DMINFO_LIMIT(fmt, ...) pr_info_ratelimited(DM_FMT(fmt), ##__VA_ARGS__) |
552 | 543 | ||
553 | #ifdef CONFIG_DM_DEBUG | 544 | #ifdef CONFIG_DM_DEBUG |
554 | #define DMDEBUG(fmt, ...) printk(KERN_DEBUG DM_FMT(fmt), ##__VA_ARGS__) | 545 | #define DMDEBUG(fmt, ...) printk(KERN_DEBUG DM_FMT(fmt), ##__VA_ARGS__) |
555 | #define DMDEBUG_LIMIT(fmt, ...) DM_RATELIMIT(pr_debug, fmt, ##__VA_ARGS__) | 546 | #define DMDEBUG_LIMIT(fmt, ...) pr_debug_ratelimited(DM_FMT(fmt), ##__VA_ARGS__) |
556 | #else | 547 | #else |
557 | #define DMDEBUG(fmt, ...) no_printk(fmt, ##__VA_ARGS__) | 548 | #define DMDEBUG(fmt, ...) no_printk(fmt, ##__VA_ARGS__) |
558 | #define DMDEBUG_LIMIT(fmt, ...) no_printk(fmt, ##__VA_ARGS__) | 549 | #define DMDEBUG_LIMIT(fmt, ...) no_printk(fmt, ##__VA_ARGS__) |