[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 5/6] save_block_hdr: we can recalculate the cont
From: |
Li, Liang Z |
Subject: |
Re: [Qemu-devel] [PATCH 5/6] save_block_hdr: we can recalculate the cont parameter here |
Date: |
Thu, 26 Feb 2015 04:49:42 +0000 |
> -----Original Message-----
> From: Juan Quintela [mailto:address@hidden
> Sent: Friday, February 13, 2015 6:03 AM
> To: address@hidden
> Cc: Li, Liang Z
> Subject: [PATCH 5/6] save_block_hdr: we can recalculate the cont parameter
> here
>
> No need to pass it through all the callers. Once there, update
> last_sent_block here.
>
> Signed-off-by: Juan Quintela <address@hidden>
> ---
> arch_init.c | 47 ++++++++++++++++++++++++-----------------------
> 1 file changed, 24 insertions(+), 23 deletions(-)
>
> diff --git a/arch_init.c b/arch_init.c
> index 834f40c..95a61e2 100644
> --- a/arch_init.c
> +++ b/arch_init.c
> @@ -304,34 +304,39 @@ uint64_t xbzrle_mig_pages_overflow(void)
> return acct_info.xbzrle_overflows;
> }
>
> +/* This is the last block that we have visited serching for dirty pages
> +*/ static RAMBlock *last_seen_block;
> +/* This is the last block from where we have sent data */ static
> +RAMBlock *last_sent_block; static ram_addr_t last_offset; static
> +unsigned long *migration_bitmap; static uint64_t migration_dirty_pages;
> +static uint32_t last_version; static bool ram_bulk_stage;
> +
> static size_t save_block_hdr(QEMUFile *f, RAMBlock *block, ram_addr_t
> offset,
> - int cont, int flag)
> + int flag)
> {
> size_t size;
>
> - qemu_put_be64(f, offset | cont | flag);
> + if (block == last_sent_block) {
> + offset |= RAM_SAVE_FLAG_CONTINUE;
> + }
> +
> + qemu_put_be64(f, offset | flag);
> size = 8;
>
> - if (!cont) {
> + if (block != last_sent_block) {
> 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;
> }
If save_block_hdr function is changed to this, then in my patch, it can't not
be directly reused in
compression thread. A lock is needed to access last_sent_block. I prefer the
original implementation.
Liang
- [Qemu-devel] [PATCH 0/6] migration: differentiate between pages and bytes, Juan Quintela, 2015/02/12
- [Qemu-devel] [PATCH 1/6] ram: make all save_page functions take a uint64_t parameter, Juan Quintela, 2015/02/12
- [Qemu-devel] [PATCH 2/6] ram_find_and_save_block: change calling convention, Juan Quintela, 2015/02/12
- [Qemu-devel] [PATCH 5/6] save_block_hdr: we can recalculate the cont parameter here, Juan Quintela, 2015/02/12
- Re: [Qemu-devel] [PATCH 5/6] save_block_hdr: we can recalculate the cont parameter here,
Li, Liang Z <=
- [Qemu-devel] [PATCH 6/6] rename save_block_hdr to save_page_header, Juan Quintela, 2015/02/12
- [Qemu-devel] [PATCH 3/6] ram_save_page: change calling covention, Juan Quintela, 2015/02/12
- [Qemu-devel] [PATCH 4/6] save_xbzrle_page: change calling convention, Juan Quintela, 2015/02/12
- Re: [Qemu-devel] [PATCH 0/6] migration: differentiate between pages and bytes, Li, Liang Z, 2015/02/12
- Re: [Qemu-devel] [PATCH 0/6] migration: differentiate between pages and bytes, Dr. David Alan Gilbert, 2015/02/17