aboutsummaryrefslogtreecommitdiffstats
path: root/fs/reiserfs/bitmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/reiserfs/bitmap.c')
-rw-r--r--fs/reiserfs/bitmap.c56
1 files changed, 29 insertions, 27 deletions
diff --git a/fs/reiserfs/bitmap.c b/fs/reiserfs/bitmap.c
index 51b116103041..9fc228703ef0 100644
--- a/fs/reiserfs/bitmap.c
+++ b/fs/reiserfs/bitmap.c
@@ -64,9 +64,9 @@ 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, "vs-4010", 67 reiserfs_error(s, "vs-4010",
68 "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 }
72 72
@@ -79,30 +79,30 @@ 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", "bitmap block %lu(%u) " 82 reiserfs_error(s, "vs-4019", "bitmap block %lu(%u) "
83 "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", "bitmap block %lu(%u) " 89 reiserfs_error(s, "vs-4020", "bitmap block %lu(%u) "
90 "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, "vs-4030", "bitmap for requested block " 97 reiserfs_error(s, "vs-4030", "bitmap for requested block "
98 "is out of range: block=%lu, bitmap_nr=%u", 98 "is out of range: block=%lu, bitmap_nr=%u",
99 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, "vs-4050", "this is root block (%u), " 104 reiserfs_error(s, "vs-4050", "this is root block (%u), "
105 "it must be busy", SB_ROOT_BLOCK(s)); 105 "it must be busy", SB_ROOT_BLOCK(s));
106 return 0; 106 return 0;
107 } 107 }
108 108
@@ -153,8 +153,8 @@ static int scan_bitmap_block(struct reiserfs_transaction_handle *th,
153/* - 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. */
154 154
155 if (!bi) { 155 if (!bi) {
156 reiserfs_warning(s, "jdm-4055", "NULL bitmap info pointer " 156 reiserfs_error(s, "jdm-4055", "NULL bitmap info pointer "
157 "for bitmap %d", bmap_n); 157 "for bitmap %d", bmap_n);
158 return 0; 158 return 0;
159 } 159 }
160 160
@@ -399,8 +399,8 @@ static void _reiserfs_free_block(struct reiserfs_transaction_handle *th,
399 get_bit_address(s, block, &nr, &offset); 399 get_bit_address(s, block, &nr, &offset);
400 400
401 if (nr >= reiserfs_bmap_count(s)) { 401 if (nr >= reiserfs_bmap_count(s)) {
402 reiserfs_warning(s, "vs-4075", "block %lu is out of range", 402 reiserfs_error(s, "vs-4075", "block %lu is out of range",
403 block); 403 block);
404 return; 404 return;
405 } 405 }
406 406
@@ -412,8 +412,8 @@ static void _reiserfs_free_block(struct reiserfs_transaction_handle *th,
412 412
413 /* clear bit for the given block in bit map */ 413 /* clear bit for the given block in bit map */
414 if (!reiserfs_test_and_clear_le_bit(offset, bmbh->b_data)) { 414 if (!reiserfs_test_and_clear_le_bit(offset, bmbh->b_data)) {
415 reiserfs_warning(s, "vs-4080", 415 reiserfs_error(s, "vs-4080",
416 "block %lu: bit already cleared", block); 416 "block %lu: bit already cleared", block);
417 } 417 }
418 apbi[nr].free_count++; 418 apbi[nr].free_count++;
419 journal_mark_dirty(th, s, bmbh); 419 journal_mark_dirty(th, s, bmbh);
@@ -440,7 +440,7 @@ void reiserfs_free_block(struct reiserfs_transaction_handle *th,
440 return; 440 return;
441 441
442 if (block > sb_block_count(REISERFS_SB(s)->s_rs)) { 442 if (block > sb_block_count(REISERFS_SB(s)->s_rs)) {
443 reiserfs_panic(th->t_super, "bitmap-4072", 443 reiserfs_error(th->t_super, "bitmap-4072",
444 "Trying to free block outside file system " 444 "Trying to free block outside file system "
445 "boundaries (%lu > %lu)", 445 "boundaries (%lu > %lu)",
446 block, sb_block_count(REISERFS_SB(s)->s_rs)); 446 block, sb_block_count(REISERFS_SB(s)->s_rs));
@@ -472,8 +472,8 @@ static void __discard_prealloc(struct reiserfs_transaction_handle *th,
472 BUG_ON(!th->t_trans_id); 472 BUG_ON(!th->t_trans_id);
473#ifdef CONFIG_REISERFS_CHECK 473#ifdef CONFIG_REISERFS_CHECK
474 if (ei->i_prealloc_count < 0) 474 if (ei->i_prealloc_count < 0)
475 reiserfs_warning(th->t_super, "zam-4001", 475 reiserfs_error(th->t_super, "zam-4001",
476 "inode has negative prealloc blocks count."); 476 "inode has negative prealloc blocks count.");
477#endif 477#endif
478 while (ei->i_prealloc_count > 0) { 478 while (ei->i_prealloc_count > 0) {
479 reiserfs_free_prealloc_block(th, inode, ei->i_prealloc_block); 479 reiserfs_free_prealloc_block(th, inode, ei->i_prealloc_block);
@@ -509,9 +509,9 @@ void reiserfs_discard_all_prealloc(struct reiserfs_transaction_handle *th)
509 i_prealloc_list); 509 i_prealloc_list);
510#ifdef CONFIG_REISERFS_CHECK 510#ifdef CONFIG_REISERFS_CHECK
511 if (!ei->i_prealloc_count) { 511 if (!ei->i_prealloc_count) {
512 reiserfs_warning(th->t_super, "zam-4001", 512 reiserfs_error(th->t_super, "zam-4001",
513 "inode is in prealloc list but has " 513 "inode is in prealloc list but has "
514 "no preallocated blocks."); 514 "no preallocated blocks.");
515 } 515 }
516#endif 516#endif
517 __discard_prealloc(th, ei); 517 __discard_prealloc(th, ei);
@@ -1213,7 +1213,9 @@ void reiserfs_cache_bitmap_metadata(struct super_block *sb,
1213 unsigned long *cur = (unsigned long *)(bh->b_data + bh->b_size); 1213 unsigned long *cur = (unsigned long *)(bh->b_data + bh->b_size);
1214 1214
1215 /* The first bit must ALWAYS be 1 */ 1215 /* The first bit must ALWAYS be 1 */
1216 BUG_ON(!reiserfs_test_le_bit(0, (unsigned long *)bh->b_data)); 1216 if (!reiserfs_test_le_bit(0, (unsigned long *)bh->b_data))
1217 reiserfs_error(sb, "reiserfs-2025", "bitmap block %lu is "
1218 "corrupted: first bit must be 1", bh->b_blocknr);
1217 1219
1218 info->free_count = 0; 1220 info->free_count = 0;
1219 1221