yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-block-dirty-bitmap-add-bdrv_enable_dirty_bitmap_lock.patch

ae23c9
From 0f3b55a758bc4e5a4fd864d5b650557407278750 Mon Sep 17 00:00:00 2001
ae23c9
From: John Snow <jsnow@redhat.com>
ae23c9
Date: Wed, 18 Jul 2018 22:54:42 +0200
ae23c9
Subject: [PATCH 224/268] block/dirty-bitmap: add
ae23c9
 bdrv_enable_dirty_bitmap_locked
ae23c9
ae23c9
RH-Author: John Snow <jsnow@redhat.com>
ae23c9
Message-id: <20180718225511.14878-7-jsnow@redhat.com>
ae23c9
Patchwork-id: 81405
ae23c9
O-Subject: [RHEL-7.6 qemu-kvm-rhev PATCH 06/35] block/dirty-bitmap: add bdrv_enable_dirty_bitmap_locked
ae23c9
Bugzilla: 1207657
ae23c9
RH-Acked-by: Eric Blake <eblake@redhat.com>
ae23c9
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
ae23c9
RH-Acked-by: Fam Zheng <famz@redhat.com>
ae23c9
ae23c9
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
ae23c9
ae23c9
Add _locked version of bdrv_enable_dirty_bitmap, to fix dirty bitmap
ae23c9
migration in the following patch.
ae23c9
ae23c9
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
ae23c9
Message-id: 20180625165745.25259-2-vsementsov@virtuozzo.com
ae23c9
Signed-off-by: John Snow <jsnow@redhat.com>
ae23c9
(cherry picked from commit 92bcea40d3aac62853e60426bd109b748d4d1cd2)
ae23c9
Signed-off-by: John Snow <jsnow@redhat.com>
ae23c9
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
ae23c9
---
ae23c9
 block/dirty-bitmap.c         | 9 +++++++--
ae23c9
 include/block/dirty-bitmap.h | 1 +
ae23c9
 2 files changed, 8 insertions(+), 2 deletions(-)
ae23c9
ae23c9
diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c
ae23c9
index 4159d39..4d6ae8b 100644
ae23c9
--- a/block/dirty-bitmap.c
ae23c9
+++ b/block/dirty-bitmap.c
ae23c9
@@ -250,6 +250,12 @@ int bdrv_dirty_bitmap_create_successor(BlockDriverState *bs,
ae23c9
     return 0;
ae23c9
 }
ae23c9
 
ae23c9
+void bdrv_enable_dirty_bitmap_locked(BdrvDirtyBitmap *bitmap)
ae23c9
+{
ae23c9
+    assert(!bdrv_dirty_bitmap_frozen(bitmap));
ae23c9
+    bitmap->disabled = false;
ae23c9
+}
ae23c9
+
ae23c9
 /* Called with BQL taken. */
ae23c9
 void bdrv_dirty_bitmap_enable_successor(BdrvDirtyBitmap *bitmap)
ae23c9
 {
ae23c9
@@ -453,8 +459,7 @@ void bdrv_disable_dirty_bitmap(BdrvDirtyBitmap *bitmap)
ae23c9
 void bdrv_enable_dirty_bitmap(BdrvDirtyBitmap *bitmap)
ae23c9
 {
ae23c9
     bdrv_dirty_bitmap_lock(bitmap);
ae23c9
-    assert(!bdrv_dirty_bitmap_frozen(bitmap));
ae23c9
-    bitmap->disabled = false;
ae23c9
+    bdrv_enable_dirty_bitmap_locked(bitmap);
ae23c9
     bdrv_dirty_bitmap_unlock(bitmap);
ae23c9
 }
ae23c9
 
ae23c9
diff --git a/include/block/dirty-bitmap.h b/include/block/dirty-bitmap.h
ae23c9
index 1e14743..af9ba3c 100644
ae23c9
--- a/include/block/dirty-bitmap.h
ae23c9
+++ b/include/block/dirty-bitmap.h
ae23c9
@@ -33,6 +33,7 @@ void bdrv_remove_persistent_dirty_bitmap(BlockDriverState *bs,
ae23c9
                                          Error **errp);
ae23c9
 void bdrv_disable_dirty_bitmap(BdrvDirtyBitmap *bitmap);
ae23c9
 void bdrv_enable_dirty_bitmap(BdrvDirtyBitmap *bitmap);
ae23c9
+void bdrv_enable_dirty_bitmap_locked(BdrvDirtyBitmap *bitmap);
ae23c9
 BlockDirtyInfoList *bdrv_query_dirty_bitmaps(BlockDriverState *bs);
ae23c9
 uint32_t bdrv_get_default_bitmap_granularity(BlockDriverState *bs);
ae23c9
 uint32_t bdrv_dirty_bitmap_granularity(const BdrvDirtyBitmap *bitmap);
ae23c9
-- 
ae23c9
1.8.3.1
ae23c9