From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60812) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YajPv-00044l-4U for qemu-devel@nongnu.org; Wed, 25 Mar 2015 07:24:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YajPr-00052t-Tf for qemu-devel@nongnu.org; Wed, 25 Mar 2015 07:24:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54428) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YajPr-00052b-PK for qemu-devel@nongnu.org; Wed, 25 Mar 2015 07:24:07 -0400 Date: Wed, 25 Mar 2015 11:24:02 +0000 From: "Dr. David Alan Gilbert" Message-ID: <20150325112401.GD2313@work-vm> References: <1427099338-10449-1-git-send-email-liang.z.li@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1427099338-10449-1-git-send-email-liang.z.li@intel.com> Subject: Re: [Qemu-devel] [PATCH 01/15] migration: remove last_sent_block from save_page_header List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Liang Li Cc: quintela@redhat.com, qemu-devel@nongnu.org, dgilbert@redhat.com, yang.z.zhang@intel.com, quintela@redhate.com, amit.shah@redhat.com, lcapitulino@redhat.com * Liang Li (liang.z.li@intel.com) wrote: > From: Juan Quintela > > Compression code (still not on tree) want to call this funtion from > outside the migration thread, so we can't write to last_sent_block. > > Instead of reverting full patch: > > [PULL 07/11] save_block_hdr: we can recalculate > > Just revert the parts that touch last_sent_block. > > Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert > --- > arch_init.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/arch_init.c b/arch_init.c > index fcfa328..4c8fcee 100644 > --- a/arch_init.c > +++ b/arch_init.c > @@ -332,19 +332,14 @@ static size_t save_page_header(QEMUFile *f, RAMBlock *block, ram_addr_t offset) > { > size_t size; > > - if (block == last_sent_block) { > - offset |= RAM_SAVE_FLAG_CONTINUE; > - } > - > qemu_put_be64(f, offset); > size = 8; > > - if (block != last_sent_block) { > + if (!(offset & RAM_SAVE_FLAG_CONTINUE)) { > qemu_put_byte(f, strlen(block->idstr)); > qemu_put_buffer(f, (uint8_t *)block->idstr, > strlen(block->idstr)); > size += 1 + strlen(block->idstr); > - last_sent_block = block; > } > return size; > } > @@ -644,6 +639,10 @@ static int ram_save_page(QEMUFile *f, RAMBlock* block, ram_addr_t offset, > XBZRLE_cache_lock(); > > current_addr = block->offset + offset; > + > + if (block == last_sent_block) { > + offset |= RAM_SAVE_FLAG_CONTINUE; > + } > if (ret != RAM_SAVE_CONTROL_NOT_SUPP) { > if (ret != RAM_SAVE_CONTROL_DELAYED) { > if (bytes_xmit > 0) { > @@ -739,6 +738,7 @@ static int ram_find_and_save_block(QEMUFile *f, bool last_stage, > > /* if page is unmodified, continue to the next */ > if (pages > 0) { > + last_sent_block = block; > break; > } > } > -- > 1.9.1 > -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK