diff options
author | Jeff Mahoney <jeffm@suse.com> | 2009-03-30 14:02:25 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-03-30 15:16:36 -0400 |
commit | c3a9c2109f84882b9b3178f6b1838d550d3df0ec (patch) | |
tree | 08a502b8013eabb562f03be45622b0f63b1a34b9 /fs/reiserfs/fix_node.c | |
parent | 78b6513d2881f1a759fb9825a036d926392de084 (diff) |
reiserfs: rework reiserfs_panic
ReiserFS panics can be somewhat inconsistent.
In some cases:
* a unique identifier may be associated with it
* the function name may be included
* the device may be printed separately
This patch aims to make warnings more consistent. reiserfs_warning() prints
the device name, so printing it a second time is not required. The function
name for a warning is always helpful in debugging, so it is now automatically
inserted into the output. Hans has stated that every warning should have
a unique identifier. Some cases lack them, others really shouldn't have them.
reiserfs_warning() now expects an id associated with each message. In the
rare case where one isn't needed, "" will suffice.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/reiserfs/fix_node.c')
-rw-r--r-- | fs/reiserfs/fix_node.c | 68 |
1 files changed, 35 insertions, 33 deletions
diff --git a/fs/reiserfs/fix_node.c b/fs/reiserfs/fix_node.c index 59735a9e2349..bbb37b0589af 100644 --- a/fs/reiserfs/fix_node.c +++ b/fs/reiserfs/fix_node.c | |||
@@ -135,8 +135,7 @@ static void create_virtual_node(struct tree_balance *tb, int h) | |||
135 | vn->vn_free_ptr += | 135 | vn->vn_free_ptr += |
136 | op_create_vi(vn, vi, is_affected, tb->insert_size[0]); | 136 | op_create_vi(vn, vi, is_affected, tb->insert_size[0]); |
137 | if (tb->vn_buf + tb->vn_buf_size < vn->vn_free_ptr) | 137 | if (tb->vn_buf + tb->vn_buf_size < vn->vn_free_ptr) |
138 | reiserfs_panic(tb->tb_sb, | 138 | reiserfs_panic(tb->tb_sb, "vs-8030", |
139 | "vs-8030: create_virtual_node: " | ||
140 | "virtual node space consumed"); | 139 | "virtual node space consumed"); |
141 | 140 | ||
142 | if (!is_affected) | 141 | if (!is_affected) |
@@ -186,8 +185,9 @@ static void create_virtual_node(struct tree_balance *tb, int h) | |||
186 | && I_ENTRY_COUNT(B_N_PITEM_HEAD(Sh, 0)) == 1)) { | 185 | && I_ENTRY_COUNT(B_N_PITEM_HEAD(Sh, 0)) == 1)) { |
187 | /* node contains more than 1 item, or item is not directory item, or this item contains more than 1 entry */ | 186 | /* node contains more than 1 item, or item is not directory item, or this item contains more than 1 entry */ |
188 | print_block(Sh, 0, -1, -1); | 187 | print_block(Sh, 0, -1, -1); |
189 | reiserfs_panic(tb->tb_sb, | 188 | reiserfs_panic(tb->tb_sb, "vs-8045", |
190 | "vs-8045: create_virtual_node: rdkey %k, affected item==%d (mode==%c) Must be %c", | 189 | "rdkey %k, affected item==%d " |
190 | "(mode==%c) Must be %c", | ||
191 | key, vn->vn_affected_item_num, | 191 | key, vn->vn_affected_item_num, |
192 | vn->vn_mode, M_DELETE); | 192 | vn->vn_mode, M_DELETE); |
193 | } | 193 | } |
@@ -1255,8 +1255,8 @@ static int ip_check_balance(struct tree_balance *tb, int h) | |||
1255 | /* Calculate balance parameters for creating new root. */ | 1255 | /* Calculate balance parameters for creating new root. */ |
1256 | if (!Sh) { | 1256 | if (!Sh) { |
1257 | if (!h) | 1257 | if (!h) |
1258 | reiserfs_panic(tb->tb_sb, | 1258 | reiserfs_panic(tb->tb_sb, "vs-8210", |
1259 | "vs-8210: ip_check_balance: S[0] can not be 0"); | 1259 | "S[0] can not be 0"); |
1260 | switch (n_ret_value = get_empty_nodes(tb, h)) { | 1260 | switch (n_ret_value = get_empty_nodes(tb, h)) { |
1261 | case CARRY_ON: | 1261 | case CARRY_ON: |
1262 | set_parameters(tb, h, 0, 0, 1, NULL, -1, -1); | 1262 | set_parameters(tb, h, 0, 0, 1, NULL, -1, -1); |
@@ -1266,8 +1266,8 @@ static int ip_check_balance(struct tree_balance *tb, int h) | |||
1266 | case REPEAT_SEARCH: | 1266 | case REPEAT_SEARCH: |
1267 | return n_ret_value; | 1267 | return n_ret_value; |
1268 | default: | 1268 | default: |
1269 | reiserfs_panic(tb->tb_sb, | 1269 | reiserfs_panic(tb->tb_sb, "vs-8215", "incorrect " |
1270 | "vs-8215: ip_check_balance: incorrect return value of get_empty_nodes"); | 1270 | "return value of get_empty_nodes"); |
1271 | } | 1271 | } |
1272 | } | 1272 | } |
1273 | 1273 | ||
@@ -2095,38 +2095,38 @@ static void tb_buffer_sanity_check(struct super_block *p_s_sb, | |||
2095 | if (p_s_bh) { | 2095 | if (p_s_bh) { |
2096 | if (atomic_read(&(p_s_bh->b_count)) <= 0) { | 2096 | if (atomic_read(&(p_s_bh->b_count)) <= 0) { |
2097 | 2097 | ||
2098 | reiserfs_panic(p_s_sb, | 2098 | reiserfs_panic(p_s_sb, "jmacd-1", "negative or zero " |
2099 | "jmacd-1: tb_buffer_sanity_check(): negative or zero reference counter for buffer %s[%d] (%b)\n", | 2099 | "reference counter for buffer %s[%d] " |
2100 | descr, level, p_s_bh); | 2100 | "(%b)", descr, level, p_s_bh); |
2101 | } | 2101 | } |
2102 | 2102 | ||
2103 | if (!buffer_uptodate(p_s_bh)) { | 2103 | if (!buffer_uptodate(p_s_bh)) { |
2104 | reiserfs_panic(p_s_sb, | 2104 | reiserfs_panic(p_s_sb, "jmacd-2", "buffer is not up " |
2105 | "jmacd-2: tb_buffer_sanity_check(): buffer is not up to date %s[%d] (%b)\n", | 2105 | "to date %s[%d] (%b)", |
2106 | descr, level, p_s_bh); | 2106 | descr, level, p_s_bh); |
2107 | } | 2107 | } |
2108 | 2108 | ||
2109 | if (!B_IS_IN_TREE(p_s_bh)) { | 2109 | if (!B_IS_IN_TREE(p_s_bh)) { |
2110 | reiserfs_panic(p_s_sb, | 2110 | reiserfs_panic(p_s_sb, "jmacd-3", "buffer is not " |
2111 | "jmacd-3: tb_buffer_sanity_check(): buffer is not in tree %s[%d] (%b)\n", | 2111 | "in tree %s[%d] (%b)", |
2112 | descr, level, p_s_bh); | 2112 | descr, level, p_s_bh); |
2113 | } | 2113 | } |
2114 | 2114 | ||
2115 | if (p_s_bh->b_bdev != p_s_sb->s_bdev) { | 2115 | if (p_s_bh->b_bdev != p_s_sb->s_bdev) { |
2116 | reiserfs_panic(p_s_sb, | 2116 | reiserfs_panic(p_s_sb, "jmacd-4", "buffer has wrong " |
2117 | "jmacd-4: tb_buffer_sanity_check(): buffer has wrong device %s[%d] (%b)\n", | 2117 | "device %s[%d] (%b)", |
2118 | descr, level, p_s_bh); | 2118 | descr, level, p_s_bh); |
2119 | } | 2119 | } |
2120 | 2120 | ||
2121 | if (p_s_bh->b_size != p_s_sb->s_blocksize) { | 2121 | if (p_s_bh->b_size != p_s_sb->s_blocksize) { |
2122 | reiserfs_panic(p_s_sb, | 2122 | reiserfs_panic(p_s_sb, "jmacd-5", "buffer has wrong " |
2123 | "jmacd-5: tb_buffer_sanity_check(): buffer has wrong blocksize %s[%d] (%b)\n", | 2123 | "blocksize %s[%d] (%b)", |
2124 | descr, level, p_s_bh); | 2124 | descr, level, p_s_bh); |
2125 | } | 2125 | } |
2126 | 2126 | ||
2127 | if (p_s_bh->b_blocknr > SB_BLOCK_COUNT(p_s_sb)) { | 2127 | if (p_s_bh->b_blocknr > SB_BLOCK_COUNT(p_s_sb)) { |
2128 | reiserfs_panic(p_s_sb, | 2128 | reiserfs_panic(p_s_sb, "jmacd-6", "buffer block " |
2129 | "jmacd-6: tb_buffer_sanity_check(): buffer block number too high %s[%d] (%b)\n", | 2129 | "number too high %s[%d] (%b)", |
2130 | descr, level, p_s_bh); | 2130 | descr, level, p_s_bh); |
2131 | } | 2131 | } |
2132 | } | 2132 | } |
@@ -2358,14 +2358,14 @@ int fix_nodes(int n_op_mode, struct tree_balance *p_s_tb, struct item_head *p_s_ | |||
2358 | #ifdef CONFIG_REISERFS_CHECK | 2358 | #ifdef CONFIG_REISERFS_CHECK |
2359 | if (cur_tb) { | 2359 | if (cur_tb) { |
2360 | print_cur_tb("fix_nodes"); | 2360 | print_cur_tb("fix_nodes"); |
2361 | reiserfs_panic(p_s_tb->tb_sb, | 2361 | reiserfs_panic(p_s_tb->tb_sb, "PAP-8305", |
2362 | "PAP-8305: fix_nodes: there is pending do_balance"); | 2362 | "there is pending do_balance"); |
2363 | } | 2363 | } |
2364 | 2364 | ||
2365 | if (!buffer_uptodate(p_s_tbS0) || !B_IS_IN_TREE(p_s_tbS0)) { | 2365 | if (!buffer_uptodate(p_s_tbS0) || !B_IS_IN_TREE(p_s_tbS0)) { |
2366 | reiserfs_panic(p_s_tb->tb_sb, | 2366 | reiserfs_panic(p_s_tb->tb_sb, "PAP-8320", "S[0] (%b %z) is " |
2367 | "PAP-8320: fix_nodes: S[0] (%b %z) is not uptodate " | 2367 | "not uptodate at the beginning of fix_nodes " |
2368 | "at the beginning of fix_nodes or not in tree (mode %c)", | 2368 | "or not in tree (mode %c)", |
2369 | p_s_tbS0, p_s_tbS0, n_op_mode); | 2369 | p_s_tbS0, p_s_tbS0, n_op_mode); |
2370 | } | 2370 | } |
2371 | 2371 | ||
@@ -2373,24 +2373,26 @@ int fix_nodes(int n_op_mode, struct tree_balance *p_s_tb, struct item_head *p_s_ | |||
2373 | switch (n_op_mode) { | 2373 | switch (n_op_mode) { |
2374 | case M_INSERT: | 2374 | case M_INSERT: |
2375 | if (n_item_num <= 0 || n_item_num > B_NR_ITEMS(p_s_tbS0)) | 2375 | if (n_item_num <= 0 || n_item_num > B_NR_ITEMS(p_s_tbS0)) |
2376 | reiserfs_panic(p_s_tb->tb_sb, | 2376 | reiserfs_panic(p_s_tb->tb_sb, "PAP-8330", "Incorrect " |
2377 | "PAP-8330: fix_nodes: Incorrect item number %d (in S0 - %d) in case of insert", | 2377 | "item number %d (in S0 - %d) in case " |
2378 | n_item_num, B_NR_ITEMS(p_s_tbS0)); | 2378 | "of insert", n_item_num, |
2379 | B_NR_ITEMS(p_s_tbS0)); | ||
2379 | break; | 2380 | break; |
2380 | case M_PASTE: | 2381 | case M_PASTE: |
2381 | case M_DELETE: | 2382 | case M_DELETE: |
2382 | case M_CUT: | 2383 | case M_CUT: |
2383 | if (n_item_num < 0 || n_item_num >= B_NR_ITEMS(p_s_tbS0)) { | 2384 | if (n_item_num < 0 || n_item_num >= B_NR_ITEMS(p_s_tbS0)) { |
2384 | print_block(p_s_tbS0, 0, -1, -1); | 2385 | print_block(p_s_tbS0, 0, -1, -1); |
2385 | reiserfs_panic(p_s_tb->tb_sb, | 2386 | reiserfs_panic(p_s_tb->tb_sb, "PAP-8335", "Incorrect " |
2386 | "PAP-8335: fix_nodes: Incorrect item number(%d); mode = %c insert_size = %d\n", | 2387 | "item number(%d); mode = %c " |
2388 | "insert_size = %d", | ||
2387 | n_item_num, n_op_mode, | 2389 | n_item_num, n_op_mode, |
2388 | p_s_tb->insert_size[0]); | 2390 | p_s_tb->insert_size[0]); |
2389 | } | 2391 | } |
2390 | break; | 2392 | break; |
2391 | default: | 2393 | default: |
2392 | reiserfs_panic(p_s_tb->tb_sb, | 2394 | reiserfs_panic(p_s_tb->tb_sb, "PAP-8340", "Incorrect mode " |
2393 | "PAP-8340: fix_nodes: Incorrect mode of operation"); | 2395 | "of operation"); |
2394 | } | 2396 | } |
2395 | #endif | 2397 | #endif |
2396 | 2398 | ||