aboutsummaryrefslogtreecommitdiff
path: root/blockdev.c
diff options
context:
space:
mode:
Diffstat (limited to 'blockdev.c')
-rw-r--r--blockdev.c27
1 files changed, 7 insertions, 20 deletions
diff --git a/blockdev.c b/blockdev.c
index a45458a60a..7e12919724 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -2898,16 +2898,10 @@ void qmp_block_dirty_bitmap_add(const char *node, const char *name,
disabled = false;
}
- if (persistent) {
- AioContext *aio_context = bdrv_get_aio_context(bs);
- bool ok;
-
- aio_context_acquire(aio_context);
- ok = bdrv_can_store_new_dirty_bitmap(bs, name, granularity, errp);
- aio_context_release(aio_context);
- if (!ok) {
- return;
- }
+ if (persistent &&
+ !bdrv_can_store_new_dirty_bitmap(bs, name, granularity, errp))
+ {
+ return;
}
bitmap = bdrv_create_dirty_bitmap(bs, granularity, name, errp);
@@ -2939,17 +2933,10 @@ static BdrvDirtyBitmap *do_block_dirty_bitmap_remove(
return NULL;
}
- if (bdrv_dirty_bitmap_get_persistence(bitmap)) {
- int ret;
- AioContext *aio_context = bdrv_get_aio_context(bs);
-
- aio_context_acquire(aio_context);
- ret = bdrv_remove_persistent_dirty_bitmap(bs, name, errp);
- aio_context_release(aio_context);
-
- if (ret < 0) {
+ if (bdrv_dirty_bitmap_get_persistence(bitmap) &&
+ bdrv_remove_persistent_dirty_bitmap(bs, name, errp) < 0)
+ {
return NULL;
- }
}
if (release) {