[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <6e3677254fdf5be549f88b2274e0d67523bc1773.1611287342.git.brookxu@tencent.com>
Date: Fri, 22 Jan 2021 14:43:20 +0800
From: Chunguang Xu <brookxu.cn@...il.com>
To: tytso@....edu, adilger.kernel@...ger.ca, jack@...e.com
Cc: linux-ext4@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [RFC PATCH 2/4] jbd2: introduce some new log interfaces
From: Chunguang Xu <brookxu@...cent.com>
Compared to directly using numbers to indicate levels, using abstract
error, warn, notice, info, debug to indicate levels may be more
convenient for code reading and writing. Similar to other kernel
modules, some basic log interfaces are introduced.
Signed-off-by: Chunguang Xu <brookxu@...cent.com>
---
include/linux/jbd2.h | 58 +++++++++++++++++++++++++++++++-------------
1 file changed, 41 insertions(+), 17 deletions(-)
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 600a2ea8324a..d3d3ed33be30 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -47,23 +47,6 @@
*/
#define JBD2_DEFAULT_MAX_COMMIT_AGE 5
-#ifdef CONFIG_JBD2_DEBUG
-/*
- * Define JBD2_EXPENSIVE_CHECKING to enable more expensive internal
- * consistency checks. By default we don't do this unless
- * CONFIG_JBD2_DEBUG is on.
- */
-#define JBD2_EXPENSIVE_CHECKING
-extern ushort jbd2_journal_enable_debug;
-void __jbd2_debug(int level, const char *file, const char *func,
- unsigned int line, const char *fmt, ...);
-
-#define jbd_debug(n, fmt, a...) \
- __jbd2_debug((n), __FILE__, __func__, __LINE__, (fmt), ##a)
-#else
-#define jbd_debug(n, fmt, a...) /**/
-#endif
-
extern void *jbd2_alloc(size_t size, gfp_t flags);
extern void jbd2_free(void *ptr, size_t size);
@@ -104,6 +87,47 @@ typedef struct jbd2_journal_handle handle_t; /* Atomic operation type */
* This is an opaque datatype.
**/
typedef struct journal_s journal_t; /* Journal control structure */
+
+#ifdef CONFIG_JBD2_DEBUG
+/*
+ * Define JBD2_EXPENSIVE_CHECKING to enable more expensive internal
+ * consistency checks. By default we don't do this unless
+ * CONFIG_JBD2_DEBUG is on.
+ */
+#define JBD2_EXPENSIVE_CHECKING
+void jbd2_log(int level, journal_t *j, const char *file, const char *func,
+ unsigned int line, const char *fmt, ...);
+
+#define JBD2_ERR 1 /* error conditions */
+#define JBD2_WARN 2 /* warning conditions */
+#define JBD2_NOTICE 3 /* normal but significant condition */
+#define JBD2_INFO 4 /* informational */
+#define JBD2_DEBUG 5 /* debug-level messages */
+
+#define jbd2_err(j, fmt, a...) \
+ jbd2_log(JBD2_ERR, j, __FILE__, __func__, __LINE__, (fmt), ##a)
+
+#define jbd2_warn(j, fmt, a...) \
+ jbd2_log(JBD2_WARN, j, __FILE__, __func__, __LINE__, (fmt), ##a)
+
+#define jbd2_notice(j, fmt, a...) \
+ jbd2_log(JBD2_NOTICE, j, __FILE__, __func__, __LINE__, (fmt), ##a)
+
+#define jbd2_info(j, fmt, a...) \
+ jbd2_log(JBD2_INFO, j, __FILE__, __func__, __LINE__, (fmt), ##a)
+
+#define jbd2_debug(j, fmt, a...) \
+ jbd2_log(JBD2_DEBUG, j, __FILE__, __func__, __LINE__, (fmt), ##a)
+
+#else
+
+#define jbd2_err(j, fmt, a...)
+#define jbd2_warn(j, fmt, a...)
+#define jbd2_notice(j, fmt, a...)
+#define jbd2_info(j, fmt, a...)
+#define jbd2_debug(j, fmt, a...)
+
+#endif
#endif
/*
--
2.30.0
Powered by blists - more mailing lists