提交 a75613ec 编写于 作者: A Akinobu Mita 提交者: Linus Torvalds

ocfs2: use memweight()

Use memweight to count the total number of bits set in memory area.
Signed-off-by: NAkinobu Mita <akinobu.mita@gmail.com>
Cc: Mark Fasheh <mfasheh@suse.com>
Cc: Joel Becker <jlbec@evilplan.org>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 9a601396
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册