[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH 16/21] hbitmap: add hbitmap_count_between() function
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
[Qemu-block] [PATCH 16/21] hbitmap: add hbitmap_count_between() function |
Date: |
Fri, 23 Dec 2016 17:28:59 +0300 |
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);
+
#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);
+}
+
/* Setting starts at the last layer and propagates up if an element
* changes.
*/
--
1.8.3.1
- [Qemu-block] [PATCH 00/21] new backup architecture, Vladimir Sementsov-Ogievskiy, 2016/12/23
- [Qemu-block] [PATCH 21/21] backup: refactor: remove backup_do_cow(), Vladimir Sementsov-Ogievskiy, 2016/12/23
- [Qemu-block] [PATCH 20/21] backup: move bitmap handling from backup_do_cow to get_work, Vladimir Sementsov-Ogievskiy, 2016/12/23
- [Qemu-block] [PATCH 01/21] backup: move from done_bitmap to copy_bitmap, Vladimir Sementsov-Ogievskiy, 2016/12/23
- [Qemu-block] [PATCH 05/21] hbitmap: improve dirty iter, Vladimir Sementsov-Ogievskiy, 2016/12/23
- [Qemu-block] [PATCH 18/21] backup: new async architecture, Vladimir Sementsov-Ogievskiy, 2016/12/23
- [Qemu-block] [PATCH 15/21] bitmap: add bitmap_count_between() function, Vladimir Sementsov-Ogievskiy, 2016/12/23
- [Qemu-block] [PATCH 17/21] backup: make all reads not serializing, Vladimir Sementsov-Ogievskiy, 2016/12/23
- [Qemu-block] [PATCH 16/21] hbitmap: add hbitmap_count_between() function,
Vladimir Sementsov-Ogievskiy <=
- [Qemu-block] [PATCH 04/21] backup: use copy_bitmap in incremental backup, Vladimir Sementsov-Ogievskiy, 2016/12/23
- [Qemu-block] [PATCH 03/21] backup: improve non-dirty bits progress processing, Vladimir Sementsov-Ogievskiy, 2016/12/23
- [Qemu-block] [PATCH 06/21] backup: rewrite top mode cluster skipping, Vladimir Sementsov-Ogievskiy, 2016/12/23
- [Qemu-block] [PATCH 02/21] backup: init copy_bitmap from sync_bitmap for incremental, Vladimir Sementsov-Ogievskiy, 2016/12/23
- [Qemu-block] [PATCH 07/21] backup: refactor: merge top/full/incremental backup code, Vladimir Sementsov-Ogievskiy, 2016/12/23
- [Qemu-block] [PATCH 14/21] block: add trace point on bdrv_close_all, Vladimir Sementsov-Ogievskiy, 2016/12/23
- [Qemu-block] [PATCH 12/21] iotests: add supported_cache_modes to main function, Vladimir Sementsov-Ogievskiy, 2016/12/23
- [Qemu-block] [PATCH 10/21] backup: refactor backup_copy_cluster(), Vladimir Sementsov-Ogievskiy, 2016/12/23
- [Qemu-block] [PATCH 09/21] backup: separate copy function, Vladimir Sementsov-Ogievskiy, 2016/12/23
- [Qemu-block] [PATCH 08/21] backup: skip unallocated clusters for full mode, Vladimir Sementsov-Ogievskiy, 2016/12/23