On 5/15/20 7:40 AM, Vladimir Sementsov-Ogievskiy wrote:
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsement...@virtuozzo.com>
Reviewed-by: Andrey Shinkevich <andrey.shinkev...@virtuozzo.com>
---
migration/block-dirty-bitmap.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/migration/block-dirty-bitmap.c b/migration/block-dirty-bitmap.c
index 5d3a7d2b07..e0e081ce60 100644
--- a/migration/block-dirty-bitmap.c
+++ b/migration/block-dirty-bitmap.c
@@ -274,17 +274,22 @@ static int add_bitmaps_to_list(BlockDriverState *bs,
const char *bs_name)
DirtyBitmapMigBitmapState *dbms;
Error *local_err = NULL;
+ bitmap = bdrv_dirty_bitmap_first(bs);
+ if (!bitmap) {
+ return 0;
+ }
+
+ if (!bs_name || strcmp(bs_name, "") == 0) {
+ error_report("Found bitmap '%s' in unnamed node %p. It can't "
+ "be migrated", bdrv_dirty_bitmap_name(bitmap), bs);
The %p is unusual; it does not help the end user, but only a developer
with gdb access.
Maybe we could compress to:
"Bitmap '%s' in unnamed node can't be migrated"
+ return -1;
+ }
+
FOR_EACH_DIRTY_BITMAP(bs, bitmap) {
if (!bdrv_dirty_bitmap_name(bitmap)) {
continue;
}
- if (!bs_name || strcmp(bs_name, "") == 0) {
- error_report("Found bitmap '%s' in unnamed node %p. It can't "
- "be migrated", bdrv_dirty_bitmap_name(bitmap), bs);
- return -1;
- }
-
But since this is just code motion (hoisting an check outside of a loop,
for fewer executions of something that does not change within the loop),
it doesn't matter whether this patch goes in as-is or if you also tweak
the error message.
Reviewed-by: Eric Blake <ebl...@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org