* [PATCH 0/2] remove printk() from J_ASSERT macros
@ 2007-08-20 14:19 Chris Snook
2007-08-20 14:24 ` [PATCH 1/2] jbd: " Chris Snook
2007-08-20 14:26 ` [PATCH 2/2] jbd2: " Chris Snook
0 siblings, 2 replies; 3+ messages in thread
From: Chris Snook @ 2007-08-20 14:19 UTC (permalink / raw)
To: Andrew Morton, Stephen Tweedie; +Cc: linux-fsdevel, Chris Snook
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] jbd: remove printk() from J_ASSERT macros
2007-08-20 14:19 [PATCH 0/2] remove printk() from J_ASSERT macros Chris Snook
@ 2007-08-20 14:24 ` Chris Snook
2007-08-20 14:26 ` [PATCH 2/2] jbd2: " Chris Snook
1 sibling, 0 replies; 3+ messages in thread
From: Chris Snook @ 2007-08-20 14:24 UTC (permalink / raw)
To: Andrew Morton, Stephen Tweedie; +Cc: linux-fsdevel
From: Chris Snook <csnook@redhat.com>
Remove printk from J_ASSERT to preserve registers during BUG.
Signed-off-by: Chris Snook <csnook@redhat.com>
--- linux-2.6.23-rc3-orig/include/linux/jbd.h 2007-07-08 19:32:17.000000000 -0400
+++ linux-2.6.23-rc3-patch/include/linux/jbd.h 2007-08-20 09:54:37.000000000 -0400
@@ -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)
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH 2/2] jbd2: remove printk() from J_ASSERT macros
2007-08-20 14:19 [PATCH 0/2] remove printk() from J_ASSERT macros Chris Snook
2007-08-20 14:24 ` [PATCH 1/2] jbd: " Chris Snook
@ 2007-08-20 14:26 ` Chris Snook
1 sibling, 0 replies; 3+ messages in thread
From: Chris Snook @ 2007-08-20 14:26 UTC (permalink / raw)
To: Andrew Morton, Stephen Tweedie; +Cc: linux-fsdevel
From: Chris Snook <csnook@redhat.com>
Remove printk from J_ASSERT to preserve registers during BUG.
Signed-off-by: Chris Snook <csnook@redhat.com>
--- linux-2.6.23-rc3-orig/include/linux/jbd2.h 2007-08-13 03:14:13.000000000 -0400
+++ linux-2.6.23-rc3-patch/include/linux/jbd2.h 2007-08-20 09:55:47.000000000 -0400
@@ -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)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-08-20 14:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-20 14:19 [PATCH 0/2] remove printk() from J_ASSERT macros Chris Snook
2007-08-20 14:24 ` [PATCH 1/2] jbd: " Chris Snook
2007-08-20 14:26 ` [PATCH 2/2] jbd2: " Chris Snook
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).