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/do_balan.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/do_balan.c')
-rw-r--r-- | fs/reiserfs/do_balan.c | 67 |
1 files changed, 35 insertions, 32 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]) { |