summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>2012-05-30 01:05:15 +0900
committerMichael Roth <mdroth@linux.vnet.ibm.com>2012-06-25 09:03:33 -0500
commitfeba8ae20b372115bc15432d7c484171c25bee62 (patch)
treedd6e21ddde2b8cbdc446fc8430c2fc0ca265c65f
parentqemu/xendisk: set maximum number of grants to be used (diff)
downloadqemu-kvm-feba8ae20b372115bc15432d7c484171c25bee62.tar.gz
qemu-kvm-feba8ae20b372115bc15432d7c484171c25bee62.tar.bz2
qemu-kvm-feba8ae20b372115bc15432d7c484171c25bee62.zip
sheepdog: fix return value of do_load_save_vm_state
bdrv_save_vmstate and bdrv_load_vmstate should return the vmstate size on success, and -errno on error. Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp> Signed-off-by: Kevin Wolf <kwolf@redhat.com> (cherry picked from commit 6f3c714eb7730630241fd0b33b799352d7feb876) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
-rw-r--r--block/sheepdog.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/block/sheepdog.c b/block/sheepdog.c
index 6d52277a8..f46ca8fb6 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -1957,7 +1957,7 @@ static int do_load_save_vmstate(BDRVSheepdogState *s, uint8_t *data,
int64_t pos, int size, int load)
{
int fd, create;
- int ret = 0;
+ int ret = 0, remaining = size;
unsigned int data_len;
uint64_t vmstate_oid;
uint32_t vdi_index;
@@ -1968,11 +1968,11 @@ static int do_load_save_vmstate(BDRVSheepdogState *s, uint8_t *data,
return fd;
}
- while (size) {
+ while (remaining) {
vdi_index = pos / SD_DATA_OBJ_SIZE;
offset = pos % SD_DATA_OBJ_SIZE;
- data_len = MIN(size, SD_DATA_OBJ_SIZE);
+ data_len = MIN(remaining, SD_DATA_OBJ_SIZE);
vmstate_oid = vid_to_vmstate_oid(s->inode.vdi_id, vdi_index);
@@ -1993,9 +1993,9 @@ static int do_load_save_vmstate(BDRVSheepdogState *s, uint8_t *data,
}
pos += data_len;
- size -= data_len;
- ret += data_len;
+ remaining -= data_len;
}
+ ret = size;
cleanup:
closesocket(fd);
return ret;