|
@@ -53,7 +53,9 @@
|
|
*/
|
|
*/
|
|
|
|
|
|
struct HBitmap {
|
|
struct HBitmap {
|
|
- /* Size of the bitmap, as requested in hbitmap_alloc. */
|
|
|
|
|
|
+ /*
|
|
|
|
+ * Size of the bitmap, as requested in hbitmap_alloc or in hbitmap_truncate.
|
|
|
|
+ */
|
|
uint64_t orig_size;
|
|
uint64_t orig_size;
|
|
|
|
|
|
/* Number of total bits in the bottom level. */
|
|
/* Number of total bits in the bottom level. */
|
|
@@ -732,6 +734,8 @@ void hbitmap_truncate(HBitmap *hb, uint64_t size)
|
|
uint64_t num_elements = size;
|
|
uint64_t num_elements = size;
|
|
uint64_t old;
|
|
uint64_t old;
|
|
|
|
|
|
|
|
+ hb->orig_size = size;
|
|
|
|
+
|
|
/* Size comes in as logical elements, adjust for granularity. */
|
|
/* Size comes in as logical elements, adjust for granularity. */
|
|
size = (size + (1ULL << hb->granularity) - 1) >> hb->granularity;
|
|
size = (size + (1ULL << hb->granularity) - 1) >> hb->granularity;
|
|
assert(size <= ((uint64_t)1 << HBITMAP_LOG_MAX_SIZE));
|
|
assert(size <= ((uint64_t)1 << HBITMAP_LOG_MAX_SIZE));
|