ocfs2: use memweight()
Use memweight to count the total number of bits set in memory area. Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Cc: Mark Fasheh <mfasheh@suse.com> Cc: Joel Becker <jlbec@evilplan.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
9a601396e8
commit
a75613ec73
|
@ -784,14 +784,10 @@ bail:
|
||||||
|
|
||||||
static u32 ocfs2_local_alloc_count_bits(struct ocfs2_dinode *alloc)
|
static u32 ocfs2_local_alloc_count_bits(struct ocfs2_dinode *alloc)
|
||||||
{
|
{
|
||||||
int i;
|
u32 count;
|
||||||
u8 *buffer;
|
|
||||||
u32 count = 0;
|
|
||||||
struct ocfs2_local_alloc *la = OCFS2_LOCAL_ALLOC(alloc);
|
struct ocfs2_local_alloc *la = OCFS2_LOCAL_ALLOC(alloc);
|
||||||
|
|
||||||
buffer = la->la_bitmap;
|
count = memweight(la->la_bitmap, le16_to_cpu(la->la_size));
|
||||||
for (i = 0; i < le16_to_cpu(la->la_size); i++)
|
|
||||||
count += hweight8(buffer[i]);
|
|
||||||
|
|
||||||
trace_ocfs2_local_alloc_count_bits(count);
|
trace_ocfs2_local_alloc_count_bits(count);
|
||||||
return count;
|
return count;
|
||||||
|
|
Loading…
Reference in New Issue