提交 6cf495be 编写于 作者: P Peter Maydell

Merge remote-tracking branch 'remotes/jnsnow/tags/bitmaps-pull-request' into staging

Pull request

# gpg: Signature made Wed 04 Jul 2018 07:33:42 BST
# gpg:                using RSA key 7DEF8106AAFC390E
# gpg: Good signature from "John Snow (John Huston) <jsnow@redhat.com>"
# Primary key fingerprint: FAEB 9711 A12C F475 812F  18F2 88A9 064D 1835 61EB
#      Subkey fingerprint: F9B7 ABDB BCAC DF95 BE76  CBD0 7DEF 8106 AAFC 390E

* remotes/jnsnow/tags/bitmaps-pull-request:
  dirty-bitmap: fix double lock on bitmap enabling
  block/dirty-bitmap: add bdrv_enable_dirty_bitmap_locked
Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
...@@ -241,11 +241,18 @@ int bdrv_dirty_bitmap_create_successor(BlockDriverState *bs, ...@@ -241,11 +241,18 @@ int bdrv_dirty_bitmap_create_successor(BlockDriverState *bs,
return 0; return 0;
} }
void bdrv_enable_dirty_bitmap_locked(BdrvDirtyBitmap *bitmap)
{
assert(!bdrv_dirty_bitmap_frozen(bitmap));
bitmap->disabled = false;
}
/* Called with BQL taken. */ /* Called with BQL taken. */
void bdrv_dirty_bitmap_enable_successor(BdrvDirtyBitmap *bitmap) void bdrv_dirty_bitmap_enable_successor(BdrvDirtyBitmap *bitmap)
{ {
assert(bitmap->mutex == bitmap->successor->mutex);
qemu_mutex_lock(bitmap->mutex); qemu_mutex_lock(bitmap->mutex);
bdrv_enable_dirty_bitmap(bitmap->successor); bdrv_enable_dirty_bitmap_locked(bitmap->successor);
qemu_mutex_unlock(bitmap->mutex); qemu_mutex_unlock(bitmap->mutex);
} }
...@@ -424,8 +431,7 @@ void bdrv_disable_dirty_bitmap(BdrvDirtyBitmap *bitmap) ...@@ -424,8 +431,7 @@ void bdrv_disable_dirty_bitmap(BdrvDirtyBitmap *bitmap)
void bdrv_enable_dirty_bitmap(BdrvDirtyBitmap *bitmap) void bdrv_enable_dirty_bitmap(BdrvDirtyBitmap *bitmap)
{ {
bdrv_dirty_bitmap_lock(bitmap); bdrv_dirty_bitmap_lock(bitmap);
assert(!bdrv_dirty_bitmap_frozen(bitmap)); bdrv_enable_dirty_bitmap_locked(bitmap);
bitmap->disabled = false;
bdrv_dirty_bitmap_unlock(bitmap); bdrv_dirty_bitmap_unlock(bitmap);
} }
......
...@@ -32,6 +32,7 @@ void bdrv_remove_persistent_dirty_bitmap(BlockDriverState *bs, ...@@ -32,6 +32,7 @@ void bdrv_remove_persistent_dirty_bitmap(BlockDriverState *bs,
Error **errp); Error **errp);
void bdrv_disable_dirty_bitmap(BdrvDirtyBitmap *bitmap); void bdrv_disable_dirty_bitmap(BdrvDirtyBitmap *bitmap);
void bdrv_enable_dirty_bitmap(BdrvDirtyBitmap *bitmap); void bdrv_enable_dirty_bitmap(BdrvDirtyBitmap *bitmap);
void bdrv_enable_dirty_bitmap_locked(BdrvDirtyBitmap *bitmap);
BlockDirtyInfoList *bdrv_query_dirty_bitmaps(BlockDriverState *bs); BlockDirtyInfoList *bdrv_query_dirty_bitmaps(BlockDriverState *bs);
uint32_t bdrv_get_default_bitmap_granularity(BlockDriverState *bs); uint32_t bdrv_get_default_bitmap_granularity(BlockDriverState *bs);
uint32_t bdrv_dirty_bitmap_granularity(const BdrvDirtyBitmap *bitmap); uint32_t bdrv_dirty_bitmap_granularity(const BdrvDirtyBitmap *bitmap);
......
...@@ -511,7 +511,7 @@ void dirty_bitmap_mig_before_vm_start(void) ...@@ -511,7 +511,7 @@ void dirty_bitmap_mig_before_vm_start(void)
DirtyBitmapLoadBitmapState *b = item->data; DirtyBitmapLoadBitmapState *b = item->data;
if (b->migrated) { if (b->migrated) {
bdrv_enable_dirty_bitmap(b->bitmap); bdrv_enable_dirty_bitmap_locked(b->bitmap);
} else { } else {
bdrv_dirty_bitmap_enable_successor(b->bitmap); bdrv_dirty_bitmap_enable_successor(b->bitmap);
} }
...@@ -547,7 +547,7 @@ static void dirty_bitmap_load_complete(QEMUFile *f, DirtyBitmapLoadState *s) ...@@ -547,7 +547,7 @@ static void dirty_bitmap_load_complete(QEMUFile *f, DirtyBitmapLoadState *s)
if (enabled_bitmaps == NULL) { if (enabled_bitmaps == NULL) {
/* in postcopy */ /* in postcopy */
bdrv_reclaim_dirty_bitmap_locked(s->bs, s->bitmap, &error_abort); bdrv_reclaim_dirty_bitmap_locked(s->bs, s->bitmap, &error_abort);
bdrv_enable_dirty_bitmap(s->bitmap); bdrv_enable_dirty_bitmap_locked(s->bitmap);
} else { } else {
/* target not started, successor must be empty */ /* target not started, successor must be empty */
int64_t count = bdrv_get_dirty_count(s->bitmap); int64_t count = bdrv_get_dirty_count(s->bitmap);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册