btrfs: introduce ratelimited _in_rcu variants of message printing functions
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Родитель
ecaeb14b91
Коммит
24aa6b41d4
|
@ -4057,16 +4057,38 @@ void btrfs_printk(const struct btrfs_fs_info *fs_info, const char *fmt, ...)
|
||||||
#define btrfs_info_in_rcu(fs_info, fmt, args...) \
|
#define btrfs_info_in_rcu(fs_info, fmt, args...) \
|
||||||
btrfs_printk_in_rcu(fs_info, KERN_INFO fmt, ##args)
|
btrfs_printk_in_rcu(fs_info, KERN_INFO fmt, ##args)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Wrappers that use a ratelimited printk_in_rcu
|
||||||
|
*/
|
||||||
|
#define btrfs_emerg_rl_in_rcu(fs_info, fmt, args...) \
|
||||||
|
btrfs_printk_rl_in_rcu(fs_info, KERN_EMERG fmt, ##args)
|
||||||
|
#define btrfs_alert_rl_in_rcu(fs_info, fmt, args...) \
|
||||||
|
btrfs_printk_rl_in_rcu(fs_info, KERN_ALERT fmt, ##args)
|
||||||
|
#define btrfs_crit_rl_in_rcu(fs_info, fmt, args...) \
|
||||||
|
btrfs_printk_rl_in_rcu(fs_info, KERN_CRIT fmt, ##args)
|
||||||
|
#define btrfs_err_rl_in_rcu(fs_info, fmt, args...) \
|
||||||
|
btrfs_printk_rl_in_rcu(fs_info, KERN_ERR fmt, ##args)
|
||||||
|
#define btrfs_warn_rl_in_rcu(fs_info, fmt, args...) \
|
||||||
|
btrfs_printk_rl_in_rcu(fs_info, KERN_WARNING fmt, ##args)
|
||||||
|
#define btrfs_notice_rl_in_rcu(fs_info, fmt, args...) \
|
||||||
|
btrfs_printk_rl_in_rcu(fs_info, KERN_NOTICE fmt, ##args)
|
||||||
|
#define btrfs_info_rl_in_rcu(fs_info, fmt, args...) \
|
||||||
|
btrfs_printk_rl_in_rcu(fs_info, KERN_INFO fmt, ##args)
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
#define btrfs_debug(fs_info, fmt, args...) \
|
#define btrfs_debug(fs_info, fmt, args...) \
|
||||||
btrfs_printk(fs_info, KERN_DEBUG fmt, ##args)
|
btrfs_printk(fs_info, KERN_DEBUG fmt, ##args)
|
||||||
#define btrfs_debug_in_rcu(fs_info, fmt, args...) \
|
#define btrfs_debug_in_rcu(fs_info, fmt, args...) \
|
||||||
btrfs_printk_in_rcu(fs_info, KERN_DEBUG fmt, ##args)
|
btrfs_printk_in_rcu(fs_info, KERN_DEBUG fmt, ##args)
|
||||||
|
#define btrfs_debug_rl_in_rcu(fs_info, fmt, args...) \
|
||||||
|
btrfs_printk_rl_in_rcu(fs_info, KERN_DEBUG fmt, ##args)
|
||||||
#else
|
#else
|
||||||
#define btrfs_debug(fs_info, fmt, args...) \
|
#define btrfs_debug(fs_info, fmt, args...) \
|
||||||
no_printk(KERN_DEBUG fmt, ##args)
|
no_printk(KERN_DEBUG fmt, ##args)
|
||||||
#define btrfs_debug_in_rcu(fs_info, fmt, args...) \
|
#define btrfs_debug_in_rcu(fs_info, fmt, args...) \
|
||||||
no_printk(KERN_DEBUG fmt, ##args)
|
no_printk(KERN_DEBUG fmt, ##args)
|
||||||
|
#define btrfs_debug_rl_in_rcu(fs_info, fmt, args...) \
|
||||||
|
no_printk(KERN_DEBUG fmt, ##args)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define btrfs_printk_in_rcu(fs_info, fmt, args...) \
|
#define btrfs_printk_in_rcu(fs_info, fmt, args...) \
|
||||||
|
@ -4076,6 +4098,22 @@ do { \
|
||||||
rcu_read_unlock(); \
|
rcu_read_unlock(); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
#define btrfs_printk_ratelimited(fs_info, fmt, args...) \
|
||||||
|
do { \
|
||||||
|
static DEFINE_RATELIMIT_STATE(_rs, \
|
||||||
|
DEFAULT_RATELIMIT_INTERVAL, \
|
||||||
|
DEFAULT_RATELIMIT_BURST); \
|
||||||
|
if (__ratelimit(&_rs)) \
|
||||||
|
btrfs_printk(fs_info, fmt, ##args); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define btrfs_printk_rl_in_rcu(fs_info, fmt, args...) \
|
||||||
|
do { \
|
||||||
|
rcu_read_lock(); \
|
||||||
|
btrfs_printk_ratelimited(fs_info, fmt, ##args); \
|
||||||
|
rcu_read_unlock(); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
#ifdef CONFIG_BTRFS_ASSERT
|
#ifdef CONFIG_BTRFS_ASSERT
|
||||||
|
|
||||||
__cold
|
__cold
|
||||||
|
|
Загрузка…
Ссылка в новой задаче