Patchwork sheepdog: fix savevm and loadvm

login
register
mail settings
Submitter MORITA Kazutaka
Date Aug. 29, 2012, 6:39 p.m.
Message ID <1346265585-16676-1-git-send-email-morita.kazutaka@lab.ntt.co.jp>
Download mbox | patch
Permalink /patch/180747/
State New
Headers show

Comments

MORITA Kazutaka - Aug. 29, 2012, 6:39 p.m.
This patch sets data to be sent to Sheepdog correctly and fixes savevm
and loadvm operations on a Sheepdog image.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
---
 block/sheepdog.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
Kevin Wolf - Aug. 30, 2012, 3:59 p.m.
Am 29.08.2012 20:39, schrieb MORITA Kazutaka:
> This patch sets data to be sent to Sheepdog correctly and fixes savevm
> and loadvm operations on a Sheepdog image.
> 
> Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>

Thanks, applied to the block branch.

Kevin

Patch

diff --git a/block/sheepdog.c b/block/sheepdog.c
index df4f441..e0753ee 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -1986,7 +1986,7 @@  static int do_load_save_vmstate(BDRVSheepdogState *s, uint8_t *data,
         vdi_index = pos / SD_DATA_OBJ_SIZE;
         offset = pos % SD_DATA_OBJ_SIZE;
 
-        data_len = MIN(remaining, SD_DATA_OBJ_SIZE);
+        data_len = MIN(remaining, SD_DATA_OBJ_SIZE - offset);
 
         vmstate_oid = vid_to_vmstate_oid(s->inode.vdi_id, vdi_index);
 
@@ -2007,6 +2007,7 @@  static int do_load_save_vmstate(BDRVSheepdogState *s, uint8_t *data,
         }
 
         pos += data_len;
+        data += data_len;
         remaining -= data_len;
     }
     ret = size;