@@ -3,8 +3,6 @@
#ifndef BTRFS_PRINTK_H
#define BTRFS_PRINTK_H
-#include <linux/printk.h>
-
struct btrfs_fs_info;
struct btrfs_trans_handle;
@@ -13,19 +11,7 @@ void btrfs_no_printk(const struct btrfs_fs_info *fs_info, const char *fmt, ...)
{
}
-#ifdef CONFIG_PRINTK_INDEX
-
-#define btrfs_printk(fs_info, fmt, args...) \
-do { \
- printk_index_subsys_emit("%sBTRFS %s (device %s): ", NULL, fmt); \
- _btrfs_printk(fs_info, fmt, ##args); \
-} while (0)
-
-__printf(2, 3)
-__cold
-void _btrfs_printk(const struct btrfs_fs_info *fs_info, const char *fmt, ...);
-
-#elif defined(CONFIG_PRINTK)
+#ifdef CONFIG_PRINTK
#define btrfs_printk(fs_info, fmt, args...) \
_btrfs_printk(fs_info, fmt, ##args)
@@ -202,25 +188,10 @@ void __btrfs_abort_transaction(struct btrfs_trans_handle *trans,
#define btrfs_abort_transaction(trans, errno) \
__btrfs_abort_transaction((trans), __func__, __LINE__, (errno))
-#ifdef CONFIG_PRINTK_INDEX
-
-#define btrfs_handle_fs_error(fs_info, errno, fmt, args...) \
-do { \
- printk_index_subsys_emit( \
- "BTRFS: error (device %s%s) in %s:%d: errno=%d %s", \
- KERN_CRIT, fmt); \
- __btrfs_handle_fs_error((fs_info), __func__, __LINE__, \
- (errno), fmt, ##args); \
-} while (0)
-
-#else
-
#define btrfs_handle_fs_error(fs_info, errno, fmt, args...) \
__btrfs_handle_fs_error((fs_info), __func__, __LINE__, \
(errno), fmt, ##args)
-#endif
-
__printf(5, 6)
__cold
void __btrfs_panic(struct btrfs_fs_info *fs_info, const char *function,
@@ -182,6 +182,12 @@ void __btrfs_handle_fs_error(struct btrfs_fs_info *fs_info, const char *function
const char *errstr;
#endif
+#ifdef CONFIG_PRINTK_INDEX
+ printk_index_subsys_emit(
+ "BTRFS: error (device %s%s) in %s:%d: errno=%d %s",
+ KERN_CRIT, fmt);
+#endif
+
/*
* Special case: if the error is EROFS, and we're already
* under SB_RDONLY, then it is safe here.
@@ -207,7 +213,7 @@ void __btrfs_handle_fs_error(struct btrfs_fs_info *fs_info, const char *function
pr_crit("BTRFS: error (device %s%s) in %s:%d: errno=%d %s\n",
sb->s_id, statestr, function, line, errno, errstr);
}
-#endif
+#endif /* CONFIG_PRINTK */
/*
* Today we only save the error info to memory. Long term we'll
@@ -274,6 +280,10 @@ void __cold _btrfs_printk(const struct btrfs_fs_info *fs_info, const char *fmt,
const char *type = logtypes[4];
struct ratelimit_state *ratelimit = &printk_limits[4];
+#ifdef CONFIG_PRINTK_INDEX
+ printk_index_subsys_emit("%sBTRFS %s (device %s): ", NULL, fmt);
+#endif
+
va_start(args, fmt);
while ((kern_level = printk_get_level(fmt)) != 0) {
The printk index work can be pushed into the printk helpers themselves, this allows us to further sanitize btrfs-printk.h, removing the last include in the header itself. Signed-off-by: Josef Bacik <josef@toxicpanda.com> --- fs/btrfs/btrfs-printk.h | 31 +------------------------------ fs/btrfs/super.c | 12 +++++++++++- 2 files changed, 12 insertions(+), 31 deletions(-)