public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Josef Bacik <josef@toxicpanda.com>
To: linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: [PATCH 06/16] btrfs: push printk index code into their respective helpers
Date: Wed, 14 Sep 2022 13:18:11 -0400	[thread overview]
Message-ID: <ddcbbcbb41a182baf036d39a6a70e51bbe599f26.1663175597.git.josef@toxicpanda.com> (raw)
In-Reply-To: <cover.1663175597.git.josef@toxicpanda.com>

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(-)

diff --git a/fs/btrfs/btrfs-printk.h b/fs/btrfs/btrfs-printk.h
index 87e46d24b4ad..e2fd6bbc7aa1 100644
--- a/fs/btrfs/btrfs-printk.h
+++ b/fs/btrfs/btrfs-printk.h
@@ -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,
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 781e5faf83d5..2865676b8327 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -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) {
-- 
2.26.3


  parent reply	other threads:[~2022-09-14 17:18 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-14 17:18 [PATCH 00/16] btrfs: split out larger chunks of ctree.h Josef Bacik
2022-09-14 17:18 ` [PATCH 01/16] btrfs: move fs wide helpers out " Josef Bacik
2022-09-16 10:34   ` Anand Jain
2022-09-14 17:18 ` [PATCH 02/16] btrfs: move larger compat flag helpers to their own c file Josef Bacik
2022-09-16 11:11   ` Anand Jain
2022-09-16 11:30     ` Anand Jain
2022-10-11  9:46     ` David Sterba
2022-09-14 17:18 ` [PATCH 03/16] btrfs: move the printk helpers out of ctree.h Josef Bacik
2022-09-16 12:13   ` Anand Jain
2022-09-14 17:18 ` [PATCH 04/16] btrfs: push extra checks into __btrfs_abort_transaction Josef Bacik
2022-09-16 12:28   ` Anand Jain
2022-10-11  9:55   ` David Sterba
2022-09-14 17:18 ` [PATCH 05/16] btrfs: move assert and error helpers out of btrfs-printk.h Josef Bacik
2022-09-16 13:21   ` Anand Jain
2022-09-14 17:18 ` Josef Bacik [this message]
2022-09-19 12:24   ` [PATCH 06/16] btrfs: push printk index code into their respective helpers Anand Jain
2022-09-14 17:18 ` [PATCH 07/16] btrfs: move BTRFS_FS_STATE* defs and helpers to fs.h Josef Bacik
2022-09-19 12:25   ` Anand Jain
2022-09-14 17:18 ` [PATCH 08/16] btrfs: move incompat and compat flag helpers to fs.c Josef Bacik
2022-09-19 12:26   ` Anand Jain
2022-10-11 10:33   ` David Sterba
2022-10-11 12:01     ` David Sterba
2022-09-14 17:18 ` [PATCH 09/16] btrfs: move mount option definitions to fs.h Josef Bacik
2022-09-19 12:26   ` Anand Jain
2022-09-14 17:18 ` [PATCH 10/16] btrfs: move fs_info->flags enum " Josef Bacik
2022-09-19 12:27   ` Anand Jain
2022-09-14 17:18 ` [PATCH 11/16] btrfs: add a BTRFS_FS_NEED_TRANS_COMMIT flag Josef Bacik
2022-09-19 12:30   ` Anand Jain
2022-09-19 12:33     ` Anand Jain
2022-09-14 17:18 ` [PATCH 12/16] btrfs: remove fs_info::pending_changes and related code Josef Bacik
2022-09-19 12:41   ` Anand Jain
2022-10-11 10:20   ` David Sterba
2022-09-14 17:18 ` [PATCH 13/16] btrfs: move the compat/incompat flag masks to fs.h Josef Bacik
2022-09-19 12:44   ` Anand Jain
2022-09-14 17:18 ` [PATCH 14/16] btrfs: rename struct-funcs.c -> item-accessors.c Josef Bacik
2022-09-19 12:46   ` Anand Jain
2022-09-14 17:18 ` [PATCH 15/16] btrfs: move btrfs_map_token to item-accessors Josef Bacik
2022-09-19 12:53   ` Anand Jain
2022-10-11 10:39   ` David Sterba
2022-10-11 11:37     ` David Sterba
2022-09-14 17:18 ` [PATCH 16/16] btrfs: move accessor helpers into item-accessors.h Josef Bacik
2022-09-15  8:27   ` Anand Jain
2022-09-15  9:51 ` [PATCH 00/16] btrfs: split out larger chunks of ctree.h Qu Wenruo
2022-10-11 10:48   ` David Sterba
2022-10-10 20:28 ` David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ddcbbcbb41a182baf036d39a6a70e51bbe599f26.1663175597.git.josef@toxicpanda.com \
    --to=josef@toxicpanda.com \
    --cc=kernel-team@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox