remove printk() from J_ASSERT macros
Subsystems (2)
cover remove printk() from J_ASSERT macros
The printk() in J_ASSERT clobbers registers, making it more difficult to determine what caused the assertion failure. We can deduce the assertion itself from the line number in the BUG() message, so let's just use that, and keep our registers intact for better debugging. While the hood is up, also remove a superfluous #define/#ifdef.
-- Chris
PATCH 1/2 jbd: remove printk() from J_ASSERT macros
From: Chris Snook <[email protected]>
Remove printk from J_ASSERT to preserve registers during BUG.
Signed-off-by Chris Snook <[email protected]>
include/linux/jbd.h +1 -15
@@ -246,17 +246,7 @@ typedef struct journal_superblock_s#include <linux/fs.h> #include <linux/sched.h> -#define JBD_ASSERTIONS -#ifdef JBD_ASSERTIONS -#define J_ASSERT (assert) \ -do { \ - if (!(assert)) { \ - printk (KERN_EMERG \ - "Assertion failure in %s() at %s:%d: \"%s\"\n", \ - __FUNCTION__, __FILE__, __LINE__, # assert); \ - BUG(); \ - } \ -} while (0) +#define J_ASSERT (assert) BUG_ON(!(assert))#if defined(CONFIG_BUFFER_DEBUG )void buffer_assertion_failure (struct buffer_head *bh);
@@ -272,10 +262,6 @@ void buffer_assertion_failure(struct buf#define J_ASSERT_JH (jh, expr) J_ASSERT(expr)#endif -#else -#define J_ASSERT (assert) do { } while (0) -#endif /* JBD_ASSERTIONS */ -#if defined(JBD_PARANOID_IOFAIL ) #define J_EXPECT(expr, why...) J_ASSERT(expr) #define J_EXPECT_BH(bh, expr, why...) J_ASSERT_BH(bh, expr)
PATCH 2/2 jbd2: remove printk() from J_ASSERT macros
In reply to Chris SnookFrom: Chris Snook <[email protected]>
Remove printk from J_ASSERT to preserve registers during BUG.
Signed-off-by Chris Snook <[email protected]>
include/linux/jbd2.h +1 -15
@@ -255,17 +255,7 @@ typedef struct journal_superblock_s#include <linux/fs.h> #include <linux/sched.h> -#define JBD_ASSERTIONS -#ifdef JBD_ASSERTIONS -#define J_ASSERT (assert) \ -do { \ - if (!(assert)) { \ - printk (KERN_EMERG \ - "Assertion failure in %s() at %s:%d: \"%s\"\n", \ - __FUNCTION__, __FILE__, __LINE__, # assert); \ - BUG(); \ - } \ -} while (0) +#define J_ASSERT (assert) BUG_ON(!(assert))#if defined(CONFIG_BUFFER_DEBUG )void buffer_assertion_failure (struct buffer_head *bh);
@@ -281,10 +271,6 @@ void buffer_assertion_failure(struct buf#define J_ASSERT_JH (jh, expr) J_ASSERT(expr)#endif -#else -#define J_ASSERT (assert) do { } while (0) -#endif /* JBD_ASSERTIONS */ -#if defined(JBD_PARANOID_IOFAIL ) #define J_EXPECT(expr, why...) J_ASSERT(expr) #define J_EXPECT_BH(bh, expr, why...) J_ASSERT_BH(bh, expr)