summaryrefslogtreecommitdiff
path: root/fs/reiserfs/bitmap.c
diff options
context:
space:
mode:
authorJeff Mahoney <jeffm@suse.com>2007-10-18 23:39:26 -0700
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-19 11:53:35 -0700
commit4d20851d3757ba5bece263a4c8c5a2bd4983cb5d (patch)
treeac89f9cf860801675e587c38c39fd9e6bd2204da /fs/reiserfs/bitmap.c
parent3ee1667042c350003b9d3f35e5666cc8c43ce8aa (diff)
reiserfs: remove first_zero_hint
The first_zero_hint metadata caching was never actually used, and it's of dubious optimization quality. This patch removes it. It doesn't actually shrink the size of the reiserfs_bitmap_info struct, since that doesn't work with block sizes larger than 8K. There was a big fixme in there, and with all the work lately in allowing block size > page size, I might as well kill the fixme as well. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/reiserfs/bitmap.c')
-rw-r--r--fs/reiserfs/bitmap.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/fs/reiserfs/bitmap.c b/fs/reiserfs/bitmap.c
index f7275176305e..f09a6f6d3ac0 100644
--- a/fs/reiserfs/bitmap.c
+++ b/fs/reiserfs/bitmap.c
@@ -273,7 +273,7 @@ static inline int block_group_used(struct super_block *s, u32 id)
* to make a better decision. This favors long-term performace gain
* with a better on-disk layout vs. a short term gain of skipping the
* read and potentially having a bad placement. */
- if (info->first_zero_hint == 0) {
+ if (info->free_count == UINT_MAX) {
struct buffer_head *bh = reiserfs_read_bitmap_block(s, bm);
brelse(bh);
}
@@ -1214,27 +1214,22 @@ void reiserfs_cache_bitmap_metadata(struct super_block *sb,
{
unsigned long *cur = (unsigned long *)(bh->b_data + bh->b_size);
- info->first_zero_hint = 1 << (sb->s_blocksize_bits + 3);
+ /* The first bit must ALWAYS be 1 */
+ BUG_ON(!reiserfs_test_le_bit(0, (unsigned long *)bh->b_data));
+
+ info->free_count = 0;
while (--cur >= (unsigned long *)bh->b_data) {
- int base = ((char *)cur - bh->b_data) << 3;
+ int i;
/* 0 and ~0 are special, we can optimize for them */
- if (*cur == 0) {
- info->first_zero_hint = base;
+ if (*cur == 0)
info->free_count += BITS_PER_LONG;
- } else if (*cur != ~0L) { /* A mix, investigate */
- int b;
- for (b = BITS_PER_LONG - 1; b >= 0; b--) {
- if (!reiserfs_test_le_bit(b, cur)) {
- info->first_zero_hint = base + b;
+ else if (*cur != ~0L) /* A mix, investigate */
+ for (i = BITS_PER_LONG - 1; i >= 0; i--)
+ if (!reiserfs_test_le_bit(i, cur))
info->free_count++;
- }
- }
- }
}
- /* The first bit must ALWAYS be 1 */
- BUG_ON(info->first_zero_hint == 0);
}
struct buffer_head *reiserfs_read_bitmap_block(struct super_block *sb,
@@ -1264,7 +1259,7 @@ struct buffer_head *reiserfs_read_bitmap_block(struct super_block *sb,
BUG_ON(!buffer_uptodate(bh));
BUG_ON(atomic_read(&bh->b_count) == 0);
- if (info->first_zero_hint == 0)
+ if (info->free_count == UINT_MAX)
reiserfs_cache_bitmap_metadata(sb, bh, info);
}
@@ -1279,7 +1274,7 @@ int reiserfs_init_bitmap_cache(struct super_block *sb)
if (bitmap == NULL)
return -ENOMEM;
- memset(bitmap, 0, sizeof (*bitmap) * SB_BMAP_NR(sb));
+ memset(bitmap, 0xff, sizeof(*bitmap) * SB_BMAP_NR(sb));
SB_AP_BITMAP(sb) = bitmap;