[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 1 of 2] tools/libxc: Remus Checkpoint Compression
On Thu, Jun 16, 2011 at 1:57 PM, Brendan Cully <brendan@xxxxxxxxx> wrote: That code follows the same pattern as the original receive code.
Usual receive code: buf->nr_physpages += countpages; if (!buf->pages) { if (!(buf->pages = malloc(buf->nr_physpages * PAGE_SIZE))) { ERROR("Could not allocate page buffer"); return -1; } } else { if (!(ptmp = realloc(buf->pages, buf->nr_physpages * PAGE_SIZE))) { ERROR("Could not reallocate page buffer"); return -1; } buf->pages = ptmp; } if ( RDEXACT(fd, buf->pages + oldcount * PAGE_SIZE, countpages * PAGE_SIZE) ) { PERROR("Error when reading pages"); return -1; } **** The compression code: buf->compbuf_size += compbuf_size; if (!buf->pages) { if (!(buf->pages = malloc(buf->compbuf_size))) { ERROR("Could not allocate compression buffer"); return -1; } } else { if (!(ptmp = realloc(buf->pages, buf->compbuf_size))) { ERROR("Could not reallocate compression buffer"); return -1; } buf->pages = ptmp; } if ( RDEXACT(fd, buf->pages + (buf->compbuf_size - compbuf_size), compbuf_size) ) { PERROR("Error when reading compression buffer"); return -1; } ***** In usual code, the nr_physpages is set to 0 in the pagebuf_get() and in the main restore loop. Same logic is applied here. The original code receives pages in batches of 1024 max. The compression code receives pages in compressed chunks. _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |