Skip to content

Commit

Permalink
hpfs: use bitmap_weight()
Browse files Browse the repository at this point in the history
Use bitmap_weight instead of doing hweight32 for each 32bit in bitmap.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
mita authored and torvalds committed Dec 16, 2009
1 parent c2923c3 commit f4c54fc
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions fs/hpfs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <linux/magic.h>
#include <linux/sched.h>
#include <linux/smp_lock.h>
#include <linux/bitmap.h>

/* Mark the filesystem dirty, so that chkdsk checks it when os/2 booted */

Expand Down Expand Up @@ -115,12 +116,13 @@ static void hpfs_put_super(struct super_block *s)
unsigned hpfs_count_one_bitmap(struct super_block *s, secno secno)
{
struct quad_buffer_head qbh;
unsigned *bits;
unsigned i, count;
if (!(bits = hpfs_map_4sectors(s, secno, &qbh, 4))) return 0;
count = 0;
for (i = 0; i < 2048 / sizeof(unsigned); i++)
count += hweight32(bits[i]);
unsigned long *bits;
unsigned count;

bits = hpfs_map_4sectors(s, secno, &qbh, 4);
if (!bits)
return 0;
count = bitmap_weight(bits, 2048 * BITS_PER_BYTE);
hpfs_brelse4(&qbh);
return count;
}
Expand Down

0 comments on commit f4c54fc

Please sign in to comment.