Patchwork [V3,4/7] qed: add bdrv_invalidate_cache to be called after incoming live migration

login
register
mail settings
Submitter Benoit Canet
Date March 23, 2012, 7:36 a.m.
Message ID <1332488214-4685-5-git-send-email-benoit.canet@gmail.com>
Download mbox | patch
Permalink /patch/148394/
State New
Headers show

Comments

Benoit Canet - March 23, 2012, 7:36 a.m.
The QED image is reopened to flush metadata and check consistency.

Signed-off-by: Benoit Canet <benoit.canet@gmail.com>
---
 block/qed.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

Patch

diff --git a/block/qed.c b/block/qed.c
index a041d31..e32f598 100644
--- a/block/qed.c
+++ b/block/qed.c
@@ -1516,6 +1516,15 @@  static int bdrv_qed_change_backing_file(BlockDriverState *bs,
     return ret;
 }
 
+static void bdrv_qed_invalidate_cache(BlockDriverState *bs)
+{
+    BDRVQEDState *s = bs->opaque;
+
+    bdrv_qed_close(bs);
+    memset(s, 0, sizeof(BDRVQEDState));
+    bdrv_qed_open(bs, bs->open_flags);
+}
+
 static int bdrv_qed_check(BlockDriverState *bs, BdrvCheckResult *result)
 {
     BDRVQEDState *s = bs->opaque;
@@ -1568,6 +1577,7 @@  static BlockDriver bdrv_qed = {
     .bdrv_getlength           = bdrv_qed_getlength,
     .bdrv_get_info            = bdrv_qed_get_info,
     .bdrv_change_backing_file = bdrv_qed_change_backing_file,
+    .bdrv_invalidate_cache    = bdrv_qed_invalidate_cache,
     .bdrv_check               = bdrv_qed_check,
 };