lkml.org 
[lkml]   [2012]   [Jun]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 02/10] minixfs: use memweight()
On Sat 02-06-12 22:40:08, Akinobu Mita wrote:
> Use memweight() to count the total number of bits clear in memory area.
>
> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
> Cc: linux-fsdevel@vger.kernel.org
> ---
>
> No changes from v1
>
> fs/minix/bitmap.c | 6 ++----
> 1 files changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/fs/minix/bitmap.c b/fs/minix/bitmap.c
> index 4bc50da..564f1a5 100644
> --- a/fs/minix/bitmap.c
> +++ b/fs/minix/bitmap.c
> @@ -29,10 +29,8 @@ static __u32 count_free(struct buffer_head *map[], unsigned blocksize, __u32 num
> unsigned blocks = DIV_ROUND_UP(numbits, blocksize * 8);
>
> while (blocks--) {
> - unsigned words = blocksize / 2;
> - __u16 *p = (__u16 *)(*map++)->b_data;
> - while (words--)
> - sum += 16 - hweight16(*p++);
> + sum += blocksize * BITS_PER_BYTE -
> + memweight((*map++)->b_data, blocksize);
Hmm, just using bitmap_weight() should be fine here as well AFAICS...

Honza
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR


\
 
 \ /
  Last update: 2012-06-04 13:02    [W:0.229 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site