Skip to content

Commit 45b03d5

Browse files
jeffmahoneytorvalds
authored andcommitted
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>
1 parent 1d889d9 commit 45b03d5

17 files changed

Lines changed: 454 additions & 426 deletions

File tree

‎fs/reiserfs/bitmap.c‎

Lines changed: 23 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ int is_reusable(struct super_block *s, b_blocknr_t block, int bit_value)
6464
unsigned int bmap_count = reiserfs_bmap_count(s);
6565

6666
if (block == 0 || block >= SB_BLOCK_COUNT(s)) {
67-
reiserfs_warning(s,
68-
"vs-4010: is_reusable: block number is out of range %lu (%u)",
67+
reiserfs_warning(s, "vs-4010",
68+
"block number is out of range %lu (%u)",
6969
block, SB_BLOCK_COUNT(s));
7070
return 0;
7171
}
@@ -79,30 +79,29 @@ int is_reusable(struct super_block *s, b_blocknr_t block, int bit_value)
7979
b_blocknr_t bmap1 = REISERFS_SB(s)->s_sbh->b_blocknr + 1;
8080
if (block >= bmap1 &&
8181
block <= bmap1 + bmap_count) {
82-
reiserfs_warning(s, "vs: 4019: is_reusable: "
83-
"bitmap block %lu(%u) can't be freed or reused",
82+
reiserfs_warning(s, "vs-4019", "bitmap block %lu(%u) "
83+
"can't be freed or reused",
8484
block, bmap_count);
8585
return 0;
8686
}
8787
} else {
8888
if (offset == 0) {
89-
reiserfs_warning(s, "vs: 4020: is_reusable: "
90-
"bitmap block %lu(%u) can't be freed or reused",
89+
reiserfs_warning(s, "vs-4020", "bitmap block %lu(%u) "
90+
"can't be freed or reused",
9191
block, bmap_count);
9292
return 0;
9393
}
9494
}
9595

9696
if (bmap >= bmap_count) {
97-
reiserfs_warning(s,
98-
"vs-4030: is_reusable: there is no so many bitmap blocks: "
99-
"block=%lu, bitmap_nr=%u", block, bmap);
97+
reiserfs_warning(s, "vs-4030", "bitmap for requested block "
98+
"is out of range: block=%lu, bitmap_nr=%u",
99+
block, bmap);
100100
return 0;
101101
}
102102

103103
if (bit_value == 0 && block == SB_ROOT_BLOCK(s)) {
104-
reiserfs_warning(s,
105-
"vs-4050: is_reusable: this is root block (%u), "
104+
reiserfs_warning(s, "vs-4050", "this is root block (%u), "
106105
"it must be busy", SB_ROOT_BLOCK(s));
107106
return 0;
108107
}
@@ -154,8 +153,8 @@ static int scan_bitmap_block(struct reiserfs_transaction_handle *th,
154153
/* - I mean `a window of zero bits' as in description of this function - Zam. */
155154

156155
if (!bi) {
157-
reiserfs_warning(s, "NULL bitmap info pointer for bitmap %d",
158-
bmap_n);
156+
reiserfs_warning(s, "jdm-4055", "NULL bitmap info pointer "
157+
"for bitmap %d", bmap_n);
159158
return 0;
160159
}
161160

@@ -400,11 +399,8 @@ static void _reiserfs_free_block(struct reiserfs_transaction_handle *th,
400399
get_bit_address(s, block, &nr, &offset);
401400

402401
if (nr >= reiserfs_bmap_count(s)) {
403-
reiserfs_warning(s, "vs-4075: reiserfs_free_block: "
404-
"block %lu is out of range on %s "
405-
"(nr=%u,max=%u)", block,
406-
reiserfs_bdevname(s), nr,
407-
reiserfs_bmap_count(s));
402+
reiserfs_warning(s, "vs-4075", "block %lu is out of range",
403+
block);
408404
return;
409405
}
410406

@@ -416,9 +412,8 @@ static void _reiserfs_free_block(struct reiserfs_transaction_handle *th,
416412

417413
/* clear bit for the given block in bit map */
418414
if (!reiserfs_test_and_clear_le_bit(offset, bmbh->b_data)) {
419-
reiserfs_warning(s, "vs-4080: reiserfs_free_block: "
420-
"free_block (%s:%lu)[dev:blocknr]: bit already cleared",
421-
reiserfs_bdevname(s), block);
415+
reiserfs_warning(s, "vs-4080",
416+
"block %lu: bit already cleared", block);
422417
}
423418
apbi[nr].free_count++;
424419
journal_mark_dirty(th, s, bmbh);
@@ -477,9 +472,8 @@ static void __discard_prealloc(struct reiserfs_transaction_handle *th,
477472
BUG_ON(!th->t_trans_id);
478473
#ifdef CONFIG_REISERFS_CHECK
479474
if (ei->i_prealloc_count < 0)
480-
reiserfs_warning(th->t_super,
481-
"zam-4001:%s: inode has negative prealloc blocks count.",
482-
__func__);
475+
reiserfs_warning(th->t_super, "zam-4001",
476+
"inode has negative prealloc blocks count.");
483477
#endif
484478
while (ei->i_prealloc_count > 0) {
485479
reiserfs_free_prealloc_block(th, inode, ei->i_prealloc_block);
@@ -515,9 +509,9 @@ void reiserfs_discard_all_prealloc(struct reiserfs_transaction_handle *th)
515509
i_prealloc_list);
516510
#ifdef CONFIG_REISERFS_CHECK
517511
if (!ei->i_prealloc_count) {
518-
reiserfs_warning(th->t_super,
519-
"zam-4001:%s: inode is in prealloc list but has no preallocated blocks.",
520-
__func__);
512+
reiserfs_warning(th->t_super, "zam-4001",
513+
"inode is in prealloc list but has "
514+
"no preallocated blocks.");
521515
}
522516
#endif
523517
__discard_prealloc(th, ei);
@@ -631,8 +625,8 @@ int reiserfs_parse_alloc_options(struct super_block *s, char *options)
631625
continue;
632626
}
633627

634-
reiserfs_warning(s, "zam-4001: %s : unknown option - %s",
635-
__func__, this_char);
628+
reiserfs_warning(s, "zam-4001", "unknown option - %s",
629+
this_char);
636630
return 1;
637631
}
638632

‎fs/reiserfs/do_balan.c‎

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1752,15 +1752,16 @@ static void store_thrown(struct tree_balance *tb, struct buffer_head *bh)
17521752
int i;
17531753

17541754
if (buffer_dirty(bh))
1755-
reiserfs_warning(tb->tb_sb,
1756-
"store_thrown deals with dirty buffer");
1755+
reiserfs_warning(tb->tb_sb, "reiserfs-12320",
1756+
"called with dirty buffer");
17571757
for (i = 0; i < ARRAY_SIZE(tb->thrown); i++)
17581758
if (!tb->thrown[i]) {
17591759
tb->thrown[i] = bh;
17601760
get_bh(bh); /* free_thrown puts this */
17611761
return;
17621762
}
1763-
reiserfs_warning(tb->tb_sb, "store_thrown: too many thrown buffers");
1763+
reiserfs_warning(tb->tb_sb, "reiserfs-12321",
1764+
"too many thrown buffers");
17641765
}
17651766

17661767
static void free_thrown(struct tree_balance *tb)
@@ -1771,8 +1772,8 @@ static void free_thrown(struct tree_balance *tb)
17711772
if (tb->thrown[i]) {
17721773
blocknr = tb->thrown[i]->b_blocknr;
17731774
if (buffer_dirty(tb->thrown[i]))
1774-
reiserfs_warning(tb->tb_sb,
1775-
"free_thrown deals with dirty buffer %d",
1775+
reiserfs_warning(tb->tb_sb, "reiserfs-12322",
1776+
"called with dirty buffer %d",
17761777
blocknr);
17771778
brelse(tb->thrown[i]); /* incremented in store_thrown */
17781779
reiserfs_free_block(tb->transaction_handle, NULL,
@@ -1877,13 +1878,12 @@ static void check_internal_node(struct super_block *s, struct buffer_head *bh,
18771878
}
18781879
}
18791880

1880-
static int locked_or_not_in_tree(struct buffer_head *bh, char *which)
1881+
static int locked_or_not_in_tree(struct tree_balance *tb,
1882+
struct buffer_head *bh, char *which)
18811883
{
18821884
if ((!buffer_journal_prepared(bh) && buffer_locked(bh)) ||
18831885
!B_IS_IN_TREE(bh)) {
1884-
reiserfs_warning(NULL,
1885-
"vs-12339: locked_or_not_in_tree: %s (%b)",
1886-
which, bh);
1886+
reiserfs_warning(tb->tb_sb, "vs-12339", "%s (%b)", which, bh);
18871887
return 1;
18881888
}
18891889
return 0;
@@ -1902,18 +1902,19 @@ static int check_before_balancing(struct tree_balance *tb)
19021902
/* double check that buffers that we will modify are unlocked. (fix_nodes should already have
19031903
prepped all of these for us). */
19041904
if (tb->lnum[0]) {
1905-
retval |= locked_or_not_in_tree(tb->L[0], "L[0]");
1906-
retval |= locked_or_not_in_tree(tb->FL[0], "FL[0]");
1907-
retval |= locked_or_not_in_tree(tb->CFL[0], "CFL[0]");
1905+
retval |= locked_or_not_in_tree(tb, tb->L[0], "L[0]");
1906+
retval |= locked_or_not_in_tree(tb, tb->FL[0], "FL[0]");
1907+
retval |= locked_or_not_in_tree(tb, tb->CFL[0], "CFL[0]");
19081908
check_leaf(tb->L[0]);
19091909
}
19101910
if (tb->rnum[0]) {
1911-
retval |= locked_or_not_in_tree(tb->R[0], "R[0]");
1912-
retval |= locked_or_not_in_tree(tb->FR[0], "FR[0]");
1913-
retval |= locked_or_not_in_tree(tb->CFR[0], "CFR[0]");
1911+
retval |= locked_or_not_in_tree(tb, tb->R[0], "R[0]");
1912+
retval |= locked_or_not_in_tree(tb, tb->FR[0], "FR[0]");
1913+
retval |= locked_or_not_in_tree(tb, tb->CFR[0], "CFR[0]");
19141914
check_leaf(tb->R[0]);
19151915
}
1916-
retval |= locked_or_not_in_tree(PATH_PLAST_BUFFER(tb->tb_path), "S[0]");
1916+
retval |= locked_or_not_in_tree(tb, PATH_PLAST_BUFFER(tb->tb_path),
1917+
"S[0]");
19171918
check_leaf(PATH_PLAST_BUFFER(tb->tb_path));
19181919

19191920
return retval;
@@ -1952,7 +1953,7 @@ static void check_after_balance_leaf(struct tree_balance *tb)
19521953
PATH_H_POSITION(tb->tb_path,
19531954
1))));
19541955
print_cur_tb("12223");
1955-
reiserfs_warning(tb->tb_sb,
1956+
reiserfs_warning(tb->tb_sb, "reiserfs-12363",
19561957
"B_FREE_SPACE (PATH_H_PBUFFER(tb->tb_path,0)) = %d; "
19571958
"MAX_CHILD_SIZE (%d) - dc_size( %y, %d ) [%d] = %d",
19581959
left,
@@ -2104,9 +2105,8 @@ void do_balance(struct tree_balance *tb, /* tree_balance structure */
21042105
}
21052106
/* if we have no real work to do */
21062107
if (!tb->insert_size[0]) {
2107-
reiserfs_warning(tb->tb_sb,
2108-
"PAP-12350: do_balance: insert_size == 0, mode == %c",
2109-
flag);
2108+
reiserfs_warning(tb->tb_sb, "PAP-12350",
2109+
"insert_size == 0, mode == %c", flag);
21102110
unfix_nodes(tb);
21112111
return;
21122112
}

‎fs/reiserfs/file.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ static int reiserfs_file_release(struct inode *inode, struct file *filp)
7676
* and let the admin know what is going on.
7777
*/
7878
igrab(inode);
79-
reiserfs_warning(inode->i_sb,
79+
reiserfs_warning(inode->i_sb, "clm-9001",
8080
"pinning inode %lu because the "
8181
"preallocation can't be freed",
8282
inode->i_ino);

‎fs/reiserfs/fix_node.c‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -496,8 +496,8 @@ static int get_num_ver(int mode, struct tree_balance *tb, int h,
496496
snum012[needed_nodes - 1 + 3] = units;
497497

498498
if (needed_nodes > 2)
499-
reiserfs_warning(tb->tb_sb, "vs-8111: get_num_ver: "
500-
"split_item_position is out of boundary");
499+
reiserfs_warning(tb->tb_sb, "vs-8111",
500+
"split_item_position is out of range");
501501
snum012[needed_nodes - 1]++;
502502
split_item_positions[needed_nodes - 1] = i;
503503
needed_nodes++;
@@ -533,8 +533,8 @@ static int get_num_ver(int mode, struct tree_balance *tb, int h,
533533

534534
if (vn->vn_vi[split_item_num].vi_index != TYPE_DIRENTRY &&
535535
vn->vn_vi[split_item_num].vi_index != TYPE_INDIRECT)
536-
reiserfs_warning(tb->tb_sb, "vs-8115: get_num_ver: not "
537-
"directory or indirect item");
536+
reiserfs_warning(tb->tb_sb, "vs-8115",
537+
"not directory or indirect item");
538538
}
539539

540540
/* now we know S2bytes, calculate S1bytes */
@@ -2268,9 +2268,9 @@ static int wait_tb_buffers_until_unlocked(struct tree_balance *p_s_tb)
22682268
#ifdef CONFIG_REISERFS_CHECK
22692269
repeat_counter++;
22702270
if ((repeat_counter % 10000) == 0) {
2271-
reiserfs_warning(p_s_tb->tb_sb,
2272-
"wait_tb_buffers_until_released(): too many "
2273-
"iterations waiting for buffer to unlock "
2271+
reiserfs_warning(p_s_tb->tb_sb, "reiserfs-8200",
2272+
"too many iterations waiting "
2273+
"for buffer to unlock "
22742274
"(%b)", locked);
22752275

22762276
/* Don't loop forever. Try to recover from possible error. */

0 commit comments

Comments
 (0)