aboutsummaryrefslogtreecommitdiffstats
path: root/fs/reiserfs/stree.c
diff options
context:
space:
mode:
authorJeff Mahoney <jeffm@suse.com>2009-03-30 14:02:21 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-03-30 12:16:36 -0700
commit45b03d5e8e674eb6555b767e1c8eb40b671ff892 (patch)
treed74acd1be7f5102143df960e8cd692aadcc437df /fs/reiserfs/stree.c
parent1d889d9958490888b3fad1d486145d9a03559cbc (diff)
downloadkernel_samsung_smdk4412-45b03d5e8e674eb6555b767e1c8eb40b671ff892.zip
kernel_samsung_smdk4412-45b03d5e8e674eb6555b767e1c8eb40b671ff892.tar.gz
kernel_samsung_smdk4412-45b03d5e8e674eb6555b767e1c8eb40b671ff892.tar.bz2
reiserfs: rework reiserfs_warning
ReiserFS warnings 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/stree.c')
-rw-r--r--fs/reiserfs/stree.c107
1 files changed, 50 insertions, 57 deletions
diff --git a/fs/reiserfs/stree.c b/fs/reiserfs/stree.c
index abbc64d..f328d27 100644
--- a/fs/reiserfs/stree.c
+++ b/fs/reiserfs/stree.c
@@ -444,23 +444,24 @@ static int is_leaf(char *buf, int blocksize, struct buffer_head *bh)
blkh = (struct block_head *)buf;
if (blkh_level(blkh) != DISK_LEAF_NODE_LEVEL) {
- reiserfs_warning(NULL,
- "is_leaf: this should be caught earlier");
+ reiserfs_warning(NULL, "reiserfs-5080",
+ "this should be caught earlier");
return 0;
}
nr = blkh_nr_item(blkh);
if (nr < 1 || nr > ((blocksize - BLKH_SIZE) / (IH_SIZE + MIN_ITEM_LEN))) {
/* item number is too big or too small */
- reiserfs_warning(NULL, "is_leaf: nr_item seems wrong: %z", bh);
+ reiserfs_warning(NULL, "reiserfs-5081",
+ "nr_item seems wrong: %z", bh);
return 0;
}
ih = (struct item_head *)(buf + BLKH_SIZE) + nr - 1;
used_space = BLKH_SIZE + IH_SIZE * nr + (blocksize - ih_location(ih));
if (used_space != blocksize - blkh_free_space(blkh)) {
/* free space does not match to calculated amount of use space */
- reiserfs_warning(NULL, "is_leaf: free space seems wrong: %z",
- bh);
+ reiserfs_warning(NULL, "reiserfs-5082",
+ "free space seems wrong: %z", bh);
return 0;
}
// FIXME: it is_leaf will hit performance too much - we may have
@@ -471,29 +472,29 @@ static int is_leaf(char *buf, int blocksize, struct buffer_head *bh)
prev_location = blocksize;
for (i = 0; i < nr; i++, ih++) {
if (le_ih_k_type(ih) == TYPE_ANY) {
- reiserfs_warning(NULL,
- "is_leaf: wrong item type for item %h",
+ reiserfs_warning(NULL, "reiserfs-5083",
+ "wrong item type for item %h",
ih);
return 0;
}
if (ih_location(ih) >= blocksize
|| ih_location(ih) < IH_SIZE * nr) {
- reiserfs_warning(NULL,
- "is_leaf: item location seems wrong: %h",
+ reiserfs_warning(NULL, "reiserfs-5084",
+ "item location seems wrong: %h",
ih);
return 0;
}
if (ih_item_len(ih) < 1
|| ih_item_len(ih) > MAX_ITEM_LEN(blocksize)) {
- reiserfs_warning(NULL,
- "is_leaf: item length seems wrong: %h",
+ reiserfs_warning(NULL, "reiserfs-5085",
+ "item length seems wrong: %h",
ih);
return 0;
}
if (prev_location - ih_location(ih) != ih_item_len(ih)) {
- reiserfs_warning(NULL,
- "is_leaf: item location seems wrong (second one): %h",
- ih);
+ reiserfs_warning(NULL, "reiserfs-5086",
+ "item location seems wrong "
+ "(second one): %h", ih);
return 0;
}
prev_location = ih_location(ih);
@@ -514,24 +515,23 @@ static int is_internal(char *buf, int blocksize, struct buffer_head *bh)
nr = blkh_level(blkh);
if (nr <= DISK_LEAF_NODE_LEVEL || nr > MAX_HEIGHT) {
/* this level is not possible for internal nodes */
- reiserfs_warning(NULL,
- "is_internal: this should be caught earlier");
+ reiserfs_warning(NULL, "reiserfs-5087",
+ "this should be caught earlier");
return 0;
}
nr = blkh_nr_item(blkh);
if (nr > (blocksize - BLKH_SIZE - DC_SIZE) / (KEY_SIZE + DC_SIZE)) {
/* for internal which is not root we might check min number of keys */
- reiserfs_warning(NULL,
- "is_internal: number of key seems wrong: %z",
- bh);
+ reiserfs_warning(NULL, "reiserfs-5088",
+ "number of key seems wrong: %z", bh);
return 0;
}
used_space = BLKH_SIZE + KEY_SIZE * nr + DC_SIZE * (nr + 1);
if (used_space != blocksize - blkh_free_space(blkh)) {
- reiserfs_warning(NULL,
- "is_internal: free space seems wrong: %z", bh);
+ reiserfs_warning(NULL, "reiserfs-5089",
+ "free space seems wrong: %z", bh);
return 0;
}
// one may imagine much more checks
@@ -543,8 +543,8 @@ static int is_internal(char *buf, int blocksize, struct buffer_head *bh)
static int is_tree_node(struct buffer_head *bh, int level)
{
if (B_LEVEL(bh) != level) {
- reiserfs_warning(NULL,
- "is_tree_node: node level %d does not match to the expected one %d",
+ reiserfs_warning(NULL, "reiserfs-5090", "node level %d does "
+ "not match to the expected one %d",
B_LEVEL(bh), level);
return 0;
}
@@ -645,9 +645,9 @@ int search_by_key(struct super_block *p_s_sb, const struct cpu_key *p_s_key, /*
#ifdef CONFIG_REISERFS_CHECK
if (!(++n_repeat_counter % 50000))
- reiserfs_warning(p_s_sb, "PAP-5100: search_by_key: %s:"
- "there were %d iterations of while loop "
- "looking for key %K",
+ reiserfs_warning(p_s_sb, "PAP-5100",
+ "%s: there were %d iterations of "
+ "while loop looking for key %K",
current->comm, n_repeat_counter,
p_s_key);
#endif
@@ -721,9 +721,9 @@ int search_by_key(struct super_block *p_s_sb, const struct cpu_key *p_s_key, /*
// make sure, that the node contents look like a node of
// certain level
if (!is_tree_node(p_s_bh, expected_level)) {
- reiserfs_warning(p_s_sb, "vs-5150: search_by_key: "
- "invalid format found in block %ld. Fsck?",
- p_s_bh->b_blocknr);
+ reiserfs_warning(p_s_sb, "vs-5150",
+ "invalid format found in block %ld. "
+ "Fsck?", p_s_bh->b_blocknr);
pathrelse(p_s_search_path);
return IO_ERROR;
}
@@ -1227,8 +1227,7 @@ int reiserfs_delete_item(struct reiserfs_transaction_handle *th, struct treepath
if (n_ret_value == IO_ERROR)
break;
if (n_ret_value == FILE_NOT_FOUND) {
- reiserfs_warning(p_s_sb,
- "vs-5340: reiserfs_delete_item: "
+ reiserfs_warning(p_s_sb, "vs-5340",
"no items of the file %K found",
p_s_item_key);
break;
@@ -1338,10 +1337,9 @@ void reiserfs_delete_solid_item(struct reiserfs_transaction_handle *th,
while (1) {
retval = search_item(th->t_super, &cpu_key, &path);
if (retval == IO_ERROR) {
- reiserfs_warning(th->t_super,
- "vs-5350: reiserfs_delete_solid_item: "
- "i/o failure occurred trying to delete %K",
- &cpu_key);
+ reiserfs_warning(th->t_super, "vs-5350",
+ "i/o failure occurred trying "
+ "to delete %K", &cpu_key);
break;
}
if (retval != ITEM_FOUND) {
@@ -1355,9 +1353,8 @@ void reiserfs_delete_solid_item(struct reiserfs_transaction_handle *th,
GET_GENERATION_NUMBER(le_key_k_offset
(le_key_version(key),
key)) == 1))
- reiserfs_warning(th->t_super,
- "vs-5355: reiserfs_delete_solid_item: %k not found",
- key);
+ reiserfs_warning(th->t_super, "vs-5355",
+ "%k not found", key);
break;
}
if (!tb_init) {
@@ -1389,8 +1386,7 @@ void reiserfs_delete_solid_item(struct reiserfs_transaction_handle *th,
break;
}
// IO_ERROR, NO_DISK_SPACE, etc
- reiserfs_warning(th->t_super,
- "vs-5360: reiserfs_delete_solid_item: "
+ reiserfs_warning(th->t_super, "vs-5360",
"could not delete %K due to fix_nodes failure",
&cpu_key);
unfix_nodes(&tb);
@@ -1533,8 +1529,9 @@ static void indirect_to_direct_roll_back(struct reiserfs_transaction_handle *th,
set_cpu_key_k_offset(&tail_key,
cpu_key_k_offset(&tail_key) - removed);
}
- reiserfs_warning(inode->i_sb,
- "indirect_to_direct_roll_back: indirect_to_direct conversion has been rolled back due to lack of disk space");
+ reiserfs_warning(inode->i_sb, "reiserfs-5091", "indirect_to_direct "
+ "conversion has been rolled back due to "
+ "lack of disk space");
//mark_file_without_tail (inode);
mark_inode_dirty(inode);
}
@@ -1639,8 +1636,7 @@ int reiserfs_cut_from_item(struct reiserfs_transaction_handle *th,
if (n_ret_value == POSITION_FOUND)
continue;
- reiserfs_warning(p_s_sb,
- "PAP-5610: reiserfs_cut_from_item: item %K not found",
+ reiserfs_warning(p_s_sb, "PAP-5610", "item %K not found",
p_s_item_key);
unfix_nodes(&s_cut_balance);
return (n_ret_value == IO_ERROR) ? -EIO : -ENOENT;
@@ -1654,7 +1650,8 @@ int reiserfs_cut_from_item(struct reiserfs_transaction_handle *th,
indirect_to_direct_roll_back(th, p_s_inode, p_s_path);
}
if (n_ret_value == NO_DISK_SPACE)
- reiserfs_warning(p_s_sb, "NO_DISK_SPACE");
+ reiserfs_warning(p_s_sb, "reiserfs-5092",
+ "NO_DISK_SPACE");
unfix_nodes(&s_cut_balance);
return -EIO;
}
@@ -1743,8 +1740,7 @@ static void truncate_directory(struct reiserfs_transaction_handle *th,
{
BUG_ON(!th->t_trans_id);
if (inode->i_nlink)
- reiserfs_warning(inode->i_sb,
- "vs-5655: truncate_directory: link count != 0");
+ reiserfs_warning(inode->i_sb, "vs-5655", "link count != 0");
set_le_key_k_offset(KEY_FORMAT_3_5, INODE_PKEY(inode), DOT_OFFSET);
set_le_key_k_type(KEY_FORMAT_3_5, INODE_PKEY(inode), TYPE_DIRENTRY);
@@ -1797,16 +1793,14 @@ int reiserfs_do_truncate(struct reiserfs_transaction_handle *th, struct inode *p
search_for_position_by_key(p_s_inode->i_sb, &s_item_key,
&s_search_path);
if (retval == IO_ERROR) {
- reiserfs_warning(p_s_inode->i_sb,
- "vs-5657: reiserfs_do_truncate: "
+ reiserfs_warning(p_s_inode->i_sb, "vs-5657",
"i/o failure occurred trying to truncate %K",
&s_item_key);
err = -EIO;
goto out;
}
if (retval == POSITION_FOUND || retval == FILE_NOT_FOUND) {
- reiserfs_warning(p_s_inode->i_sb,
- "PAP-5660: reiserfs_do_truncate: "
+ reiserfs_warning(p_s_inode->i_sb, "PAP-5660",
"wrong result %d of search for %K", retval,
&s_item_key);
@@ -1850,8 +1844,8 @@ int reiserfs_do_truncate(struct reiserfs_transaction_handle *th, struct inode *p
reiserfs_cut_from_item(th, &s_search_path, &s_item_key,
p_s_inode, page, n_new_file_size);
if (n_deleted < 0) {
- reiserfs_warning(p_s_inode->i_sb,
- "vs-5665: reiserfs_do_truncate: reiserfs_cut_from_item failed");
+ reiserfs_warning(p_s_inode->i_sb, "vs-5665",
+ "reiserfs_cut_from_item failed");
reiserfs_check_path(&s_search_path);
return 0;
}
@@ -2000,8 +1994,8 @@ int reiserfs_paste_into_item(struct reiserfs_transaction_handle *th, struct tree
goto error_out;
}
if (retval == POSITION_FOUND) {
- reiserfs_warning(inode->i_sb,
- "PAP-5710: reiserfs_paste_into_item: entry or pasted byte (%K) exists",
+ reiserfs_warning(inode->i_sb, "PAP-5710",
+ "entry or pasted byte (%K) exists",
p_s_key);
retval = -EEXIST;
goto error_out;
@@ -2087,8 +2081,7 @@ int reiserfs_insert_item(struct reiserfs_transaction_handle *th, struct treepath
goto error_out;
}
if (retval == ITEM_FOUND) {
- reiserfs_warning(th->t_super,
- "PAP-5760: reiserfs_insert_item: "
+ reiserfs_warning(th->t_super, "PAP-5760",
"key %K already exists in the tree",
key);
retval = -EEXIST;