Patchwork [v2,06/12] VMDK: flush multiple extents

login
register
mail settings
Submitter Feiran Zheng
Date June 24, 2011, 8:18 a.m.
Message ID <1308903507-10799-7-git-send-email-famcool@gmail.com>
Download mbox | patch
Permalink /patch/101750/
State New
Headers show

Comments

Feiran Zheng - June 24, 2011, 8:18 a.m.
From: Fam Zheng <famcool@gmail.com>

Flush all the file that referenced by the image.

Signed-off-by: Fam Zheng <famcool@gmail.com>
---
 block/vmdk.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
Stefan Hajnoczi - June 24, 2011, 9:58 a.m.
On Fri, Jun 24, 2011 at 9:18 AM,  <famcool@gmail.com> wrote:
> From: Fam Zheng <famcool@gmail.com>
>
> Flush all the file that referenced by the image.
>
> Signed-off-by: Fam Zheng <famcool@gmail.com>
> ---
>  block/vmdk.c |    9 ++++++++-
>  1 files changed, 8 insertions(+), 1 deletions(-)

Please see my comments on the previous version of this patch.

Stefan

Patch

diff --git a/block/vmdk.c b/block/vmdk.c
index e1b94c2..41a18a1 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -1061,7 +1061,14 @@  static void vmdk_close(BlockDriverState *bs)
 
 static int vmdk_flush(BlockDriverState *bs)
 {
-    return bdrv_flush(bs->file);
+    int i, ret;
+    BDRVVmdkState *s = bs->opaque;
+
+    ret = bdrv_flush(bs->file);
+    for (i = 0; i < s->num_extents; i++) {
+        ret |= bdrv_flush(s->extents[i].file);
+    }
+    return ret;
 }