Skip to content

Commit

Permalink
reiserfs: use hweight_long()
Browse files Browse the repository at this point in the history
Use hweight_long() to count free bits in the bitmap.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Akinobu Mita authored and Linus Torvalds committed Jul 26, 2011
1 parent 0c2fd1b commit 9d6bf5a
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions fs/reiserfs/bitmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1222,15 +1222,11 @@ void reiserfs_cache_bitmap_metadata(struct super_block *sb,
info->free_count = 0;

while (--cur >= (unsigned long *)bh->b_data) {
int i;

/* 0 and ~0 are special, we can optimize for them */
if (*cur == 0)
info->free_count += BITS_PER_LONG;
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++;
info->free_count += BITS_PER_LONG - hweight_long(*cur);
}
}

Expand Down

0 comments on commit 9d6bf5a

Please sign in to comment.