[Qemu-devel] [PATCH v5 02/11] block/dirty-bitmap: remove assertion from restore

John Snow posted 11 patches 6 years, 10 months ago
There is a newer version of this series
[Qemu-devel] [PATCH v5 02/11] block/dirty-bitmap: remove assertion from restore
Posted by John Snow 6 years, 10 months ago
When making a backup of a dirty bitmap (for transactions), we want to
restore that backup whether or not the bitmap is enabled or not.

It is perfectly valid to write into bitmaps that are disabled. It is
only illegitimate for the guest to have done so.

Remove this assertion.

Signed-off-by: John Snow <jsnow@redhat.com>
---
 block/dirty-bitmap.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c
index 89fd1d7f8b..6b688394e4 100644
--- a/block/dirty-bitmap.c
+++ b/block/dirty-bitmap.c
@@ -625,7 +625,6 @@ void bdrv_clear_dirty_bitmap(BdrvDirtyBitmap *bitmap, HBitmap **out)
 void bdrv_restore_dirty_bitmap(BdrvDirtyBitmap *bitmap, HBitmap *backup)
 {
     HBitmap *tmp = bitmap->bitmap;
-    assert(bdrv_dirty_bitmap_enabled(bitmap));
     assert(!bdrv_dirty_bitmap_readonly(bitmap));
     bitmap->bitmap = backup;
     hbitmap_free(tmp);
-- 
2.17.2


Re: [Qemu-devel] [PATCH v5 02/11] block/dirty-bitmap: remove assertion from restore
Posted by Eric Blake 6 years, 10 months ago
On 12/19/18 8:29 PM, John Snow wrote:
> When making a backup of a dirty bitmap (for transactions), we want to
> restore that backup whether or not the bitmap is enabled or not.

drop one of the two 'or not'

> 
> It is perfectly valid to write into bitmaps that are disabled. It is
> only illegitimate for the guest to have done so.
> 
> Remove this assertion.
> 
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
>   block/dirty-bitmap.c | 1 -
>   1 file changed, 1 deletion(-)

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Re: [Qemu-devel] [PATCH v5 02/11] block/dirty-bitmap: remove assertion from restore
Posted by Vladimir Sementsov-Ogievskiy 6 years, 10 months ago
20.12.2018 5:29, John Snow wrote:
> When making a backup of a dirty bitmap (for transactions), we want to
> restore that backup whether or not the bitmap is enabled or not.
> 
> It is perfectly valid to write into bitmaps that are disabled. It is
> only illegitimate for the guest to have done so.
> 
> Remove this assertion.
> 
> Signed-off-by: John Snow <jsnow@redhat.com>

Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>

> ---
>   block/dirty-bitmap.c | 1 -
>   1 file changed, 1 deletion(-)
> 
> diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c
> index 89fd1d7f8b..6b688394e4 100644
> --- a/block/dirty-bitmap.c
> +++ b/block/dirty-bitmap.c
> @@ -625,7 +625,6 @@ void bdrv_clear_dirty_bitmap(BdrvDirtyBitmap *bitmap, HBitmap **out)
>   void bdrv_restore_dirty_bitmap(BdrvDirtyBitmap *bitmap, HBitmap *backup)
>   {
>       HBitmap *tmp = bitmap->bitmap;
> -    assert(bdrv_dirty_bitmap_enabled(bitmap));
>       assert(!bdrv_dirty_bitmap_readonly(bitmap));
>       bitmap->bitmap = backup;
>       hbitmap_free(tmp);
> 


-- 
Best regards,
Vladimir