[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/5] sheepdog: fix return value of do_load_save_vm_s
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 2/5] sheepdog: fix return value of do_load_save_vm_state |
Date: |
Wed, 30 May 2012 15:37:13 +0200 |
From: MORITA Kazutaka <address@hidden>
bdrv_save_vmstate and bdrv_load_vmstate should return the vmstate size
on success, and -errno on error.
Signed-off-by: MORITA Kazutaka <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/sheepdog.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/block/sheepdog.c b/block/sheepdog.c
index 6d52277..f46ca8f 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;
--
1.7.6.5
- [Qemu-devel] [PULL 0/5] Block patches for 1.1, Kevin Wolf, 2012/05/07
- [Qemu-devel] [PATCH 1/5] sheepdog: switch to writethrough mode if cluster doesn't support flush, Kevin Wolf, 2012/05/07
- [Qemu-devel] [PATCH 2/5] qcow2: Limit COW to where it's needed, Kevin Wolf, 2012/05/07
- [Qemu-devel] [PATCH 3/5] block: make bdrv_create adopt coroutine, Kevin Wolf, 2012/05/07
- [Qemu-devel] [PATCH 4/5] qcow2: lock on prealloc, Kevin Wolf, 2012/05/07
- [Qemu-devel] [PATCH 5/5] fdc: simplify media change handling, Kevin Wolf, 2012/05/07
- Re: [Qemu-devel] [PULL 0/5] Block patches for 1.1, Anthony Liguori, 2012/05/08
- [Qemu-devel] [PULL 0/5] Block patches for 1.1, Kevin Wolf, 2012/05/30
- [Qemu-devel] [PATCH 2/5] sheepdog: fix return value of do_load_save_vm_state,
Kevin Wolf <=
- [Qemu-devel] [PATCH 3/5] block: prevent snapshot mode $TMPDIR symlink attack, Kevin Wolf, 2012/05/30
- [Qemu-devel] [PATCH 5/5] ahci: SATA FIS is 20 bytes, not 0x20, Kevin Wolf, 2012/05/30
- [Qemu-devel] [PATCH 1/5] virtio: Fix compiler warning for non Linux hosts, Kevin Wolf, 2012/05/30
- [Qemu-devel] [PATCH 4/5] virtio-blk: Fix geometry sector calculation, Kevin Wolf, 2012/05/30
- Re: [Qemu-devel] [PULL 0/5] Block patches for 1.1, Anthony Liguori, 2012/05/30