[PATCH 4/6] util: bitmap: Fix value of 'map_alloc' when shrinking bitmap

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

 



The virBitmap code uses VIR_RESIZE_N to do quadratic scaling, which
means that along with the number of requested map elements we also need
to keep the number of actually allocated elements for the scaling
algorithm to work properly.

The shrinking code did not fix 'map_alloc' thus virResizeN might
actually not expand the bitmap properly after called on a previously
shrunk bitmap.
---
 src/util/virbitmap.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/util/virbitmap.c b/src/util/virbitmap.c
index 0973731e3a..d1e5a9d1ea 100644
--- a/src/util/virbitmap.c
+++ b/src/util/virbitmap.c
@@ -1317,5 +1317,6 @@ virBitmapShrink(virBitmapPtr map,
         return -1;

     map->map_len = nl;
+    map->map_alloc = nl;
     return 0;
 }
-- 
2.15.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux