Skip to content

Commit

Permalink
ocfs2: use memweight()
Browse files Browse the repository at this point in the history
Use memweight to count the total number of bits set in memory area.

Signed-off-by: Akinobu Mita <[email protected]>
Cc: Mark Fasheh <[email protected]>
Cc: Joel Becker <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
mita authored and torvalds committed Jul 31, 2012
1 parent 9a60139 commit a75613e
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions fs/ocfs2/localalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -784,14 +784,10 @@ int ocfs2_claim_local_alloc_bits(struct ocfs2_super *osb,

static u32 ocfs2_local_alloc_count_bits(struct ocfs2_dinode *alloc)
{
int i;
u8 *buffer;
u32 count = 0;
u32 count;
struct ocfs2_local_alloc *la = OCFS2_LOCAL_ALLOC(alloc);

buffer = la->la_bitmap;
for (i = 0; i < le16_to_cpu(la->la_size); i++)
count += hweight8(buffer[i]);
count = memweight(la->la_bitmap, le16_to_cpu(la->la_size));

trace_ocfs2_local_alloc_count_bits(count);
return count;
Expand Down

0 comments on commit a75613e

Please sign in to comment.