aboutsummaryrefslogtreecommitdiffstats
path: root/fs/reiserfs
diff options
context:
space:
mode:
authorJeff Mahoney <jeffm@suse.com>2009-03-30 14:02:25 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-03-30 15:16:36 -0400
commitc3a9c2109f84882b9b3178f6b1838d550d3df0ec (patch)
tree08a502b8013eabb562f03be45622b0f63b1a34b9 /fs/reiserfs
parent78b6513d2881f1a759fb9825a036d926392de084 (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')
-rw-r--r--fs/reiserfs/do_balan.c67
-rw-r--r--fs/reiserfs/fix_node.c68
-rw-r--r--fs/reiserfs/ibalance.c12
-rw-r--r--fs/reiserfs/inode.c3
-rw-r--r--fs/reiserfs/item_ops.c8
-rw-r--r--fs/reiserfs/journal.c57
-rw-r--r--fs/reiserfs/lbalance.c27
-rw-r--r--fs/reiserfs/namei.c18
-rw-r--r--fs/reiserfs/objectid.c3
-rw-r--r--fs/reiserfs/prints.c33
-rw-r--r--fs/reiserfs/stree.c49
-rw-r--r--fs/reiserfs/tail_conversion.c10
12 files changed, 178 insertions, 177 deletions
diff --git a/fs/reiserfs/do_balan.c b/fs/reiserfs/do_balan.c
index f701f37ddf98..e788fbc3ff6b 100644
--- a/fs/reiserfs/do_balan.c
+++ b/fs/reiserfs/do_balan.c
@@ -153,8 +153,8 @@ static int balance_leaf_when_delete(struct tree_balance *tb, int flag)
153 153
154 default: 154 default:
155 print_cur_tb("12040"); 155 print_cur_tb("12040");
156 reiserfs_panic(tb->tb_sb, 156 reiserfs_panic(tb->tb_sb, "PAP-12040",
157 "PAP-12040: balance_leaf_when_delete: unexpectable mode: %s(%d)", 157 "unexpected mode: %s(%d)",
158 (flag == 158 (flag ==
159 M_PASTE) ? "PASTE" : ((flag == 159 M_PASTE) ? "PASTE" : ((flag ==
160 M_INSERT) ? "INSERT" : 160 M_INSERT) ? "INSERT" :
@@ -721,8 +721,9 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
721 } 721 }
722 break; 722 break;
723 default: /* cases d and t */ 723 default: /* cases d and t */
724 reiserfs_panic(tb->tb_sb, 724 reiserfs_panic(tb->tb_sb, "PAP-12130",
725 "PAP-12130: balance_leaf: lnum > 0: unexpectable mode: %s(%d)", 725 "lnum > 0: unexpected mode: "
726 " %s(%d)",
726 (flag == 727 (flag ==
727 M_DELETE) ? "DELETE" : ((flag == 728 M_DELETE) ? "DELETE" : ((flag ==
728 M_CUT) 729 M_CUT)
@@ -1134,8 +1135,8 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
1134 } 1135 }
1135 break; 1136 break;
1136 default: /* cases d and t */ 1137 default: /* cases d and t */
1137 reiserfs_panic(tb->tb_sb, 1138 reiserfs_panic(tb->tb_sb, "PAP-12175",
1138 "PAP-12175: balance_leaf: rnum > 0: unexpectable mode: %s(%d)", 1139 "rnum > 0: unexpected mode: %s(%d)",
1139 (flag == 1140 (flag ==
1140 M_DELETE) ? "DELETE" : ((flag == 1141 M_DELETE) ? "DELETE" : ((flag ==
1141 M_CUT) ? "CUT" 1142 M_CUT) ? "CUT"
@@ -1165,8 +1166,8 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
1165 not set correctly */ 1166 not set correctly */
1166 if (tb->CFL[0]) { 1167 if (tb->CFL[0]) {
1167 if (!tb->CFR[0]) 1168 if (!tb->CFR[0])
1168 reiserfs_panic(tb->tb_sb, 1169 reiserfs_panic(tb->tb_sb, "vs-12195",
1169 "vs-12195: balance_leaf: CFR not initialized"); 1170 "CFR not initialized");
1170 copy_key(B_N_PDELIM_KEY(tb->CFL[0], tb->lkey[0]), 1171 copy_key(B_N_PDELIM_KEY(tb->CFL[0], tb->lkey[0]),
1171 B_N_PDELIM_KEY(tb->CFR[0], tb->rkey[0])); 1172 B_N_PDELIM_KEY(tb->CFR[0], tb->rkey[0]));
1172 do_balance_mark_internal_dirty(tb, tb->CFL[0], 0); 1173 do_balance_mark_internal_dirty(tb, tb->CFL[0], 0);
@@ -1472,7 +1473,10 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
1472 && (pos_in_item != ih_item_len(ih_check) 1473 && (pos_in_item != ih_item_len(ih_check)
1473 || tb->insert_size[0] <= 0)) 1474 || tb->insert_size[0] <= 0))
1474 reiserfs_panic(tb->tb_sb, 1475 reiserfs_panic(tb->tb_sb,
1475 "PAP-12235: balance_leaf: pos_in_item must be equal to ih_item_len"); 1476 "PAP-12235",
1477 "pos_in_item "
1478 "must be equal "
1479 "to ih_item_len");
1476#endif /* CONFIG_REISERFS_CHECK */ 1480#endif /* CONFIG_REISERFS_CHECK */
1477 1481
1478 leaf_mi = 1482 leaf_mi =
@@ -1532,8 +1536,8 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
1532 } 1536 }
1533 break; 1537 break;
1534 default: /* cases d and t */ 1538 default: /* cases d and t */
1535 reiserfs_panic(tb->tb_sb, 1539 reiserfs_panic(tb->tb_sb, "PAP-12245",
1536 "PAP-12245: balance_leaf: blknum > 2: unexpectable mode: %s(%d)", 1540 "blknum > 2: unexpected mode: %s(%d)",
1537 (flag == 1541 (flag ==
1538 M_DELETE) ? "DELETE" : ((flag == 1542 M_DELETE) ? "DELETE" : ((flag ==
1539 M_CUT) ? "CUT" 1543 M_CUT) ? "CUT"
@@ -1678,10 +1682,11 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
1678 print_cur_tb("12285"); 1682 print_cur_tb("12285");
1679 reiserfs_panic(tb-> 1683 reiserfs_panic(tb->
1680 tb_sb, 1684 tb_sb,
1681 "PAP-12285: balance_leaf: insert_size must be 0 (%d)", 1685 "PAP-12285",
1682 tb-> 1686 "insert_size "
1683 insert_size 1687 "must be 0 "
1684 [0]); 1688 "(%d)",
1689 tb->insert_size[0]);
1685 } 1690 }
1686 } 1691 }
1687#endif /* CONFIG_REISERFS_CHECK */ 1692#endif /* CONFIG_REISERFS_CHECK */
@@ -1694,11 +1699,10 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
1694 if (flag == M_PASTE && tb->insert_size[0]) { 1699 if (flag == M_PASTE && tb->insert_size[0]) {
1695 print_cur_tb("12290"); 1700 print_cur_tb("12290");
1696 reiserfs_panic(tb->tb_sb, 1701 reiserfs_panic(tb->tb_sb,
1697 "PAP-12290: balance_leaf: insert_size is still not 0 (%d)", 1702 "PAP-12290", "insert_size is still not 0 (%d)",
1698 tb->insert_size[0]); 1703 tb->insert_size[0]);
1699 } 1704 }
1700#endif /* CONFIG_REISERFS_CHECK */ 1705#endif /* CONFIG_REISERFS_CHECK */
1701
1702 return 0; 1706 return 0;
1703} /* Leaf level of the tree is balanced (end of balance_leaf) */ 1707} /* Leaf level of the tree is balanced (end of balance_leaf) */
1704 1708
@@ -1729,8 +1733,7 @@ struct buffer_head *get_FEB(struct tree_balance *tb)
1729 break; 1733 break;
1730 1734
1731 if (i == MAX_FEB_SIZE) 1735 if (i == MAX_FEB_SIZE)
1732 reiserfs_panic(tb->tb_sb, 1736 reiserfs_panic(tb->tb_sb, "vs-12300", "FEB list is empty");
1733 "vs-12300: get_FEB: FEB list is empty");
1734 1737
1735 bi.tb = tb; 1738 bi.tb = tb;
1736 bi.bi_bh = first_b = tb->FEB[i]; 1739 bi.bi_bh = first_b = tb->FEB[i];
@@ -1871,8 +1874,8 @@ static void check_internal_node(struct super_block *s, struct buffer_head *bh,
1871 for (i = 0; i <= B_NR_ITEMS(bh); i++, dc++) { 1874 for (i = 0; i <= B_NR_ITEMS(bh); i++, dc++) {
1872 if (!is_reusable(s, dc_block_number(dc), 1)) { 1875 if (!is_reusable(s, dc_block_number(dc), 1)) {
1873 print_cur_tb(mes); 1876 print_cur_tb(mes);
1874 reiserfs_panic(s, 1877 reiserfs_panic(s, "PAP-12338",
1875 "PAP-12338: check_internal_node: invalid child pointer %y in %b", 1878 "invalid child pointer %y in %b",
1876 dc, bh); 1879 dc, bh);
1877 } 1880 }
1878 } 1881 }
@@ -1894,9 +1897,10 @@ static int check_before_balancing(struct tree_balance *tb)
1894 int retval = 0; 1897 int retval = 0;
1895 1898
1896 if (cur_tb) { 1899 if (cur_tb) {
1897 reiserfs_panic(tb->tb_sb, "vs-12335: check_before_balancing: " 1900 reiserfs_panic(tb->tb_sb, "vs-12335", "suspect that schedule "
1898 "suspect that schedule occurred based on cur_tb not being null at this point in code. " 1901 "occurred based on cur_tb not being null at "
1899 "do_balance cannot properly handle schedule occurring while it runs."); 1902 "this point in code. do_balance cannot properly "
1903 "handle schedule occurring while it runs.");
1900 } 1904 }
1901 1905
1902 /* double check that buffers that we will modify are unlocked. (fix_nodes should already have 1906 /* double check that buffers that we will modify are unlocked. (fix_nodes should already have
@@ -1928,8 +1932,8 @@ static void check_after_balance_leaf(struct tree_balance *tb)
1928 dc_size(B_N_CHILD 1932 dc_size(B_N_CHILD
1929 (tb->FL[0], get_left_neighbor_position(tb, 0)))) { 1933 (tb->FL[0], get_left_neighbor_position(tb, 0)))) {
1930 print_cur_tb("12221"); 1934 print_cur_tb("12221");
1931 reiserfs_panic(tb->tb_sb, 1935 reiserfs_panic(tb->tb_sb, "PAP-12355",
1932 "PAP-12355: check_after_balance_leaf: shift to left was incorrect"); 1936 "shift to left was incorrect");
1933 } 1937 }
1934 } 1938 }
1935 if (tb->rnum[0]) { 1939 if (tb->rnum[0]) {
@@ -1938,8 +1942,8 @@ static void check_after_balance_leaf(struct tree_balance *tb)
1938 dc_size(B_N_CHILD 1942 dc_size(B_N_CHILD
1939 (tb->FR[0], get_right_neighbor_position(tb, 0)))) { 1943 (tb->FR[0], get_right_neighbor_position(tb, 0)))) {
1940 print_cur_tb("12222"); 1944 print_cur_tb("12222");
1941 reiserfs_panic(tb->tb_sb, 1945 reiserfs_panic(tb->tb_sb, "PAP-12360",
1942 "PAP-12360: check_after_balance_leaf: shift to right was incorrect"); 1946 "shift to right was incorrect");
1943 } 1947 }
1944 } 1948 }
1945 if (PATH_H_PBUFFER(tb->tb_path, 1) && 1949 if (PATH_H_PBUFFER(tb->tb_path, 1) &&
@@ -1964,8 +1968,7 @@ static void check_after_balance_leaf(struct tree_balance *tb)
1964 (PATH_H_PBUFFER(tb->tb_path, 1), 1968 (PATH_H_PBUFFER(tb->tb_path, 1),
1965 PATH_H_POSITION(tb->tb_path, 1))), 1969 PATH_H_POSITION(tb->tb_path, 1))),
1966 right); 1970 right);
1967 reiserfs_panic(tb->tb_sb, 1971 reiserfs_panic(tb->tb_sb, "PAP-12365", "S is incorrect");
1968 "PAP-12365: check_after_balance_leaf: S is incorrect");
1969 } 1972 }
1970} 1973}
1971 1974
@@ -2100,8 +2103,8 @@ void do_balance(struct tree_balance *tb, /* tree_balance structure */
2100 tb->need_balance_dirty = 0; 2103 tb->need_balance_dirty = 0;
2101 2104
2102 if (FILESYSTEM_CHANGED_TB(tb)) { 2105 if (FILESYSTEM_CHANGED_TB(tb)) {
2103 reiserfs_panic(tb->tb_sb, 2106 reiserfs_panic(tb->tb_sb, "clm-6000", "fs generation has "
2104 "clm-6000: do_balance, fs generation has changed\n"); 2107 "changed");
2105 } 2108 }
2106 /* if we have no real work to do */ 2109 /* if we have no real work to do */
2107 if (!tb->insert_size[0]) { 2110 if (!tb->insert_size[0]) {
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
diff --git a/fs/reiserfs/ibalance.c b/fs/reiserfs/ibalance.c
index de391a82b999..063b5514fe29 100644
--- a/fs/reiserfs/ibalance.c
+++ b/fs/reiserfs/ibalance.c
@@ -105,8 +105,8 @@ static void internal_define_dest_src_infos(int shift_mode,
105 break; 105 break;
106 106
107 default: 107 default:
108 reiserfs_panic(tb->tb_sb, 108 reiserfs_panic(tb->tb_sb, "ibalance-1",
109 "internal_define_dest_src_infos: shift type is unknown (%d)", 109 "shift type is unknown (%d)",
110 shift_mode); 110 shift_mode);
111 } 111 }
112} 112}
@@ -702,8 +702,8 @@ static void balance_internal_when_delete(struct tree_balance *tb,
702 702
703 return; 703 return;
704 } 704 }
705 reiserfs_panic(tb->tb_sb, 705 reiserfs_panic(tb->tb_sb, "ibalance-2",
706 "balance_internal_when_delete: unexpected tb->lnum[%d]==%d or tb->rnum[%d]==%d", 706 "unexpected tb->lnum[%d]==%d or tb->rnum[%d]==%d",
707 h, tb->lnum[h], h, tb->rnum[h]); 707 h, tb->lnum[h], h, tb->rnum[h]);
708} 708}
709 709
@@ -940,8 +940,8 @@ int balance_internal(struct tree_balance *tb, /* tree_balance structure
940 struct block_head *blkh; 940 struct block_head *blkh;
941 941
942 if (tb->blknum[h] != 1) 942 if (tb->blknum[h] != 1)
943 reiserfs_panic(NULL, 943 reiserfs_panic(NULL, "ibalance-3", "One new node "
944 "balance_internal: One new node required for creating the new root"); 944 "required for creating the new root");
945 /* S[h] = empty buffer from the list FEB. */ 945 /* S[h] = empty buffer from the list FEB. */
946 tbSh = get_FEB(tb); 946 tbSh = get_FEB(tb);
947 blkh = B_BLK_HEAD(tbSh); 947 blkh = B_BLK_HEAD(tbSh);
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index 95157762b1bf..7ee0097004c0 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -1300,8 +1300,7 @@ static void update_stat_data(struct treepath *path, struct inode *inode,
1300 ih = PATH_PITEM_HEAD(path); 1300 ih = PATH_PITEM_HEAD(path);
1301 1301
1302 if (!is_statdata_le_ih(ih)) 1302 if (!is_statdata_le_ih(ih))
1303 reiserfs_panic(inode->i_sb, 1303 reiserfs_panic(inode->i_sb, "vs-13065", "key %k, found item %h",
1304 "vs-13065: update_stat_data: key %k, found item %h",
1305 INODE_PKEY(inode), ih); 1304 INODE_PKEY(inode), ih);
1306 1305
1307 if (stat_data_v1(ih)) { 1306 if (stat_data_v1(ih)) {
diff --git a/fs/reiserfs/item_ops.c b/fs/reiserfs/item_ops.c
index 8a11cf39f57b..72cb1cc51b87 100644
--- a/fs/reiserfs/item_ops.c
+++ b/fs/reiserfs/item_ops.c
@@ -517,8 +517,9 @@ static int direntry_create_vi(struct virtual_node *vn,
517 ((is_affected 517 ((is_affected
518 && (vn->vn_mode == M_PASTE 518 && (vn->vn_mode == M_PASTE
519 || vn->vn_mode == M_CUT)) ? insert_size : 0)) { 519 || vn->vn_mode == M_CUT)) ? insert_size : 0)) {
520 reiserfs_panic(NULL, 520 reiserfs_panic(NULL, "vs-8025", "(mode==%c, "
521 "vs-8025: set_entry_sizes: (mode==%c, insert_size==%d), invalid length of directory item", 521 "insert_size==%d), invalid length of "
522 "directory item",
522 vn->vn_mode, insert_size); 523 vn->vn_mode, insert_size);
523 } 524 }
524 } 525 }
@@ -549,7 +550,8 @@ static int direntry_check_left(struct virtual_item *vi, int free,
549 } 550 }
550 551
551 if (entries == dir_u->entry_count) { 552 if (entries == dir_u->entry_count) {
552 reiserfs_panic(NULL, "free space %d, entry_count %d\n", free, 553 reiserfs_panic(NULL, "item_ops-1",
554 "free space %d, entry_count %d", free,
553 dir_u->entry_count); 555 dir_u->entry_count);
554 } 556 }
555 557
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c
index 88a031fafd07..774f3ba37409 100644
--- a/fs/reiserfs/journal.c
+++ b/fs/reiserfs/journal.c
@@ -436,8 +436,8 @@ void reiserfs_check_lock_depth(struct super_block *sb, char *caller)
436{ 436{
437#ifdef CONFIG_SMP 437#ifdef CONFIG_SMP
438 if (current->lock_depth < 0) { 438 if (current->lock_depth < 0) {
439 reiserfs_panic(sb, "%s called without kernel lock held", 439 reiserfs_panic(sb, "journal-1", "%s called without kernel "
440 caller); 440 "lock held", caller);
441 } 441 }
442#else 442#else
443 ; 443 ;
@@ -574,7 +574,7 @@ static inline void put_journal_list(struct super_block *s,
574 struct reiserfs_journal_list *jl) 574 struct reiserfs_journal_list *jl)
575{ 575{
576 if (jl->j_refcount < 1) { 576 if (jl->j_refcount < 1) {
577 reiserfs_panic(s, "trans id %u, refcount at %d", 577 reiserfs_panic(s, "journal-2", "trans id %u, refcount at %d",
578 jl->j_trans_id, jl->j_refcount); 578 jl->j_trans_id, jl->j_refcount);
579 } 579 }
580 if (--jl->j_refcount == 0) 580 if (--jl->j_refcount == 0)
@@ -1416,8 +1416,7 @@ static int flush_journal_list(struct super_block *s,
1416 1416
1417 count = 0; 1417 count = 0;
1418 if (j_len_saved > journal->j_trans_max) { 1418 if (j_len_saved > journal->j_trans_max) {
1419 reiserfs_panic(s, 1419 reiserfs_panic(s, "journal-715", "length is %lu, trans id %lu",
1420 "journal-715: flush_journal_list, length is %lu, trans id %lu\n",
1421 j_len_saved, jl->j_trans_id); 1420 j_len_saved, jl->j_trans_id);
1422 return 0; 1421 return 0;
1423 } 1422 }
@@ -1449,8 +1448,8 @@ static int flush_journal_list(struct super_block *s,
1449 ** or wait on a more recent transaction, or just ignore it 1448 ** or wait on a more recent transaction, or just ignore it
1450 */ 1449 */
1451 if (atomic_read(&(journal->j_wcount)) != 0) { 1450 if (atomic_read(&(journal->j_wcount)) != 0) {
1452 reiserfs_panic(s, 1451 reiserfs_panic(s, "journal-844", "journal list is flushing, "
1453 "journal-844: panic journal list is flushing, wcount is not 0\n"); 1452 "wcount is not 0");
1454 } 1453 }
1455 cn = jl->j_realblock; 1454 cn = jl->j_realblock;
1456 while (cn) { 1455 while (cn) {
@@ -1551,13 +1550,13 @@ static int flush_journal_list(struct super_block *s,
1551 while (cn) { 1550 while (cn) {
1552 if (test_bit(BLOCK_NEEDS_FLUSH, &cn->state)) { 1551 if (test_bit(BLOCK_NEEDS_FLUSH, &cn->state)) {
1553 if (!cn->bh) { 1552 if (!cn->bh) {
1554 reiserfs_panic(s, 1553 reiserfs_panic(s, "journal-1011",
1555 "journal-1011: cn->bh is NULL\n"); 1554 "cn->bh is NULL");
1556 } 1555 }
1557 wait_on_buffer(cn->bh); 1556 wait_on_buffer(cn->bh);
1558 if (!cn->bh) { 1557 if (!cn->bh) {
1559 reiserfs_panic(s, 1558 reiserfs_panic(s, "journal-1012",
1560 "journal-1012: cn->bh is NULL\n"); 1559 "cn->bh is NULL");
1561 } 1560 }
1562 if (unlikely(!buffer_uptodate(cn->bh))) { 1561 if (unlikely(!buffer_uptodate(cn->bh))) {
1563#ifdef CONFIG_REISERFS_CHECK 1562#ifdef CONFIG_REISERFS_CHECK
@@ -3255,8 +3254,8 @@ int journal_mark_dirty(struct reiserfs_transaction_handle *th,
3255 3254
3256 PROC_INFO_INC(p_s_sb, journal.mark_dirty); 3255 PROC_INFO_INC(p_s_sb, journal.mark_dirty);
3257 if (th->t_trans_id != journal->j_trans_id) { 3256 if (th->t_trans_id != journal->j_trans_id) {
3258 reiserfs_panic(th->t_super, 3257 reiserfs_panic(th->t_super, "journal-1577",
3259 "journal-1577: handle trans id %ld != current trans id %ld\n", 3258 "handle trans id %ld != current trans id %ld",
3260 th->t_trans_id, journal->j_trans_id); 3259 th->t_trans_id, journal->j_trans_id);
3261 } 3260 }
3262 3261
@@ -3295,8 +3294,8 @@ int journal_mark_dirty(struct reiserfs_transaction_handle *th,
3295 ** Nothing can be done here, except make the FS readonly or panic. 3294 ** Nothing can be done here, except make the FS readonly or panic.
3296 */ 3295 */
3297 if (journal->j_len >= journal->j_trans_max) { 3296 if (journal->j_len >= journal->j_trans_max) {
3298 reiserfs_panic(th->t_super, 3297 reiserfs_panic(th->t_super, "journal-1413",
3299 "journal-1413: journal_mark_dirty: j_len (%lu) is too big\n", 3298 "j_len (%lu) is too big",
3300 journal->j_len); 3299 journal->j_len);
3301 } 3300 }
3302 3301
@@ -3316,7 +3315,8 @@ int journal_mark_dirty(struct reiserfs_transaction_handle *th,
3316 if (!cn) { 3315 if (!cn) {
3317 cn = get_cnode(p_s_sb); 3316 cn = get_cnode(p_s_sb);
3318 if (!cn) { 3317 if (!cn) {
3319 reiserfs_panic(p_s_sb, "get_cnode failed!\n"); 3318 reiserfs_panic(p_s_sb, "journal-4",
3319 "get_cnode failed!");
3320 } 3320 }
3321 3321
3322 if (th->t_blocks_logged == th->t_blocks_allocated) { 3322 if (th->t_blocks_logged == th->t_blocks_allocated) {
@@ -3584,8 +3584,8 @@ static int check_journal_end(struct reiserfs_transaction_handle *th,
3584 BUG_ON(!th->t_trans_id); 3584 BUG_ON(!th->t_trans_id);
3585 3585
3586 if (th->t_trans_id != journal->j_trans_id) { 3586 if (th->t_trans_id != journal->j_trans_id) {
3587 reiserfs_panic(th->t_super, 3587 reiserfs_panic(th->t_super, "journal-1577",
3588 "journal-1577: handle trans id %ld != current trans id %ld\n", 3588 "handle trans id %ld != current trans id %ld",
3589 th->t_trans_id, journal->j_trans_id); 3589 th->t_trans_id, journal->j_trans_id);
3590 } 3590 }
3591 3591
@@ -3664,8 +3664,8 @@ static int check_journal_end(struct reiserfs_transaction_handle *th,
3664 } 3664 }
3665 3665
3666 if (journal->j_start > SB_ONDISK_JOURNAL_SIZE(p_s_sb)) { 3666 if (journal->j_start > SB_ONDISK_JOURNAL_SIZE(p_s_sb)) {
3667 reiserfs_panic(p_s_sb, 3667 reiserfs_panic(p_s_sb, "journal-003",
3668 "journal-003: journal_end: j_start (%ld) is too high\n", 3668 "j_start (%ld) is too high",
3669 journal->j_start); 3669 journal->j_start);
3670 } 3670 }
3671 return 1; 3671 return 1;
@@ -3710,8 +3710,8 @@ int journal_mark_freed(struct reiserfs_transaction_handle *th,
3710 /* set the bit for this block in the journal bitmap for this transaction */ 3710 /* set the bit for this block in the journal bitmap for this transaction */
3711 jb = journal->j_current_jl->j_list_bitmap; 3711 jb = journal->j_current_jl->j_list_bitmap;
3712 if (!jb) { 3712 if (!jb) {
3713 reiserfs_panic(p_s_sb, 3713 reiserfs_panic(p_s_sb, "journal-1702",
3714 "journal-1702: journal_mark_freed, journal_list_bitmap is NULL\n"); 3714 "journal_list_bitmap is NULL");
3715 } 3715 }
3716 set_bit_in_list_bitmap(p_s_sb, blocknr, jb); 3716 set_bit_in_list_bitmap(p_s_sb, blocknr, jb);
3717 3717
@@ -4066,8 +4066,8 @@ static int do_journal_end(struct reiserfs_transaction_handle *th,
4066 if (buffer_journaled(cn->bh)) { 4066 if (buffer_journaled(cn->bh)) {
4067 jl_cn = get_cnode(p_s_sb); 4067 jl_cn = get_cnode(p_s_sb);
4068 if (!jl_cn) { 4068 if (!jl_cn) {
4069 reiserfs_panic(p_s_sb, 4069 reiserfs_panic(p_s_sb, "journal-1676",
4070 "journal-1676, get_cnode returned NULL\n"); 4070 "get_cnode returned NULL");
4071 } 4071 }
4072 if (i == 0) { 4072 if (i == 0) {
4073 jl->j_realblock = jl_cn; 4073 jl->j_realblock = jl_cn;
@@ -4083,8 +4083,9 @@ static int do_journal_end(struct reiserfs_transaction_handle *th,
4083 4083
4084 if (is_block_in_log_or_reserved_area 4084 if (is_block_in_log_or_reserved_area
4085 (p_s_sb, cn->bh->b_blocknr)) { 4085 (p_s_sb, cn->bh->b_blocknr)) {
4086 reiserfs_panic(p_s_sb, 4086 reiserfs_panic(p_s_sb, "journal-2332",
4087 "journal-2332: Trying to log block %lu, which is a log block\n", 4087 "Trying to log block %lu, "
4088 "which is a log block",
4088 cn->bh->b_blocknr); 4089 cn->bh->b_blocknr);
4089 } 4090 }
4090 jl_cn->blocknr = cn->bh->b_blocknr; 4091 jl_cn->blocknr = cn->bh->b_blocknr;
@@ -4268,8 +4269,8 @@ static int do_journal_end(struct reiserfs_transaction_handle *th,
4268 get_list_bitmap(p_s_sb, journal->j_current_jl); 4269 get_list_bitmap(p_s_sb, journal->j_current_jl);
4269 4270
4270 if (!(journal->j_current_jl->j_list_bitmap)) { 4271 if (!(journal->j_current_jl->j_list_bitmap)) {
4271 reiserfs_panic(p_s_sb, 4272 reiserfs_panic(p_s_sb, "journal-1996",
4272 "journal-1996: do_journal_end, could not get a list bitmap\n"); 4273 "could not get a list bitmap");
4273 } 4274 }
4274 4275
4275 atomic_set(&(journal->j_jlock), 0); 4276 atomic_set(&(journal->j_jlock), 0);
diff --git a/fs/reiserfs/lbalance.c b/fs/reiserfs/lbalance.c
index 381339b432e7..67f1d1de213d 100644
--- a/fs/reiserfs/lbalance.c
+++ b/fs/reiserfs/lbalance.c
@@ -168,10 +168,11 @@ static int leaf_copy_boundary_item(struct buffer_info *dest_bi,
168 if (bytes_or_entries == ih_item_len(ih) 168 if (bytes_or_entries == ih_item_len(ih)
169 && is_indirect_le_ih(ih)) 169 && is_indirect_le_ih(ih))
170 if (get_ih_free_space(ih)) 170 if (get_ih_free_space(ih))
171 reiserfs_panic(NULL, 171 reiserfs_panic(sb_from_bi(dest_bi),
172 "vs-10020: leaf_copy_boundary_item: " 172 "vs-10020",
173 "last unformatted node must be filled entirely (%h)", 173 "last unformatted node "
174 ih); 174 "must be filled "
175 "entirely (%h)", ih);
175 } 176 }
176#endif 177#endif
177 178
@@ -622,9 +623,8 @@ static void leaf_define_dest_src_infos(int shift_mode, struct tree_balance *tb,
622 break; 623 break;
623 624
624 default: 625 default:
625 reiserfs_panic(NULL, 626 reiserfs_panic(sb_from_bi(src_bi), "vs-10250",
626 "vs-10250: leaf_define_dest_src_infos: shift type is unknown (%d)", 627 "shift type is unknown (%d)", shift_mode);
627 shift_mode);
628 } 628 }
629 RFALSE(!src_bi->bi_bh || !dest_bi->bi_bh, 629 RFALSE(!src_bi->bi_bh || !dest_bi->bi_bh,
630 "vs-10260: mode==%d, source (%p) or dest (%p) buffer is initialized incorrectly", 630 "vs-10260: mode==%d, source (%p) or dest (%p) buffer is initialized incorrectly",
@@ -674,9 +674,9 @@ int leaf_shift_left(struct tree_balance *tb, int shift_num, int shift_bytes)
674#ifdef CONFIG_REISERFS_CHECK 674#ifdef CONFIG_REISERFS_CHECK
675 if (tb->tb_mode == M_PASTE || tb->tb_mode == M_INSERT) { 675 if (tb->tb_mode == M_PASTE || tb->tb_mode == M_INSERT) {
676 print_cur_tb("vs-10275"); 676 print_cur_tb("vs-10275");
677 reiserfs_panic(tb->tb_sb, 677 reiserfs_panic(tb->tb_sb, "vs-10275",
678 "vs-10275: leaf_shift_left: balance condition corrupted (%c)", 678 "balance condition corrupted "
679 tb->tb_mode); 679 "(%c)", tb->tb_mode);
680 } 680 }
681#endif 681#endif
682 682
@@ -889,9 +889,12 @@ void leaf_paste_in_buffer(struct buffer_info *bi, int affected_item_num,
889 889
890#ifdef CONFIG_REISERFS_CHECK 890#ifdef CONFIG_REISERFS_CHECK
891 if (zeros_number > paste_size) { 891 if (zeros_number > paste_size) {
892 struct super_block *sb = NULL;
893 if (bi && bi->tb)
894 sb = bi->tb->tb_sb;
892 print_cur_tb("10177"); 895 print_cur_tb("10177");
893 reiserfs_panic(NULL, 896 reiserfs_panic(sb, "vs-10177",
894 "vs-10177: leaf_paste_in_buffer: ero number == %d, paste_size == %d", 897 "zeros_number == %d, paste_size == %d",
895 zeros_number, paste_size); 898 zeros_number, paste_size);
896 } 899 }
897#endif /* CONFIG_REISERFS_CHECK */ 900#endif /* CONFIG_REISERFS_CHECK */
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c
index bb41c6e7c79b..ef41cc882bd9 100644
--- a/fs/reiserfs/namei.c
+++ b/fs/reiserfs/namei.c
@@ -145,10 +145,9 @@ int search_by_entry_key(struct super_block *sb, const struct cpu_key *key,
145 if (!is_direntry_le_ih(de->de_ih) || 145 if (!is_direntry_le_ih(de->de_ih) ||
146 COMP_SHORT_KEYS(&(de->de_ih->ih_key), key)) { 146 COMP_SHORT_KEYS(&(de->de_ih->ih_key), key)) {
147 print_block(de->de_bh, 0, -1, -1); 147 print_block(de->de_bh, 0, -1, -1);
148 reiserfs_panic(sb, 148 reiserfs_panic(sb, "vs-7005", "found item %h is not directory "
149 "vs-7005: search_by_entry_key: found item %h is not directory item or " 149 "item or does not belong to the same directory "
150 "does not belong to the same directory as key %K", 150 "as key %K", de->de_ih, key);
151 de->de_ih, key);
152 } 151 }
153#endif /* CONFIG_REISERFS_CHECK */ 152#endif /* CONFIG_REISERFS_CHECK */
154 153
@@ -1193,15 +1192,14 @@ static int entry_points_to_object(const char *name, int len,
1193 1192
1194 if (inode) { 1193 if (inode) {
1195 if (!de_visible(de->de_deh + de->de_entry_num)) 1194 if (!de_visible(de->de_deh + de->de_entry_num))
1196 reiserfs_panic(NULL, 1195 reiserfs_panic(inode->i_sb, "vs-7042",
1197 "vs-7042: entry_points_to_object: entry must be visible"); 1196 "entry must be visible");
1198 return (de->de_objectid == inode->i_ino) ? 1 : 0; 1197 return (de->de_objectid == inode->i_ino) ? 1 : 0;
1199 } 1198 }
1200 1199
1201 /* this must be added hidden entry */ 1200 /* this must be added hidden entry */
1202 if (de_visible(de->de_deh + de->de_entry_num)) 1201 if (de_visible(de->de_deh + de->de_entry_num))
1203 reiserfs_panic(NULL, 1202 reiserfs_panic(NULL, "vs-7043", "entry must be visible");
1204 "vs-7043: entry_points_to_object: entry must be visible");
1205 1203
1206 return 1; 1204 return 1;
1207} 1205}
@@ -1315,8 +1313,8 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1315 new_dentry->d_name.len, old_inode, 0); 1313 new_dentry->d_name.len, old_inode, 0);
1316 if (retval == -EEXIST) { 1314 if (retval == -EEXIST) {
1317 if (!new_dentry_inode) { 1315 if (!new_dentry_inode) {
1318 reiserfs_panic(old_dir->i_sb, 1316 reiserfs_panic(old_dir->i_sb, "vs-7050",
1319 "vs-7050: new entry is found, new inode == 0\n"); 1317 "new entry is found, new inode == 0");
1320 } 1318 }
1321 } else if (retval) { 1319 } else if (retval) {
1322 int err = journal_end(&th, old_dir->i_sb, jbegin_count); 1320 int err = journal_end(&th, old_dir->i_sb, jbegin_count);
diff --git a/fs/reiserfs/objectid.c b/fs/reiserfs/objectid.c
index a3a5f43ff443..90e4e52f857b 100644
--- a/fs/reiserfs/objectid.c
+++ b/fs/reiserfs/objectid.c
@@ -18,8 +18,7 @@
18static void check_objectid_map(struct super_block *s, __le32 * map) 18static void check_objectid_map(struct super_block *s, __le32 * map)
19{ 19{
20 if (le32_to_cpu(map[0]) != 1) 20 if (le32_to_cpu(map[0]) != 1)
21 reiserfs_panic(s, 21 reiserfs_panic(s, "vs-15010", "map corrupted: %lx",
22 "vs-15010: check_objectid_map: map corrupted: %lx",
23 (long unsigned int)le32_to_cpu(map[0])); 22 (long unsigned int)le32_to_cpu(map[0]));
24 23
25 // FIXME: add something else here 24 // FIXME: add something else here
diff --git a/fs/reiserfs/prints.c b/fs/reiserfs/prints.c
index de71372f0dfe..1964acb6eb17 100644
--- a/fs/reiserfs/prints.c
+++ b/fs/reiserfs/prints.c
@@ -353,14 +353,21 @@ void reiserfs_debug(struct super_block *s, int level, const char *fmt, ...)
353extern struct tree_balance *cur_tb; 353extern struct tree_balance *cur_tb;
354#endif 354#endif
355 355
356void reiserfs_panic(struct super_block *sb, const char *fmt, ...) 356void __reiserfs_panic(struct super_block *sb, const char *id,
357 const char *function, const char *fmt, ...)
357{ 358{
358 do_reiserfs_warning(fmt); 359 do_reiserfs_warning(fmt);
359 360
361#ifdef CONFIG_REISERFS_CHECK
360 dump_stack(); 362 dump_stack();
361 363#endif
362 panic(KERN_EMERG "REISERFS: panic (device %s): %s\n", 364 if (sb)
363 reiserfs_bdevname(sb), error_buf); 365 panic(KERN_WARNING "REISERFS panic (device %s): %s%s%s: %s\n",
366 sb->s_id, id ? id : "", id ? " " : "",
367 function, error_buf);
368 else
369 panic(KERN_WARNING "REISERFS panic: %s%s%s: %s\n",
370 id ? id : "", id ? " " : "", function, error_buf);
364} 371}
365 372
366void reiserfs_abort(struct super_block *sb, int errno, const char *fmt, ...) 373void reiserfs_abort(struct super_block *sb, int errno, const char *fmt, ...)
@@ -681,12 +688,10 @@ static void check_leaf_block_head(struct buffer_head *bh)
681 blkh = B_BLK_HEAD(bh); 688 blkh = B_BLK_HEAD(bh);
682 nr = blkh_nr_item(blkh); 689 nr = blkh_nr_item(blkh);
683 if (nr > (bh->b_size - BLKH_SIZE) / IH_SIZE) 690 if (nr > (bh->b_size - BLKH_SIZE) / IH_SIZE)
684 reiserfs_panic(NULL, 691 reiserfs_panic(NULL, "vs-6010", "invalid item number %z",
685 "vs-6010: check_leaf_block_head: invalid item number %z",
686 bh); 692 bh);
687 if (blkh_free_space(blkh) > bh->b_size - BLKH_SIZE - IH_SIZE * nr) 693 if (blkh_free_space(blkh) > bh->b_size - BLKH_SIZE - IH_SIZE * nr)
688 reiserfs_panic(NULL, 694 reiserfs_panic(NULL, "vs-6020", "invalid free space %z",
689 "vs-6020: check_leaf_block_head: invalid free space %z",
690 bh); 695 bh);
691 696
692} 697}
@@ -697,21 +702,15 @@ static void check_internal_block_head(struct buffer_head *bh)
697 702
698 blkh = B_BLK_HEAD(bh); 703 blkh = B_BLK_HEAD(bh);
699 if (!(B_LEVEL(bh) > DISK_LEAF_NODE_LEVEL && B_LEVEL(bh) <= MAX_HEIGHT)) 704 if (!(B_LEVEL(bh) > DISK_LEAF_NODE_LEVEL && B_LEVEL(bh) <= MAX_HEIGHT))
700 reiserfs_panic(NULL, 705 reiserfs_panic(NULL, "vs-6025", "invalid level %z", bh);
701 "vs-6025: check_internal_block_head: invalid level %z",
702 bh);
703 706
704 if (B_NR_ITEMS(bh) > (bh->b_size - BLKH_SIZE) / IH_SIZE) 707 if (B_NR_ITEMS(bh) > (bh->b_size - BLKH_SIZE) / IH_SIZE)
705 reiserfs_panic(NULL, 708 reiserfs_panic(NULL, "vs-6030", "invalid item number %z", bh);
706 "vs-6030: check_internal_block_head: invalid item number %z",
707 bh);
708 709
709 if (B_FREE_SPACE(bh) != 710 if (B_FREE_SPACE(bh) !=
710 bh->b_size - BLKH_SIZE - KEY_SIZE * B_NR_ITEMS(bh) - 711 bh->b_size - BLKH_SIZE - KEY_SIZE * B_NR_ITEMS(bh) -
711 DC_SIZE * (B_NR_ITEMS(bh) + 1)) 712 DC_SIZE * (B_NR_ITEMS(bh) + 1))
712 reiserfs_panic(NULL, 713 reiserfs_panic(NULL, "vs-6040", "invalid free space %z", bh);
713 "vs-6040: check_internal_block_head: invalid free space %z",
714 bh);
715 714
716} 715}
717 716
diff --git a/fs/reiserfs/stree.c b/fs/reiserfs/stree.c
index f328d27a19d5..2de1e309124b 100644
--- a/fs/reiserfs/stree.c
+++ b/fs/reiserfs/stree.c
@@ -366,9 +366,8 @@ inline void decrement_bcount(struct buffer_head *p_s_bh)
366 put_bh(p_s_bh); 366 put_bh(p_s_bh);
367 return; 367 return;
368 } 368 }
369 reiserfs_panic(NULL, 369 reiserfs_panic(NULL, "PAP-5070",
370 "PAP-5070: decrement_bcount: trying to free free buffer %b", 370 "trying to free free buffer %b", p_s_bh);
371 p_s_bh);
372 } 371 }
373} 372}
374 373
@@ -713,8 +712,8 @@ int search_by_key(struct super_block *p_s_sb, const struct cpu_key *p_s_key, /*
713#ifdef CONFIG_REISERFS_CHECK 712#ifdef CONFIG_REISERFS_CHECK
714 if (cur_tb) { 713 if (cur_tb) {
715 print_cur_tb("5140"); 714 print_cur_tb("5140");
716 reiserfs_panic(p_s_sb, 715 reiserfs_panic(p_s_sb, "PAP-5140",
717 "PAP-5140: search_by_key: schedule occurred in do_balance!"); 716 "schedule occurred in do_balance!");
718 } 717 }
719#endif 718#endif
720 719
@@ -1511,8 +1510,8 @@ static void indirect_to_direct_roll_back(struct reiserfs_transaction_handle *th,
1511 /* look for the last byte of the tail */ 1510 /* look for the last byte of the tail */
1512 if (search_for_position_by_key(inode->i_sb, &tail_key, path) == 1511 if (search_for_position_by_key(inode->i_sb, &tail_key, path) ==
1513 POSITION_NOT_FOUND) 1512 POSITION_NOT_FOUND)
1514 reiserfs_panic(inode->i_sb, 1513 reiserfs_panic(inode->i_sb, "vs-5615",
1515 "vs-5615: indirect_to_direct_roll_back: found invalid item"); 1514 "found invalid item");
1516 RFALSE(path->pos_in_item != 1515 RFALSE(path->pos_in_item !=
1517 ih_item_len(PATH_PITEM_HEAD(path)) - 1, 1516 ih_item_len(PATH_PITEM_HEAD(path)) - 1,
1518 "vs-5616: appended bytes found"); 1517 "vs-5616: appended bytes found");
@@ -1612,8 +1611,8 @@ int reiserfs_cut_from_item(struct reiserfs_transaction_handle *th,
1612 print_block(PATH_PLAST_BUFFER(p_s_path), 3, 1611 print_block(PATH_PLAST_BUFFER(p_s_path), 3,
1613 PATH_LAST_POSITION(p_s_path) - 1, 1612 PATH_LAST_POSITION(p_s_path) - 1,
1614 PATH_LAST_POSITION(p_s_path) + 1); 1613 PATH_LAST_POSITION(p_s_path) + 1);
1615 reiserfs_panic(p_s_sb, 1614 reiserfs_panic(p_s_sb, "PAP-5580", "item to "
1616 "PAP-5580: reiserfs_cut_from_item: item to convert does not exist (%K)", 1615 "convert does not exist (%K)",
1617 p_s_item_key); 1616 p_s_item_key);
1618 } 1617 }
1619 continue; 1618 continue;
@@ -1693,22 +1692,20 @@ int reiserfs_cut_from_item(struct reiserfs_transaction_handle *th,
1693 sure, that we exactly remove last unformatted node pointer 1692 sure, that we exactly remove last unformatted node pointer
1694 of the item */ 1693 of the item */
1695 if (!is_indirect_le_ih(le_ih)) 1694 if (!is_indirect_le_ih(le_ih))
1696 reiserfs_panic(p_s_sb, 1695 reiserfs_panic(p_s_sb, "vs-5652",
1697 "vs-5652: reiserfs_cut_from_item: "
1698 "item must be indirect %h", le_ih); 1696 "item must be indirect %h", le_ih);
1699 1697
1700 if (c_mode == M_DELETE && ih_item_len(le_ih) != UNFM_P_SIZE) 1698 if (c_mode == M_DELETE && ih_item_len(le_ih) != UNFM_P_SIZE)
1701 reiserfs_panic(p_s_sb, 1699 reiserfs_panic(p_s_sb, "vs-5653", "completing "
1702 "vs-5653: reiserfs_cut_from_item: " 1700 "indirect2direct conversion indirect "
1703 "completing indirect2direct conversion indirect item %h " 1701 "item %h being deleted must be of "
1704 "being deleted must be of 4 byte long", 1702 "4 byte long", le_ih);
1705 le_ih);
1706 1703
1707 if (c_mode == M_CUT 1704 if (c_mode == M_CUT
1708 && s_cut_balance.insert_size[0] != -UNFM_P_SIZE) { 1705 && s_cut_balance.insert_size[0] != -UNFM_P_SIZE) {
1709 reiserfs_panic(p_s_sb, 1706 reiserfs_panic(p_s_sb, "vs-5654", "can not complete "
1710 "vs-5654: reiserfs_cut_from_item: " 1707 "indirect2direct conversion of %h "
1711 "can not complete indirect2direct conversion of %h (CUT, insert_size==%d)", 1708 "(CUT, insert_size==%d)",
1712 le_ih, s_cut_balance.insert_size[0]); 1709 le_ih, s_cut_balance.insert_size[0]);
1713 } 1710 }
1714 /* it would be useful to make sure, that right neighboring 1711 /* it would be useful to make sure, that right neighboring
@@ -1923,10 +1920,10 @@ static void check_research_for_paste(struct treepath *path,
1923 || op_bytes_number(found_ih, 1920 || op_bytes_number(found_ih,
1924 get_last_bh(path)->b_size) != 1921 get_last_bh(path)->b_size) !=
1925 pos_in_item(path)) 1922 pos_in_item(path))
1926 reiserfs_panic(NULL, 1923 reiserfs_panic(NULL, "PAP-5720", "found direct item "
1927 "PAP-5720: check_research_for_paste: " 1924 "%h or position (%d) does not match "
1928 "found direct item %h or position (%d) does not match to key %K", 1925 "to key %K", found_ih,
1929 found_ih, pos_in_item(path), p_s_key); 1926 pos_in_item(path), p_s_key);
1930 } 1927 }
1931 if (is_indirect_le_ih(found_ih)) { 1928 if (is_indirect_le_ih(found_ih)) {
1932 if (le_ih_k_offset(found_ih) + 1929 if (le_ih_k_offset(found_ih) +
@@ -1935,9 +1932,9 @@ static void check_research_for_paste(struct treepath *path,
1935 cpu_key_k_offset(p_s_key) 1932 cpu_key_k_offset(p_s_key)
1936 || I_UNFM_NUM(found_ih) != pos_in_item(path) 1933 || I_UNFM_NUM(found_ih) != pos_in_item(path)
1937 || get_ih_free_space(found_ih) != 0) 1934 || get_ih_free_space(found_ih) != 0)
1938 reiserfs_panic(NULL, 1935 reiserfs_panic(NULL, "PAP-5730", "found indirect "
1939 "PAP-5730: check_research_for_paste: " 1936 "item (%h) or position (%d) does not "
1940 "found indirect item (%h) or position (%d) does not match to key (%K)", 1937 "match to key (%K)",
1941 found_ih, pos_in_item(path), p_s_key); 1938 found_ih, pos_in_item(path), p_s_key);
1942 } 1939 }
1943} 1940}
diff --git a/fs/reiserfs/tail_conversion.c b/fs/reiserfs/tail_conversion.c
index 256285dddb20..f8449cb74b53 100644
--- a/fs/reiserfs/tail_conversion.c
+++ b/fs/reiserfs/tail_conversion.c
@@ -92,8 +92,7 @@ int direct2indirect(struct reiserfs_transaction_handle *th, struct inode *inode,
92 last item of the file */ 92 last item of the file */
93 if (search_for_position_by_key(sb, &end_key, path) == 93 if (search_for_position_by_key(sb, &end_key, path) ==
94 POSITION_FOUND) 94 POSITION_FOUND)
95 reiserfs_panic(sb, 95 reiserfs_panic(sb, "PAP-14050",
96 "PAP-14050: direct2indirect: "
97 "direct item (%K) not found", &end_key); 96 "direct item (%K) not found", &end_key);
98 p_le_ih = PATH_PITEM_HEAD(path); 97 p_le_ih = PATH_PITEM_HEAD(path);
99 RFALSE(!is_direct_le_ih(p_le_ih), 98 RFALSE(!is_direct_le_ih(p_le_ih),
@@ -214,8 +213,7 @@ int indirect2direct(struct reiserfs_transaction_handle *th, struct inode *p_s_in
214 /* re-search indirect item */ 213 /* re-search indirect item */
215 if (search_for_position_by_key(p_s_sb, p_s_item_key, p_s_path) 214 if (search_for_position_by_key(p_s_sb, p_s_item_key, p_s_path)
216 == POSITION_NOT_FOUND) 215 == POSITION_NOT_FOUND)
217 reiserfs_panic(p_s_sb, 216 reiserfs_panic(p_s_sb, "PAP-5520",
218 "PAP-5520: indirect2direct: "
219 "item to be converted %K does not exist", 217 "item to be converted %K does not exist",
220 p_s_item_key); 218 p_s_item_key);
221 copy_item_head(&s_ih, PATH_PITEM_HEAD(p_s_path)); 219 copy_item_head(&s_ih, PATH_PITEM_HEAD(p_s_path));
@@ -224,8 +222,8 @@ int indirect2direct(struct reiserfs_transaction_handle *th, struct inode *p_s_in
224 (ih_item_len(&s_ih) / UNFM_P_SIZE - 222 (ih_item_len(&s_ih) / UNFM_P_SIZE -
225 1) * p_s_sb->s_blocksize; 223 1) * p_s_sb->s_blocksize;
226 if (pos != pos1) 224 if (pos != pos1)
227 reiserfs_panic(p_s_sb, "vs-5530: indirect2direct: " 225 reiserfs_panic(p_s_sb, "vs-5530", "tail position "
228 "tail position changed while we were reading it"); 226 "changed while we were reading it");
229#endif 227#endif
230 } 228 }
231 229