From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59766) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLa7k-0003ru-8K for qemu-devel@nongnu.org; Wed, 11 Feb 2015 11:26:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YLa7g-00041r-8t for qemu-devel@nongnu.org; Wed, 11 Feb 2015 11:26:48 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44887) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLa7g-00041h-0R for qemu-devel@nongnu.org; Wed, 11 Feb 2015 11:26:44 -0500 Message-ID: <54DB82C0.10104@redhat.com> Date: Wed, 11 Feb 2015 11:26:40 -0500 From: Max Reitz MIME-Version: 1.0 References: <1423532117-14490-1-git-send-email-jsnow@redhat.com> <1423532117-14490-6-git-send-email-jsnow@redhat.com> In-Reply-To: <1423532117-14490-6-git-send-email-jsnow@redhat.com> Content-Type: text/plain; charset=iso-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v12 05/17] qmp: Add block-dirty-bitmap-enable and block-dirty-bitmap-disable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: John Snow , qemu-devel@nongnu.org Cc: kwolf@redhat.com, famz@redhat.com, armbru@redhat.com, vsementsov@parallels.com, stefanha@redhat.com On 2015-02-09 at 20:35, John Snow wrote: > This allows to put the dirty bitmap into a disabled state where it is > read only. A disabled bitmap will ignore any attempts to set or reset > any of its bits, but can otherwise be renamed, deleted, or re-enabled. > > It will be used before backup or writing to persistent file. > > Signed-off-by: Fam Zheng > Signed-off-by: John Snow > --- > block.c | 25 +++++++++++++++++++++++++ > blockdev.c | 40 ++++++++++++++++++++++++++++++++++++++++ > include/block/block.h | 3 +++ > qapi/block-core.json | 28 ++++++++++++++++++++++++++++ > qmp-commands.hx | 10 ++++++++++ > 5 files changed, 106 insertions(+) > > diff --git a/block.c b/block.c > index 83f411f..8d63375 100644 > --- a/block.c > +++ b/block.c > @@ -54,6 +54,7 @@ > struct BdrvDirtyBitmap { > HBitmap *bitmap; > char *name; > + bool disabled; > QLIST_ENTRY(BdrvDirtyBitmap) list; > }; > > @@ -5412,10 +5413,16 @@ BdrvDirtyBitmap *bdrv_create_dirty_bitmap(BlockDriverState *bs, > bitmap = g_new0(BdrvDirtyBitmap, 1); > bitmap->bitmap = hbitmap_alloc(bitmap_size, ffs(sector_granularity) - 1); > bitmap->name = g_strdup(name); > + bitmap->disabled = false; Unnecessary thanks to the g_new0(), but won't hurt. Reviewed-by: Max Reitz