[Top][All Lists]

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

Re: [Qemu-devel] [PATCH 1/2] drity-bitmap: refactor merge: separte can_m

From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 1/2] drity-bitmap: refactor merge: separte can_merge
Date: Thu, 5 Jul 2018 13:55:27 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0

On 07/05/2018 01:51 PM, John Snow wrote:

-    assert(!bdrv_dirty_bitmap_readonly(dest));
-    if (!hbitmap_merge(dest->bitmap, src->bitmap)) {
-        error_setg(errp, "Bitmaps are incompatible and can't be merged");
+    if (bdrv_can_merge_dirty_bitmap(dest, src, errp)) {
+        bool ret = hbitmap_merge(dest->bitmap, src->bitmap);
+        assert(ret);

Might as well just assert(hbitmap_merge(...));

Except that side effects inside assert() are bad programming practice, even if in qemu assert()s are guaranteed to always be enabled by osdep.h.

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

reply via email to

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