qemu-block
[Top][All Lists]
Advanced

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

Re: [Qemu-block] [Qemu-devel] [PATCH v1 1/1] qemu-img: add new function


From: Eric Blake
Subject: Re: [Qemu-block] [Qemu-devel] [PATCH v1 1/1] qemu-img: add new function to remove bitmap in image
Date: Tue, 11 Sep 2018 09:08:34 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0

On 9/11/18 8:56 AM, Eric Blake wrote:

+    bitmap = bdrv_find_dirty_bitmap(bs, bitmapname);
+
+    /*
+     * Dirty bitmap may not be load if the 'IN_USE' flag is set (e.g. the +     * qemu thread is corrupted and the 'IN_USE' flag is not be cleared),
+     * so the result of bdrv_find_dirty_bitmap is null. In this case,
+     * we delete bitmap in qcow2 file directly.
+    */
+    if (!bitmap) {
+        bdrv_remove_persistent_dirty_bitmap(bs, bitmapname, &local_err);
+        if (local_err != NULL) {
+            ret = -1;
+            goto out;
+        }
+    } else {
+        if (bdrv_dirty_bitmap_get_persistance(bitmap)) {
+            bdrv_remove_persistent_dirty_bitmap(bs, bitmapname, &local_err);
+            if (local_err != NULL) {
+                ret = -1;
+                goto out;
+            }
+        }
+        bdrv_release_dirty_bitmap(bs, bitmap);
+    }

Why aren't you calling bdrv_block_dirty_bitmap_remove()?  In general,

It helps if I ask my actual intended question: Why aren't you calling qmp_block_dirty_bitmap_remove()?

HMP commands that are mere wrappers around counterpart QMP commands are easier to maintain, rather than open-coding the same work in two places.


--
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]