WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH 1 of 3 V3] tools/libxc: Remus Checkpoint Compress

To: rshriram@xxxxxxxxx
Subject: Re: [Xen-devel] [PATCH 1 of 3 V3] tools/libxc: Remus Checkpoint Compression
From: George Dunlap <George.Dunlap@xxxxxxxxxxxxx>
Date: Wed, 19 Oct 2011 10:53:24 +0100
Cc: brendan@xxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxx, ian.jackson@xxxxxxxxxxxxx
Delivery-date: Wed, 19 Oct 2011 02:54:04 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=PgFb+YDmF/XrG0wAdrHhz6F621J8yartuce+aMtQSf8=; b=qEJkXcaY1gXoVWaIOpUiCmolH2wH76zM9652ioOguuTVVAfo2VVSZgezLaWwiqh4Lf 9aBMCk1ffPKDxyxe5iiM14al4ssSEisBDbnk8ZpK7uOTlYny0F4AKN9pcvb9fb8o9oqH Pg/dfnaxa5urWTK+Y62bGutBp/RwcqIcj4NHc=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <47fdd52af616131142ac.1318549672@xxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <patchbomb.1318549671@xxxxxxxxxxxxxxxxxxx> <47fdd52af616131142ac.1318549672@xxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Fri, Oct 14, 2011 at 12:47 AM,  <rshriram@xxxxxxxxx> wrote:

> diff -r 4b0907c6a08c -r 47fdd52af616 tools/libxc/xc_domain_save.c
> --- a/tools/libxc/xc_domain_save.c      Tue Oct 11 12:02:58 2011 +0100
> +++ b/tools/libxc/xc_domain_save.c      Thu Oct 13 15:36:53 2011 -0700
> @@ -218,6 +218,56 @@
>         return noncached_write(xch, ob, fd, buf, len);
>  }
>
> +static int write_compressed(xc_interface *xch, comp_ctx *compress_ctx,
> +                            int dobuf, struct outbuf* ob, int fd)
> +{
> +    int rc = 0;
> +    int header = sizeof(int) + sizeof(unsigned long);
> +    int marker = XC_SAVE_ID_COMPRESSED_DATA;
> +    unsigned long compbuf_len = 0;
> +
> +    do
> +    {
> +        /* check for available space (atleast 8k) */
> +        if ((ob->pos + header + XC_PAGE_SIZE * 2) > ob->size)
> +        {
> +            if (outbuf_flush(xch, ob, fd) < 0)
> +            {
> +                ERROR("Error when flushing outbuf intermediate");
> +                return -1;
> +            }
> +        }
> +
> +        rc = xc_compression_compress_pages(xch, compress_ctx,
> +                                           ob->buf + ob->pos + header,
> +                                           ob->size - ob->pos - header,
> +                                           &compbuf_len);
> +        if (!rc)
> +            return 0;
> +
> +        if (outbuf_hardwrite(xch, ob, fd, &marker, sizeof(marker)) < 0)
> +        {
> +            PERROR("Error when writing marker (errno %d)", errno);
> +            return -1;
> +        }
> +
> +        if (outbuf_hardwrite(xch, ob, fd, &compbuf_len, sizeof(compbuf_len)) 
> < 0)
> +        {
> +            PERROR("Error when writing compbuf_len (errno %d)", errno);
> +            return -1;
> +        }
> +
> +        ob->pos += (size_t) compbuf_len;
> +        if (!dobuf && outbuf_flush(xch, ob, fd) < 0)
> +        {
> +            ERROR("Error when writing compressed chunk");
> +            return -1;
> +        }
> +    } while (rc != 0);
> +
> +    return 0;
> +}
> +
>  struct time_stats {
>     struct timeval wall;
>     long long d0_cpu, d1_cpu;
> @@ -815,11 +865,19 @@
>
>     unsigned long mfn;
>
> -    struct outbuf ob;
> +    struct outbuf ob_pagebuf, ob_tailbuf, *ob = NULL;

I think you need a comment here explaining what each of these are for.

Other than that, looks fine.

 -George

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel