render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
c1c534
From 95cade1ca8bbf611fe14a80bd4cdd821c246ff74 Mon Sep 17 00:00:00 2001
c1c534
Message-Id: <95cade1ca8bbf611fe14a80bd4cdd821c246ff74@dist-git>
c1c534
From: Peter Krempa <pkrempa@redhat.com>
c1c534
Date: Mon, 5 Feb 2018 17:57:36 +0100
c1c534
Subject: [PATCH] util: bitmap: Fix value of 'map_alloc' when shrinking bitmap
c1c534
c1c534
The virBitmap code uses VIR_RESIZE_N to do quadratic scaling, which
c1c534
means that along with the number of requested map elements we also need
c1c534
to keep the number of actually allocated elements for the scaling
c1c534
algorithm to work properly.
c1c534
c1c534
The shrinking code did not fix 'map_alloc' thus virResizeN might
c1c534
actually not expand the bitmap properly after called on a previously
c1c534
shrunk bitmap.
c1c534
c1c534
(cherry picked from commit bf924e8e1be03982b0006e05b4faa3a645a45578)
c1c534
c1c534
https://bugzilla.redhat.com/show_bug.cgi?id=1540817
c1c534
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
c1c534
---
c1c534
 src/util/virbitmap.c | 1 +
c1c534
 1 file changed, 1 insertion(+)
c1c534
c1c534
diff --git a/src/util/virbitmap.c b/src/util/virbitmap.c
c1c534
index 33cae2f305..36ecc95deb 100644
c1c534
--- a/src/util/virbitmap.c
c1c534
+++ b/src/util/virbitmap.c
c1c534
@@ -1231,5 +1231,6 @@ virBitmapShrink(virBitmapPtr map,
c1c534
         return -1;
c1c534
 
c1c534
     map->map_len = nl;
c1c534
+    map->map_alloc = nl;
c1c534
     return 0;
c1c534
 }
c1c534
-- 
c1c534
2.16.1
c1c534