From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:41434) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SfBSC-0001TK-0U for qemu-devel@nongnu.org; Thu, 14 Jun 2012 10:55:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SfBS7-00032W-93 for qemu-devel@nongnu.org; Thu, 14 Jun 2012 10:55:19 -0400 Received: from mail-wg0-f53.google.com ([74.125.82.53]:40729) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SfBS7-000323-09 for qemu-devel@nongnu.org; Thu, 14 Jun 2012 10:55:15 -0400 Received: by wgbfm10 with SMTP id fm10so1667317wgb.10 for ; Thu, 14 Jun 2012 07:55:13 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Thu, 14 Jun 2012 16:55:01 +0200 Message-Id: <1339685702-10176-2-git-send-email-pbonzini@redhat.com> In-Reply-To: <1339685702-10176-1-git-send-email-pbonzini@redhat.com> References: <1339685702-10176-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 1/2] block: copy over job and dirty bitmap fields in bdrv_append List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, jcody@redhat.com While these should not be in use at the time a transaction is started, a command in the prepare phase of a transaction might have added them, so they need to be brought over. Signed-off-by: Paolo Bonzini --- block.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/block.c b/block.c index 0acdcac..702821d 100644 --- a/block.c +++ b/block.c @@ -1027,6 +1027,16 @@ void bdrv_append(BlockDriverState *bs_new, BlockDriverState *bs_top) tmp.iostatus_enabled = bs_top->iostatus_enabled; tmp.iostatus = bs_top->iostatus; + /* dirty bitmap */ + tmp.dirty_count = bs_top->dirty_count; + tmp.dirty_bitmap = bs_top->dirty_bitmap; + assert(bs_new->dirty_bitmap == NULL); + + /* job */ + tmp.in_use = bs_top->in_use; + tmp.job = bs_top->job; + assert(bs_new->job == NULL); + /* keep the same entry in bdrv_states */ pstrcpy(tmp.device_name, sizeof(tmp.device_name), bs_top->device_name); tmp.list = bs_top->list; @@ -1051,6 +1061,11 @@ void bdrv_append(BlockDriverState *bs_new, BlockDriverState *bs_top) /* clear the copied fields in the new backing file */ bdrv_detach_dev(bs_new, bs_new->dev); + bs_new->job = NULL; + bs_new->in_use = 0; + bs_new->dirty_bitmap = NULL; + bs_new->dirty_count = 0; + qemu_co_queue_init(&bs_new->throttled_reqs); memset(&bs_new->io_base, 0, sizeof(bs_new->io_base)); memset(&bs_new->io_limits, 0, sizeof(bs_new->io_limits)); -- 1.7.10.2