linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vyacheslav Dubeyko <slava-yeENwD64cLxBDgjK7y7TUQ@public.gmane.org>
To: linux-nilfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Ryusuke Konishi
	<konishi.ryusuke-Zyj7fXuS5i5L9jVzuh4AOg@public.gmane.org>,
	Linux FS Devel
	<linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: [PATCH 22/24] nilfs2: introduce option of showing internal errors
Date: Mon, 17 Jun 2013 16:26:41 +0400	[thread overview]
Message-ID: <1371472001.2075.154.camel@slavad-ubuntu> (raw)

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

                 reply	other threads:[~2013-06-17 12:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1371472001.2075.154.camel@slavad-ubuntu \
    --to=slava-yeenwd64clxbdgjk7y7tuq@public.gmane.org \
    --cc=konishi.ryusuke-Zyj7fXuS5i5L9jVzuh4AOg@public.gmane.org \
    --cc=linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-nilfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.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;
as well as URLs for NNTP newsgroup(s).