From d0dc80dbafb5c10ad2084831a61bbf945484a139 Mon Sep 17 00:00:00 2001 From: Steven Whitehouse Date: Wed, 29 Mar 2006 14:36:49 -0500 Subject: [GFS2] Update debugging code Update the debugging code in trans.c and at the same time improve the debugging code for gfs2_holders. The new code should be pretty fast during the normal case and provide just as much information in case of errors (or more). One small function from glock.c has moved to glock.h as a static inline so that its return address won't get in the way of the debugging. Signed-off-by: Steven Whitehouse --- fs/gfs2/trans.c | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) (limited to 'fs/gfs2/trans.c') diff --git a/fs/gfs2/trans.c b/fs/gfs2/trans.c index aa1a619..3fae3d4 100644 --- a/fs/gfs2/trans.c +++ b/fs/gfs2/trans.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include "gfs2.h" @@ -25,24 +26,20 @@ #include "trans.h" #include "util.h" -int gfs2_trans_begin_i(struct gfs2_sbd *sdp, unsigned int blocks, - unsigned int revokes, char *file, unsigned int line) +int gfs2_trans_begin(struct gfs2_sbd *sdp, unsigned int blocks, + unsigned int revokes) { struct gfs2_trans *tr; int error; - if (gfs2_assert_warn(sdp, !current->journal_info) || - gfs2_assert_warn(sdp, blocks || revokes)) { - fs_warn(sdp, "(%s, %u)\n", file, line); - return -EINVAL; - } + BUG_ON(current->journal_info); + BUG_ON(blocks == 0 && revokes == 0); tr = kzalloc(sizeof(struct gfs2_trans), GFP_NOFS); if (!tr) return -ENOMEM; - tr->tr_file = file; - tr->tr_line = line; + tr->tr_ip = (unsigned long)__builtin_return_address(0); tr->tr_blocks = blocks; tr->tr_revokes = revokes; tr->tr_reserved = 1; @@ -104,16 +101,15 @@ void gfs2_trans_end(struct gfs2_sbd *sdp) return; } - if (gfs2_assert_withdraw(sdp, tr->tr_num_buf <= tr->tr_blocks)) - fs_err(sdp, "tr_num_buf = %u, tr_blocks = %u " - "tr_file = %s, tr_line = %u\n", - tr->tr_num_buf, tr->tr_blocks, - tr->tr_file, tr->tr_line); + if (gfs2_assert_withdraw(sdp, tr->tr_num_buf <= tr->tr_blocks)) { + fs_err(sdp, "tr_num_buf = %u, tr_blocks = %u ", + tr->tr_num_buf, tr->tr_blocks); + print_symbol(KERN_WARNING "GFS2: Transaction created at: %s\n", tr->tr_ip); + } if (gfs2_assert_withdraw(sdp, tr->tr_num_revoke <= tr->tr_revokes)) - fs_err(sdp, "tr_num_revoke = %u, tr_revokes = %u " - "tr_file = %s, tr_line = %u\n", - tr->tr_num_revoke, tr->tr_revokes, - tr->tr_file, tr->tr_line); + fs_err(sdp, "tr_num_revoke = %u, tr_revokes = %u ", + tr->tr_num_revoke, tr->tr_revokes); + print_symbol(KERN_WARNING "GFS2: Transaction created at: %s\n", tr->tr_ip); gfs2_log_commit(sdp, tr); -- cgit v1.1