qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [PATCH 16/21] hbitmap: add hbitmap_count_between() func


From: Stefan Hajnoczi
Subject: Re: [Qemu-block] [PATCH 16/21] hbitmap: add hbitmap_count_between() function
Date: Tue, 31 Jan 2017 15:56:10 +0000
User-agent: Mutt/1.7.1 (2016-10-04)

On Fri, Dec 23, 2016 at 05:28:59PM +0300, Vladimir Sementsov-Ogievskiy wrote:
> Add this function only for HBitmap's with greanularity = 0.
> 
> Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
> Reviewed-by: Pavel Butsykin <address@hidden>
> ---
>  include/qemu/hbitmap.h | 2 ++
>  util/hbitmap.c         | 9 +++++++++
>  2 files changed, 11 insertions(+)
> 
> diff --git a/include/qemu/hbitmap.h b/include/qemu/hbitmap.h
> index 2873a46..1967e13 100644
> --- a/include/qemu/hbitmap.h
> +++ b/include/qemu/hbitmap.h
> @@ -314,4 +314,6 @@ static inline size_t hbitmap_iter_next_word(HBitmapIter 
> *hbi, unsigned long *p_c
>  }
>  
>  
> +uint64_t hbitmap_count_between(HBitmap *hb, uint64_t start, uint64_t end);

Missing doc comments.

> +
>  #endif
> diff --git a/util/hbitmap.c b/util/hbitmap.c
> index 48d8b2d..d06bfa3 100644
> --- a/util/hbitmap.c
> +++ b/util/hbitmap.c
> @@ -232,6 +232,15 @@ static uint64_t hb_count_between(HBitmap *hb, uint64_t 
> start, uint64_t last)
>      return count;
>  }
>  
> +/* hbitmap_count_between() is only for HBitmap's with granularity = 0 */
> +uint64_t hbitmap_count_between(HBitmap *hb, uint64_t start, uint64_t end)
> +{
> +    assert(hb->granularity == 0);
> +    assert(start < end);
> +
> +    return hb_count_between(hb, start, end - 1);
> +}

Please rename hb_count_between() and make it externally visible instead
of adding a similarly-named wrapper.

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]