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>
diff --git a/fs/reiserfs/stree.c b/fs/reiserfs/stree.c
index f328d27..2de1e30 100644
--- a/fs/reiserfs/stree.c
+++ b/fs/reiserfs/stree.c
@@ -366,9 +366,8 @@
put_bh(p_s_bh);
return;
}
- reiserfs_panic(NULL,
- "PAP-5070: decrement_bcount: trying to free free buffer %b",
- p_s_bh);
+ reiserfs_panic(NULL, "PAP-5070",
+ "trying to free free buffer %b", p_s_bh);
}
}
@@ -713,8 +712,8 @@
#ifdef CONFIG_REISERFS_CHECK
if (cur_tb) {
print_cur_tb("5140");
- reiserfs_panic(p_s_sb,
- "PAP-5140: search_by_key: schedule occurred in do_balance!");
+ reiserfs_panic(p_s_sb, "PAP-5140",
+ "schedule occurred in do_balance!");
}
#endif
@@ -1511,8 +1510,8 @@
/* look for the last byte of the tail */
if (search_for_position_by_key(inode->i_sb, &tail_key, path) ==
POSITION_NOT_FOUND)
- reiserfs_panic(inode->i_sb,
- "vs-5615: indirect_to_direct_roll_back: found invalid item");
+ reiserfs_panic(inode->i_sb, "vs-5615",
+ "found invalid item");
RFALSE(path->pos_in_item !=
ih_item_len(PATH_PITEM_HEAD(path)) - 1,
"vs-5616: appended bytes found");
@@ -1612,8 +1611,8 @@
print_block(PATH_PLAST_BUFFER(p_s_path), 3,
PATH_LAST_POSITION(p_s_path) - 1,
PATH_LAST_POSITION(p_s_path) + 1);
- reiserfs_panic(p_s_sb,
- "PAP-5580: reiserfs_cut_from_item: item to convert does not exist (%K)",
+ reiserfs_panic(p_s_sb, "PAP-5580", "item to "
+ "convert does not exist (%K)",
p_s_item_key);
}
continue;
@@ -1693,22 +1692,20 @@
sure, that we exactly remove last unformatted node pointer
of the item */
if (!is_indirect_le_ih(le_ih))
- reiserfs_panic(p_s_sb,
- "vs-5652: reiserfs_cut_from_item: "
+ reiserfs_panic(p_s_sb, "vs-5652",
"item must be indirect %h", le_ih);
if (c_mode == M_DELETE && ih_item_len(le_ih) != UNFM_P_SIZE)
- reiserfs_panic(p_s_sb,
- "vs-5653: reiserfs_cut_from_item: "
- "completing indirect2direct conversion indirect item %h "
- "being deleted must be of 4 byte long",
- le_ih);
+ reiserfs_panic(p_s_sb, "vs-5653", "completing "
+ "indirect2direct conversion indirect "
+ "item %h being deleted must be of "
+ "4 byte long", le_ih);
if (c_mode == M_CUT
&& s_cut_balance.insert_size[0] != -UNFM_P_SIZE) {
- reiserfs_panic(p_s_sb,
- "vs-5654: reiserfs_cut_from_item: "
- "can not complete indirect2direct conversion of %h (CUT, insert_size==%d)",
+ reiserfs_panic(p_s_sb, "vs-5654", "can not complete "
+ "indirect2direct conversion of %h "
+ "(CUT, insert_size==%d)",
le_ih, s_cut_balance.insert_size[0]);
}
/* it would be useful to make sure, that right neighboring
@@ -1923,10 +1920,10 @@
|| op_bytes_number(found_ih,
get_last_bh(path)->b_size) !=
pos_in_item(path))
- reiserfs_panic(NULL,
- "PAP-5720: check_research_for_paste: "
- "found direct item %h or position (%d) does not match to key %K",
- found_ih, pos_in_item(path), p_s_key);
+ reiserfs_panic(NULL, "PAP-5720", "found direct item "
+ "%h or position (%d) does not match "
+ "to key %K", found_ih,
+ pos_in_item(path), p_s_key);
}
if (is_indirect_le_ih(found_ih)) {
if (le_ih_k_offset(found_ih) +
@@ -1935,9 +1932,9 @@
cpu_key_k_offset(p_s_key)
|| I_UNFM_NUM(found_ih) != pos_in_item(path)
|| get_ih_free_space(found_ih) != 0)
- reiserfs_panic(NULL,
- "PAP-5730: check_research_for_paste: "
- "found indirect item (%h) or position (%d) does not match to key (%K)",
+ reiserfs_panic(NULL, "PAP-5730", "found indirect "
+ "item (%h) or position (%d) does not "
+ "match to key (%K)",
found_ih, pos_in_item(path), p_s_key);
}
}