From: Akinobu Mita Date: Mon, 30 Jul 2012 21:41:03 +0000 (-0700) Subject: ocfs2: use memweight() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a75613ec73ec87726a81fe421385a13c25fdcfc4;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git ocfs2: use memweight() Use memweight to count the total number of bits set in memory area. Signed-off-by: Akinobu Mita Cc: Mark Fasheh Cc: Joel Becker Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c index 210c35237548..a9f78c74d687 100644 --- a/fs/ocfs2/localalloc.c +++ b/fs/ocfs2/localalloc.c @@ -784,14 +784,10 @@ bail: 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;