Patchwork [RFC,05/12] qorum: Add qorum_close().

login
register
mail settings
Submitter Benoit Canet
Date Aug. 2, 2012, 10:16 a.m.
Message ID <1343902604-13981-6-git-send-email-benoit@irqsave.net>
Download mbox | patch
Permalink /patch/174727/
State New
Headers show

Comments

Benoit Canet - Aug. 2, 2012, 10:16 a.m.
Signed-off-by: Benoit Canet <benoit@irqsave.net>
---
 block/qorum.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

Patch

diff --git a/block/qorum.c b/block/qorum.c
index bdf1530..006ab8c 100644
--- a/block/qorum.c
+++ b/block/qorum.c
@@ -108,6 +108,17 @@  clean_exit:
     return ret;
 }
 
+static void qorum_close(BlockDriverState *bs)
+{
+    BDRVQorumState *s = bs->opaque;
+    int i;
+
+    /* Ensure writes reach stable storage */
+    for (i = 0; i <= 2; i++) {
+        bdrv_flush(s->bs[i]);
+    }
+}
+
 static BlockDriver bdrv_qorum = {
     .format_name        = "qorum",
     .protocol_name      = "qorum",
@@ -115,6 +126,7 @@  static BlockDriver bdrv_qorum = {
     .instance_size      = sizeof(BDRVQorumState),
 
     .bdrv_file_open     = qorum_open,
+    .bdrv_close         = qorum_close,
 };
 
 static void bdrv_qorum_init(void)