Patchwork [RFC,09/12] qorum: Add qorum_co_flush().

login
register
mail settings
Submitter Benoit Canet
Date Aug. 2, 2012, 10:16 a.m.
Message ID <1343902604-13981-10-git-send-email-benoit@irqsave.net>
Download mbox | patch
Permalink /patch/174715/
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 |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

Patch

diff --git a/block/qorum.c b/block/qorum.c
index 3dae8e4..eeffac2 100644
--- a/block/qorum.c
+++ b/block/qorum.c
@@ -15,6 +15,10 @@ 
 
 #include "block_int.h"
 
+ssize_t blkverify_iovec_compare(QEMUIOVector *a, QEMUIOVector *b);
+void blkverify_iovec_clone(QEMUIOVector *dest, const QEMUIOVector *src,
+                           void *buf);
+
 typedef struct {
     BlockDriverState * bs[3];
 } BDRVQorumState;
@@ -244,6 +248,21 @@  static BlockDriverAIOCB *qorum_aio_writev(BlockDriverState *bs,
     return &acb->common;
 }
 
+static coroutine_fn int qorum_co_flush(BlockDriverState *bs)
+{
+    BDRVQorumState *s = bs->opaque;
+    int i, ret;
+
+    for (i = 0; i <= 2; i++) {
+        ret = bdrv_co_flush(s->bs[i]);
+        if (ret < 0) {
+            return ret;
+        }
+    }
+
+    return ret;
+}
+
 static BlockDriver bdrv_qorum = {
     .format_name        = "qorum",
     .protocol_name      = "qorum",
@@ -254,6 +273,7 @@  static BlockDriver bdrv_qorum = {
 
     .bdrv_file_open     = qorum_open,
     .bdrv_close         = qorum_close,
+    .bdrv_co_flush_to_disk = qorum_co_flush,
 
     .bdrv_aio_writev    = qorum_aio_writev,
 };