aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxc/xc_domain_save.c
diff options
context:
space:
mode:
authorIan Campbell <ian.campbell@citrix.com>2011-05-24 10:14:10 +0100
committerIan Campbell <ian.campbell@citrix.com>2011-05-24 10:14:10 +0100
commit5bf59f752e7b4f493f9f3b4454cbc42bc82d06d1 (patch)
treeb8b47e33f9804023e27b4dddd52ed90ee76cb8f6 /tools/libxc/xc_domain_save.c
parent7e0cf3678692744eddb73156d654ae2ebadb51fe (diff)
downloadxen-5bf59f752e7b4f493f9f3b4454cbc42bc82d06d1.tar.gz
xen-5bf59f752e7b4f493f9f3b4454cbc42bc82d06d1.tar.bz2
xen-5bf59f752e7b4f493f9f3b4454cbc42bc82d06d1.zip
libxc: save: move static "write_count" variable into outbuf.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson.citrix.com> Committed-by: Ian Jackson <ian.jackson.citrix.com>
Diffstat (limited to 'tools/libxc/xc_domain_save.c')
-rw-r--r--tools/libxc/xc_domain_save.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/tools/libxc/xc_domain_save.c b/tools/libxc/xc_domain_save.c
index d43e634921..639488c24d 100644
--- a/tools/libxc/xc_domain_save.c
+++ b/tools/libxc/xc_domain_save.c
@@ -59,6 +59,7 @@ struct outbuf {
void* buf;
size_t size;
size_t pos;
+ int write_count;
};
#define OUTBUF_SIZE (16384 * 1024)
@@ -152,19 +153,19 @@ static uint64_t tv_delta(struct timeval *new, struct timeval *old)
}
static int noncached_write(xc_interface *xch,
+ struct outbuf* ob,
int fd, void *buffer, int len)
{
- static int write_count = 0;
int rc = (write_exact(fd, buffer, len) == 0) ? len : -1;
- write_count += len;
- if ( write_count >= (MAX_PAGECACHE_USAGE * PAGE_SIZE) )
+ ob->write_count += len;
+ if ( ob->write_count >= (MAX_PAGECACHE_USAGE * PAGE_SIZE) )
{
/* Time to discard cache - dont care if this fails */
int saved_errno = errno;
discard_file_cache(xch, fd, 0 /* no flush */);
errno = saved_errno;
- write_count = 0;
+ ob->write_count = 0;
}
return rc;
@@ -260,7 +261,7 @@ static inline int write_uncached(xc_interface *xch,
if ( dobuf )
return outbuf_hardwrite(xch, ob, fd, buf, len) ? -1 : len;
else
- return noncached_write(xch, fd, buf, len);
+ return noncached_write(xch, ob, fd, buf, len);
}
static int print_stats(xc_interface *xch, uint32_t domid, int pages_sent,