[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC PATCH 07/17] COLO buffer: implement colo buffer as
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [RFC PATCH 07/17] COLO buffer: implement colo buffer as well as QEMUFileOps based on it |
Date: |
Wed, 23 Jul 2014 12:24:51 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 |
On 07/23/2014 08:25 AM, Yang Hongyang wrote:
> We need a buffer to store migration data.
>
> On save side:
> all saved data was write into colo buffer first, so that we can know
s/was write/is written/
> the total size of the migration data. this can also separate the data
> transmission from colo control data, we use colo control data over
> socket fd to synchronous both side's stat.
>
> On restore side:
> all migration data was read into colo buffer first, then load data
> from the buffer: If network error happens while data transmission,
s/while/during/
> the slaver can still functinal because the migration data are not yet
s/slaver/slave/
s/functinal/function/
s/are/is/
> loaded.
>
> Signed-off-by: Yang Hongyang <address@hidden>
> ---
> migration-colo.c | 112
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 112 insertions(+)
>
> +/* colo buffer */
> +
> +#define COLO_BUFFER_BASE_SIZE (1000*1000*4ULL)
> +#define COLO_BUFFER_MAX_SIZE (1000*1000*1000*10ULL)
Spaces around binary operators.
> +
> +typedef struct colo_buffer {
For consistency with the rest of the code base, name this ColoBuffer,
not colo_buffer.
> + uint8_t *data;
> + uint64_t used;
> + uint64_t freed;
> + uint64_t size;
> +} colo_buffer_t;
HACKING says to NOT name types with a trailing _t. Just name the
typedef ColoBuffer.
> +static void colo_buffer_destroy(void)
> +{
> + if (colo_buffer.data) {
> + g_free(colo_buffer.data);
> + colo_buffer.data = NULL;
g_free(NULL) behaves sanely, just make these two lines unconditional.
> +static void colo_buffer_extend(uint64_t len)
> +{
> + if (len > colo_buffer.size - colo_buffer.used) {
> + len = len + colo_buffer.used - colo_buffer.size;
> + len = ROUND_UP(len, COLO_BUFFER_BASE_SIZE) + COLO_BUFFER_BASE_SIZE;
> +
> + colo_buffer.size += len;
> + if (colo_buffer.size > COLO_BUFFER_MAX_SIZE) {
> + error_report("colo_buffer overflow!\n");
No trailing \n in error_report().
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [RFC PATCH 00/17] COarse-grain LOck-stepping(COLO) Virtual Machines for Non-stop Service, Yang Hongyang, 2014/07/23
- [Qemu-devel] [RFC PATCH 01/17] configure: add CONFIG_COLO to switch COLO support, Yang Hongyang, 2014/07/23
- [Qemu-devel] [RFC PATCH 03/17] COLO migration: add a migration capability 'colo', Yang Hongyang, 2014/07/23
- [Qemu-devel] [RFC PATCH 04/17] COLO info: use colo info to tell migration target colo is enabled, Yang Hongyang, 2014/07/23
- [Qemu-devel] [RFC PATCH 05/17] COLO save: integrate COLO checkpointed save into qemu migration, Yang Hongyang, 2014/07/23
- [Qemu-devel] [RFC PATCH 06/17] COLO restore: integrate COLO checkpointed restore into qemu restore, Yang Hongyang, 2014/07/23
- [Qemu-devel] [RFC PATCH 08/17] COLO: disable qdev hotplug, Yang Hongyang, 2014/07/23
- [Qemu-devel] [RFC PATCH 07/17] COLO buffer: implement colo buffer as well as QEMUFileOps based on it, Yang Hongyang, 2014/07/23
- Re: [Qemu-devel] [RFC PATCH 07/17] COLO buffer: implement colo buffer as well as QEMUFileOps based on it,
Eric Blake <=
- [Qemu-devel] [RFC PATCH 09/17] COLO ctl: implement API's that communicate with colo agent, Yang Hongyang, 2014/07/23
- [Qemu-devel] [RFC PATCH 10/17] COLO ctl: introduce is_slave() and is_master(), Yang Hongyang, 2014/07/23
- [Qemu-devel] [RFC PATCH 02/17] COLO: introduce an api colo_supported() to indicate COLO support, Yang Hongyang, 2014/07/23
- [Qemu-devel] [RFC PATCH 12/17] COLO ctl: add a RunState RUN_STATE_COLO, Yang Hongyang, 2014/07/23
- [Qemu-devel] [RFC PATCH 11/17] COLO ctl: implement colo checkpoint protocol, Yang Hongyang, 2014/07/23
- [Qemu-devel] [RFC PATCH 13/17] COLO ctl: implement colo save, Yang Hongyang, 2014/07/23
- [Qemu-devel] [RFC PATCH 14/17] COLO ctl: implement colo restore, Yang Hongyang, 2014/07/23
- [Qemu-devel] [RFC PATCH 15/17] COLO save: reuse migration bitmap under colo checkpoint, Yang Hongyang, 2014/07/23