lkml.org 
[lkml]   [2011]   [Jun]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH resend 5/6] reiserfs: use hweight_long()
    Date
    Use hweight_long() to count free bits in the bitmap.

    Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
    Cc: reiserfs-devel@vger.kernel.org
    ---
    fs/reiserfs/bitmap.c | 6 +-----
    1 files changed, 1 insertions(+), 5 deletions(-)

    diff --git a/fs/reiserfs/bitmap.c b/fs/reiserfs/bitmap.c
    index 567385a..d1aca1d 100644
    --- a/fs/reiserfs/bitmap.c
    +++ b/fs/reiserfs/bitmap.c
    @@ -1222,15 +1222,11 @@ void reiserfs_cache_bitmap_metadata(struct super_block *sb,
    info->free_count = 0;

    while (--cur >= (unsigned long *)bh->b_data) {
    - int i;
    -
    /* 0 and ~0 are special, we can optimize for them */
    if (*cur == 0)
    info->free_count += BITS_PER_LONG;
    else if (*cur != ~0L) /* A mix, investigate */
    - for (i = BITS_PER_LONG - 1; i >= 0; i--)
    - if (!reiserfs_test_le_bit(i, cur))
    - info->free_count++;
    + info->free_count += BITS_PER_LONG - hweight_long(*cur);
    }
    }

    --
    1.7.4.4


    \
     
     \ /
      Last update: 2011-06-26 07:59    [W:2.419 / U:0.404 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site