* [PATCH 22/24] nilfs2: introduce option of showing internal errors
@ 2013-06-17 12:26 Vyacheslav Dubeyko
0 siblings, 0 replies; only message in thread
From: Vyacheslav Dubeyko @ 2013-06-17 12:26 UTC (permalink / raw)
To: linux-nilfs-u79uwXL29TY76Z2rM5mHXA; +Cc: Ryusuke Konishi, Linux FS Devel
From: Vyacheslav Dubeyko <slava-yeENwD64cLxBDgjK7y7TUQ@public.gmane.org>
Subject: [PATCH 22/24] nilfs2: introduce option of showing internal errors
This patch adds CONFIG_NILFS2_DEBUG_SHOW_ERRORS kernel configuration
option. This option enables writing in system log messages about
internal errors of NILFS2 driver. Every such message records file,
function, line and code of error.
Signed-off-by: Vyacheslav Dubeyko <slava-yeENwD64cLxBDgjK7y7TUQ@public.gmane.org>
CC: Ryusuke Konishi <konishi.ryusuke-Zyj7fXuS5i5L9jVzuh4AOg@public.gmane.org>
---
fs/nilfs2/Kconfig | 9 +++++++++
fs/nilfs2/debug.h | 38 ++++++++++++++++++++++++++++++++++++++
2 files changed, 47 insertions(+)
diff --git a/fs/nilfs2/Kconfig b/fs/nilfs2/Kconfig
index 37fee87..451a3a2 100644
--- a/fs/nilfs2/Kconfig
+++ b/fs/nilfs2/Kconfig
@@ -36,6 +36,15 @@ config NILFS2_DEBUG
if NILFS2_DEBUG
+config NILFS2_DEBUG_SHOW_ERRORS
+ bool "Show internal errors"
+ default n
+ help
+ This option enables writing in system log messages about internal
+ errors of NILFS2 driver. Every such message records file, function,
+ line and code of error. These types of debugging messages can be
+ very usefull for understanding and analyzing reasons of an issue.
+
config NILFS2_DEBUG_DUMP_STACK
bool "Enable dump stack output"
default n
diff --git a/fs/nilfs2/debug.h b/fs/nilfs2/debug.h
index 3132367..821fc75 100644
--- a/fs/nilfs2/debug.h
+++ b/fs/nilfs2/debug.h
@@ -27,6 +27,14 @@
#include <linux/printk.h>
/*
+ * This flag enables writing in system log messages about internal
+ * errors of NILFS2 driver. Every such message records file, function,
+ * line and code of error. These types of debugging messages can be
+ * very usefull for understanding and analyzing reasons of an issue.
+ */
+#define DBG_SHOW_ERR 0x10000000
+
+/*
* These flags enable debugging output in modules that
* implement base file system operations functionality
* (super.c, the_nilfs.c, namei.c, ioctl.c, inode.c,
@@ -124,6 +132,9 @@
/* Definition of flags' set for debugging */
static u32 DBG_MASK = (
+#ifdef CONFIG_NILFS2_DEBUG_SHOW_ERRORS
+ DBG_SHOW_ERR |
+#endif /* CONFIG_NILFS2_DEBUG_SHOW_ERRORS */
#ifdef CONFIG_NILFS2_DEBUG_BASE_OPERATIONS
DBG_SUPER | DBG_THE_NILFS | DBG_NAMEI |
DBG_IOCTL | DBG_INODE | DBG_FILE | DBG_DIR |
@@ -210,11 +221,38 @@ static u32 DBG_MASK = (
} \
} while (0)
+static inline int nilfs2_error_dbg(unsigned int flg,
+ const unsigned char *file,
+ int line,
+ const unsigned char *func,
+ int err)
+{
+ bool can_show_err = DBG_MASK & DBG_SHOW_ERR;
+ bool should_show_err = flg & DBG_SHOW_ERR;
+
+ if (can_show_err && should_show_err) {
+ printk(KERN_DEBUG "NILFS DBGERR (%s, %d): %s: err %d\n",
+ file, line, func, err);
+ }
+ return err;
+}
+
#else /* CONFIG_NILFS2_DEBUG */
#define nilfs2_debug(flg, fmt, ...) no_printk(fmt, ##__VA_ARGS__)
#define nilfs2_hexdump(flg, prefix, ptr, size) no_printk(prefix)
+static inline int nilfs2_error_dbg(unsigned int flg,
+ const unsigned char *file,
+ int line,
+ const unsigned char *func,
+ int err)
+{
+ return err;
+}
#endif /* CONFIG_NILFS2_DEBUG */
+#define NILFS_ERR_DBG(err) \
+ nilfs2_error_dbg(DBG_SHOW_ERR, __FILE__, __LINE__, __func__, err)
+
#endif /* _NILFS_DEBUG_H */
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2013-06-17 12:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-17 12:26 [PATCH 22/24] nilfs2: introduce option of showing internal errors Vyacheslav Dubeyko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).