|
|
7711c0 |
From 7bcc4bb06fb8455874578fe3ad722600081e8d1c Mon Sep 17 00:00:00 2001
|
|
|
7711c0 |
From: John Snow <jsnow@redhat.com>
|
|
|
7711c0 |
Date: Wed, 3 Apr 2019 18:18:42 +0200
|
|
|
7711c0 |
Subject: [PATCH 137/163] block/dirty-bitmap: change semantics of enabled
|
|
|
7711c0 |
predicate
|
|
|
7711c0 |
|
|
|
7711c0 |
RH-Author: John Snow <jsnow@redhat.com>
|
|
|
7711c0 |
Message-id: <20190403181857.9693-7-jsnow@redhat.com>
|
|
|
7711c0 |
Patchwork-id: 85427
|
|
|
7711c0 |
O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH 06/21] block/dirty-bitmap: change semantics of enabled predicate
|
|
|
7711c0 |
Bugzilla: 1677073
|
|
|
7711c0 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
7711c0 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
7711c0 |
RH-Acked-by: Sergio Lopez Pascual <slp@redhat.com>
|
|
|
7711c0 |
|
|
|
7711c0 |
Currently, the enabled predicate means something like:
|
|
|
7711c0 |
"the QAPI status of the bitmap is ACTIVE."
|
|
|
7711c0 |
After this patch, it should mean exclusively:
|
|
|
7711c0 |
"This bitmap is recording guest writes, and is allowed to do so."
|
|
|
7711c0 |
|
|
|
7711c0 |
In many places, this is how this predicate was already used.
|
|
|
7711c0 |
Internal usages of the bitmap QPI can call user_locked to find out if
|
|
|
7711c0 |
the bitmap is in use by an operation.
|
|
|
7711c0 |
|
|
|
7711c0 |
To accommodate this, modify the create_successor routine to now
|
|
|
7711c0 |
explicitly disable the parent bitmap at creation time.
|
|
|
7711c0 |
|
|
|
7711c0 |
Justifications:
|
|
|
7711c0 |
|
|
|
7711c0 |
1. bdrv_dirty_bitmap_status suffers no change from the lack of
|
|
|
7711c0 |
1:1 parity with the new predicates because of the order in which
|
|
|
7711c0 |
the predicates are checked. This is now only for compatibility.
|
|
|
7711c0 |
|
|
|
7711c0 |
2. bdrv_set_dirty() is unchanged: pre-patch, it was skipping bitmaps that were
|
|
|
7711c0 |
disabled or had a successor, while post-patch it is only skipping bitmaps
|
|
|
7711c0 |
that are disabled. To accommodate this, create_successor now ensures that
|
|
|
7711c0 |
any bitmap with a successor is explicitly disabled.
|
|
|
7711c0 |
|
|
|
7711c0 |
3. qcow2_store_persistent_dirty_bitmaps: No functional change. This function
|
|
|
7711c0 |
cares only about the literal enabled bit, and makes no effort to check if
|
|
|
7711c0 |
the bitmap is in-use or not. After this patch there are still no ways to
|
|
|
7711c0 |
produce an enabled bitmap with a successor.
|
|
|
7711c0 |
|
|
|
7711c0 |
4. block_dirty_bitmap_enable_prepare
|
|
|
7711c0 |
block_dirty_bitmap_disable_prepare
|
|
|
7711c0 |
init_dirty_bitmap_migration
|
|
|
7711c0 |
nbd_export_new
|
|
|
7711c0 |
|
|
|
7711c0 |
These functions care about the literal enabled bit,
|
|
|
7711c0 |
and already check user_locked separately.
|
|
|
7711c0 |
|
|
|
7711c0 |
Signed-off-by: John Snow <jsnow@redhat.com>
|
|
|
7711c0 |
Reviewed-by: Eric Blake <eblake@redhat.com>
|
|
|
7711c0 |
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
|
|
7711c0 |
Message-id: 20190223000614.13894-5-jsnow@redhat.com
|
|
|
7711c0 |
Signed-off-by: John Snow <jsnow@redhat.com>
|
|
|
7711c0 |
(cherry picked from commit 8b2e20f64f25a5bf9a7cd45b4babdf2d7416f7ad)
|
|
|
7711c0 |
Signed-off-by: John Snow <jsnow@redhat.com>
|
|
|
7711c0 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
7711c0 |
---
|
|
|
7711c0 |
block/dirty-bitmap.c | 9 +++++++--
|
|
|
7711c0 |
1 file changed, 7 insertions(+), 2 deletions(-)
|
|
|
7711c0 |
|
|
|
7711c0 |
diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c
|
|
|
7711c0 |
index 7dc5b55..fa411f9 100644
|
|
|
7711c0 |
--- a/block/dirty-bitmap.c
|
|
|
7711c0 |
+++ b/block/dirty-bitmap.c
|
|
|
7711c0 |
@@ -209,7 +209,7 @@ bool bdrv_dirty_bitmap_qmp_locked(BdrvDirtyBitmap *bitmap)
|
|
|
7711c0 |
/* Called with BQL taken. */
|
|
|
7711c0 |
bool bdrv_dirty_bitmap_enabled(BdrvDirtyBitmap *bitmap)
|
|
|
7711c0 |
{
|
|
|
7711c0 |
- return !(bitmap->disabled || bitmap->successor);
|
|
|
7711c0 |
+ return !bitmap->disabled;
|
|
|
7711c0 |
}
|
|
|
7711c0 |
|
|
|
7711c0 |
/* Called with BQL taken. */
|
|
|
7711c0 |
@@ -236,6 +236,7 @@ static bool bdrv_dirty_bitmap_recording(BdrvDirtyBitmap *bitmap)
|
|
|
7711c0 |
/**
|
|
|
7711c0 |
* Create a successor bitmap destined to replace this bitmap after an operation.
|
|
|
7711c0 |
* Requires that the bitmap is not user_locked and has no successor.
|
|
|
7711c0 |
+ * The successor will be enabled if the parent bitmap was.
|
|
|
7711c0 |
* Called with BQL taken.
|
|
|
7711c0 |
*/
|
|
|
7711c0 |
int bdrv_dirty_bitmap_create_successor(BlockDriverState *bs,
|
|
|
7711c0 |
@@ -264,6 +265,7 @@ int bdrv_dirty_bitmap_create_successor(BlockDriverState *bs,
|
|
|
7711c0 |
|
|
|
7711c0 |
/* Successor will be on or off based on our current state. */
|
|
|
7711c0 |
child->disabled = bitmap->disabled;
|
|
|
7711c0 |
+ bitmap->disabled = true;
|
|
|
7711c0 |
|
|
|
7711c0 |
/* Install the successor and freeze the parent */
|
|
|
7711c0 |
bitmap->successor = child;
|
|
|
7711c0 |
@@ -329,7 +331,8 @@ BdrvDirtyBitmap *bdrv_dirty_bitmap_abdicate(BlockDriverState *bs,
|
|
|
7711c0 |
/**
|
|
|
7711c0 |
* In cases of failure where we can no longer safely delete the parent,
|
|
|
7711c0 |
* we may wish to re-join the parent and child/successor.
|
|
|
7711c0 |
- * The merged parent will not be user_locked, nor explicitly re-enabled.
|
|
|
7711c0 |
+ * The merged parent will not be user_locked.
|
|
|
7711c0 |
+ * The marged parent will be enabled if and only if the successor was enabled.
|
|
|
7711c0 |
* Called within bdrv_dirty_bitmap_lock..unlock and with BQL taken.
|
|
|
7711c0 |
*/
|
|
|
7711c0 |
BdrvDirtyBitmap *bdrv_reclaim_dirty_bitmap_locked(BlockDriverState *bs,
|
|
|
7711c0 |
@@ -347,6 +350,8 @@ BdrvDirtyBitmap *bdrv_reclaim_dirty_bitmap_locked(BlockDriverState *bs,
|
|
|
7711c0 |
error_setg(errp, "Merging of parent and successor bitmap failed");
|
|
|
7711c0 |
return NULL;
|
|
|
7711c0 |
}
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+ parent->disabled = successor->disabled;
|
|
|
7711c0 |
bdrv_release_dirty_bitmap_locked(successor);
|
|
|
7711c0 |
parent->successor = NULL;
|
|
|
7711c0 |
|
|
|
7711c0 |
--
|
|
|
7711c0 |
1.8.3.1
|
|
|
7711c0 |
|