Commit 9d6bf5aa authored by Akinobu Mita's avatar Akinobu Mita Committed by Linus Torvalds

reiserfs: use hweight_long()

Use hweight_long() to count free bits in the bitmap.
Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 0c2fd1bf
...@@ -1222,15 +1222,11 @@ void reiserfs_cache_bitmap_metadata(struct super_block *sb, ...@@ -1222,15 +1222,11 @@ void reiserfs_cache_bitmap_metadata(struct super_block *sb,
info->free_count = 0; info->free_count = 0;
while (--cur >= (unsigned long *)bh->b_data) { while (--cur >= (unsigned long *)bh->b_data) {
int i;
/* 0 and ~0 are special, we can optimize for them */ /* 0 and ~0 are special, we can optimize for them */
if (*cur == 0) if (*cur == 0)
info->free_count += BITS_PER_LONG; info->free_count += BITS_PER_LONG;
else if (*cur != ~0L) /* A mix, investigate */ else if (*cur != ~0L) /* A mix, investigate */
for (i = BITS_PER_LONG - 1; i >= 0; i--) info->free_count += BITS_PER_LONG - hweight_long(*cur);
if (!reiserfs_test_le_bit(i, cur))
info->free_count++;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment