diff options
author | Jeff Mahoney <jeffm@suse.com> | 2009-03-30 14:02:21 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-03-30 15:16:36 -0400 |
commit | 45b03d5e8e674eb6555b767e1c8eb40b671ff892 (patch) | |
tree | d74acd1be7f5102143df960e8cd692aadcc437df /fs/reiserfs/bitmap.c | |
parent | 1d889d9958490888b3fad1d486145d9a03559cbc (diff) |
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/bitmap.c')
-rw-r--r-- | fs/reiserfs/bitmap.c | 52 |
1 files changed, 23 insertions, 29 deletions
diff --git a/fs/reiserfs/bitmap.c b/fs/reiserfs/bitmap.c index 98b92a3da14a..51b116103041 100644 --- a/fs/reiserfs/bitmap.c +++ b/fs/reiserfs/bitmap.c | |||
@@ -64,8 +64,8 @@ int is_reusable(struct super_block *s, b_blocknr_t block, int bit_value) | |||
64 | unsigned int bmap_count = reiserfs_bmap_count(s); | 64 | unsigned int bmap_count = reiserfs_bmap_count(s); |
65 | 65 | ||
66 | if (block == 0 || block >= SB_BLOCK_COUNT(s)) { | 66 | if (block == 0 || block >= SB_BLOCK_COUNT(s)) { |
67 | reiserfs_warning(s, | 67 | reiserfs_warning(s, "vs-4010", |
68 | "vs-4010: is_reusable: block number is out of range %lu (%u)", | 68 | "block number is out of range %lu (%u)", |
69 | block, SB_BLOCK_COUNT(s)); | 69 | block, SB_BLOCK_COUNT(s)); |
70 | return 0; | 70 | return 0; |
71 | } | 71 | } |
@@ -79,30 +79,29 @@ int is_reusable(struct super_block *s, b_blocknr_t block, int bit_value) | |||
79 | b_blocknr_t bmap1 = REISERFS_SB(s)->s_sbh->b_blocknr + 1; | 79 | b_blocknr_t bmap1 = REISERFS_SB(s)->s_sbh->b_blocknr + 1; |
80 | if (block >= bmap1 && | 80 | if (block >= bmap1 && |
81 | block <= bmap1 + bmap_count) { | 81 | block <= bmap1 + bmap_count) { |
82 | reiserfs_warning(s, "vs: 4019: is_reusable: " | 82 | reiserfs_warning(s, "vs-4019", "bitmap block %lu(%u) " |
83 | "bitmap block %lu(%u) can't be freed or reused", | 83 | "can't be freed or reused", |
84 | block, bmap_count); | 84 | block, bmap_count); |
85 | return 0; | 85 | return 0; |
86 | } | 86 | } |
87 | } else { | 87 | } else { |
88 | if (offset == 0) { | 88 | if (offset == 0) { |
89 | reiserfs_warning(s, "vs: 4020: is_reusable: " | 89 | reiserfs_warning(s, "vs-4020", "bitmap block %lu(%u) " |
90 | "bitmap block %lu(%u) can't be freed or reused", | 90 | "can't be freed or reused", |
91 | block, bmap_count); | 91 | block, bmap_count); |
92 | return 0; | 92 | return 0; |
93 | } | 93 | } |
94 | } | 94 | } |
95 | 95 | ||
96 | if (bmap >= bmap_count) { | 96 | if (bmap >= bmap_count) { |
97 | reiserfs_warning(s, | 97 | reiserfs_warning(s, "vs-4030", "bitmap for requested block " |
98 | "vs-4030: is_reusable: there is no so many bitmap blocks: " | 98 | "is out of range: block=%lu, bitmap_nr=%u", |
99 | "block=%lu, bitmap_nr=%u", block, bmap); | 99 | block, bmap); |
100 | return 0; | 100 | return 0; |
101 | } | 101 | } |
102 | 102 | ||
103 | if (bit_value == 0 && block == SB_ROOT_BLOCK(s)) { | 103 | if (bit_value == 0 && block == SB_ROOT_BLOCK(s)) { |
104 | reiserfs_warning(s, | 104 | reiserfs_warning(s, "vs-4050", "this is root block (%u), " |
105 | "vs-4050: is_reusable: this is root block (%u), " | ||
106 | "it must be busy", SB_ROOT_BLOCK(s)); | 105 | "it must be busy", SB_ROOT_BLOCK(s)); |
107 | return 0; | 106 | return 0; |
108 | } | 107 | } |
@@ -154,8 +153,8 @@ static int scan_bitmap_block(struct reiserfs_transaction_handle *th, | |||
154 | /* - I mean `a window of zero bits' as in description of this function - Zam. */ | 153 | /* - I mean `a window of zero bits' as in description of this function - Zam. */ |
155 | 154 | ||
156 | if (!bi) { | 155 | if (!bi) { |
157 | reiserfs_warning(s, "NULL bitmap info pointer for bitmap %d", | 156 | reiserfs_warning(s, "jdm-4055", "NULL bitmap info pointer " |
158 | bmap_n); | 157 | "for bitmap %d", bmap_n); |
159 | return 0; | 158 | return 0; |
160 | } | 159 | } |
161 | 160 | ||
@@ -400,11 +399,8 @@ static void _reiserfs_free_block(struct reiserfs_transaction_handle *th, | |||
400 | get_bit_address(s, block, &nr, &offset); | 399 | get_bit_address(s, block, &nr, &offset); |
401 | 400 | ||
402 | if (nr >= reiserfs_bmap_count(s)) { | 401 | if (nr >= reiserfs_bmap_count(s)) { |
403 | reiserfs_warning(s, "vs-4075: reiserfs_free_block: " | 402 | reiserfs_warning(s, "vs-4075", "block %lu is out of range", |
404 | "block %lu is out of range on %s " | 403 | block); |
405 | "(nr=%u,max=%u)", block, | ||
406 | reiserfs_bdevname(s), nr, | ||
407 | reiserfs_bmap_count(s)); | ||
408 | return; | 404 | return; |
409 | } | 405 | } |
410 | 406 | ||
@@ -416,9 +412,8 @@ static void _reiserfs_free_block(struct reiserfs_transaction_handle *th, | |||
416 | 412 | ||
417 | /* clear bit for the given block in bit map */ | 413 | /* clear bit for the given block in bit map */ |
418 | if (!reiserfs_test_and_clear_le_bit(offset, bmbh->b_data)) { | 414 | if (!reiserfs_test_and_clear_le_bit(offset, bmbh->b_data)) { |
419 | reiserfs_warning(s, "vs-4080: reiserfs_free_block: " | 415 | reiserfs_warning(s, "vs-4080", |
420 | "free_block (%s:%lu)[dev:blocknr]: bit already cleared", | 416 | "block %lu: bit already cleared", block); |
421 | reiserfs_bdevname(s), block); | ||
422 | } | 417 | } |
423 | apbi[nr].free_count++; | 418 | apbi[nr].free_count++; |
424 | journal_mark_dirty(th, s, bmbh); | 419 | journal_mark_dirty(th, s, bmbh); |
@@ -477,9 +472,8 @@ static void __discard_prealloc(struct reiserfs_transaction_handle *th, | |||
477 | BUG_ON(!th->t_trans_id); | 472 | BUG_ON(!th->t_trans_id); |
478 | #ifdef CONFIG_REISERFS_CHECK | 473 | #ifdef CONFIG_REISERFS_CHECK |
479 | if (ei->i_prealloc_count < 0) | 474 | if (ei->i_prealloc_count < 0) |
480 | reiserfs_warning(th->t_super, | 475 | reiserfs_warning(th->t_super, "zam-4001", |
481 | "zam-4001:%s: inode has negative prealloc blocks count.", | 476 | "inode has negative prealloc blocks count."); |
482 | __func__); | ||
483 | #endif | 477 | #endif |
484 | while (ei->i_prealloc_count > 0) { | 478 | while (ei->i_prealloc_count > 0) { |
485 | reiserfs_free_prealloc_block(th, inode, ei->i_prealloc_block); | 479 | reiserfs_free_prealloc_block(th, inode, ei->i_prealloc_block); |
@@ -515,9 +509,9 @@ void reiserfs_discard_all_prealloc(struct reiserfs_transaction_handle *th) | |||
515 | i_prealloc_list); | 509 | i_prealloc_list); |
516 | #ifdef CONFIG_REISERFS_CHECK | 510 | #ifdef CONFIG_REISERFS_CHECK |
517 | if (!ei->i_prealloc_count) { | 511 | if (!ei->i_prealloc_count) { |
518 | reiserfs_warning(th->t_super, | 512 | reiserfs_warning(th->t_super, "zam-4001", |
519 | "zam-4001:%s: inode is in prealloc list but has no preallocated blocks.", | 513 | "inode is in prealloc list but has " |
520 | __func__); | 514 | "no preallocated blocks."); |
521 | } | 515 | } |
522 | #endif | 516 | #endif |
523 | __discard_prealloc(th, ei); | 517 | __discard_prealloc(th, ei); |
@@ -631,8 +625,8 @@ int reiserfs_parse_alloc_options(struct super_block *s, char *options) | |||
631 | continue; | 625 | continue; |
632 | } | 626 | } |
633 | 627 | ||
634 | reiserfs_warning(s, "zam-4001: %s : unknown option - %s", | 628 | reiserfs_warning(s, "zam-4001", "unknown option - %s", |
635 | __func__, this_char); | 629 | this_char); |
636 | return 1; | 630 | return 1; |
637 | } | 631 | } |
638 | 632 | ||