aboutsummaryrefslogtreecommitdiffstats
path: root/fs/reiserfs/bitmap.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-03-30 15:29:21 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-03-30 15:33:01 -0400
commite1c502482853f84606928f5a2f2eb6da1993cda1 (patch)
treeca296007164906342a195bdf3a5305277e6af5da /fs/reiserfs/bitmap.c
parent019abbc87025a030fd25008612afd4eff8a375f7 (diff)
parentee93961be1faddf9e9a638bc519145c20f0cfeba (diff)
Merge branch 'reiserfs-updates' from Jeff Mahoney
* reiserfs-updates: (35 commits) reiserfs: rename [cn]_* variables reiserfs: rename p_._ variables reiserfs: rename p_s_tb to tb reiserfs: rename p_s_inode to inode reiserfs: rename p_s_bh to bh reiserfs: rename p_s_sb to sb reiserfs: strip trailing whitespace reiserfs: cleanup path functions reiserfs: factor out buffer_info initialization reiserfs: add atomic addition of selinux attributes during inode creation reiserfs: use generic readdir for operations across all xattrs reiserfs: journaled xattrs reiserfs: use generic xattr handlers reiserfs: remove i_has_xattr_dir reiserfs: make per-inode xattr locking more fine grained reiserfs: eliminate per-super xattr lock reiserfs: simplify xattr internal file lookups/opens reiserfs: Clean up xattrs when REISERFS_FS_XATTR is unset reiserfs: remove IS_PRIVATE helpers reiserfs: remove link detection code ... Fixed up conflicts manually due to: - quota name cleanups vs variable naming changes: fs/reiserfs/inode.c fs/reiserfs/namei.c fs/reiserfs/stree.c fs/reiserfs/xattr.c - exported include header cleanups include/linux/reiserfs_fs.h
Diffstat (limited to 'fs/reiserfs/bitmap.c')
-rw-r--r--fs/reiserfs/bitmap.c72
1 files changed, 34 insertions, 38 deletions
diff --git a/fs/reiserfs/bitmap.c b/fs/reiserfs/bitmap.c
index f32d1425cc9f..e716161ab325 100644
--- a/fs/reiserfs/bitmap.c
+++ b/fs/reiserfs/bitmap.c
@@ -40,8 +40,8 @@
40 40
41#define SET_OPTION(optname) \ 41#define SET_OPTION(optname) \
42 do { \ 42 do { \
43 reiserfs_warning(s, "reiserfs: option \"%s\" is set", #optname); \ 43 reiserfs_info(s, "block allocator option \"%s\" is set", #optname); \
44 set_bit(_ALLOC_ ## optname , &SB_ALLOC_OPTS(s)); \ 44 set_bit(_ALLOC_ ## optname , &SB_ALLOC_OPTS(s)); \
45 } while(0) 45 } while(0)
46#define TEST_OPTION(optname, s) \ 46#define TEST_OPTION(optname, s) \
47 test_bit(_ALLOC_ ## optname , &SB_ALLOC_OPTS(s)) 47 test_bit(_ALLOC_ ## optname , &SB_ALLOC_OPTS(s))
@@ -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, 67 reiserfs_error(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 }
72 72
@@ -79,31 +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: is_reusable: " 82 reiserfs_error(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_error(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_error(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_error(s, "vs-4050", "this is root block (%u), "
105 "vs-4050: is_reusable: this is root block (%u), " 105 "it must be busy", SB_ROOT_BLOCK(s));
106 "it must be busy", SB_ROOT_BLOCK(s));
107 return 0; 106 return 0;
108 } 107 }
109 108
@@ -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_error(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_error(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_error(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);
@@ -445,7 +440,7 @@ void reiserfs_free_block(struct reiserfs_transaction_handle *th,
445 return; 440 return;
446 441
447 if (block > sb_block_count(REISERFS_SB(s)->s_rs)) { 442 if (block > sb_block_count(REISERFS_SB(s)->s_rs)) {
448 reiserfs_panic(th->t_super, "bitmap-4072", 443 reiserfs_error(th->t_super, "bitmap-4072",
449 "Trying to free block outside file system " 444 "Trying to free block outside file system "
450 "boundaries (%lu > %lu)", 445 "boundaries (%lu > %lu)",
451 block, sb_block_count(REISERFS_SB(s)->s_rs)); 446 block, sb_block_count(REISERFS_SB(s)->s_rs));
@@ -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_error(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_error(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,12 +625,12 @@ 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
639 reiserfs_warning(s, "allocator options = [%08x]\n", SB_ALLOC_OPTS(s)); 633 reiserfs_info(s, "allocator options = [%08x]\n", SB_ALLOC_OPTS(s));
640 return 0; 634 return 0;
641} 635}
642 636
@@ -1221,7 +1215,9 @@ void reiserfs_cache_bitmap_metadata(struct super_block *sb,
1221 unsigned long *cur = (unsigned long *)(bh->b_data + bh->b_size); 1215 unsigned long *cur = (unsigned long *)(bh->b_data + bh->b_size);
1222 1216
1223 /* The first bit must ALWAYS be 1 */ 1217 /* The first bit must ALWAYS be 1 */
1224 BUG_ON(!reiserfs_test_le_bit(0, (unsigned long *)bh->b_data)); 1218 if (!reiserfs_test_le_bit(0, (unsigned long *)bh->b_data))
1219 reiserfs_error(sb, "reiserfs-2025", "bitmap block %lu is "
1220 "corrupted: first bit must be 1", bh->b_blocknr);
1225 1221
1226 info->free_count = 0; 1222 info->free_count = 0;
1227 1223