qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 6/7] migration/block-dirty-bitmap: add_bitmaps_to_list: ch


From: Eric Blake
Subject: Re: [PATCH v3 6/7] migration/block-dirty-bitmap: add_bitmaps_to_list: check disk name once
Date: Thu, 21 May 2020 16:09:36 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0

On 5/15/20 7:40 AM, Vladimir Sementsov-Ogievskiy wrote:
Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Reviewed-by: Andrey Shinkevich <address@hidden>
---
  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 <address@hidden>

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org




reply via email to

[Prev in Thread] Current Thread [Next in Thread]