diff mbox

[06/11] quorum: Add quorum_co_flush().

Message ID 1350995029-29128-7-git-send-email-benoit@irqsave.net
State New
Headers show

Commit Message

Benoît Canet Oct. 23, 2012, 12:23 p.m. UTC
Signed-off-by: Benoit Canet <benoit@irqsave.net>
---
 block/quorum.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)

Comments

Eric Blake Oct. 23, 2012, 3:37 p.m. UTC | #1
On 10/23/2012 06:23 AM, Benoît Canet wrote:
> Signed-off-by: Benoit Canet <benoit@irqsave.net>
> ---
>  block/quorum.c |   13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/block/quorum.c b/block/quorum.c
> index 878d930..1b40081 100644
> --- a/block/quorum.c
> +++ b/block/quorum.c
> @@ -281,6 +281,18 @@ static BlockDriverAIOCB *quorum_aio_writev(BlockDriverState *bs,
>      return &acb->common;
>  }
>  
> +static coroutine_fn int quorum_co_flush(BlockDriverState *bs)
> +{
> +    BDRVQuorumState *s = bs->opaque;
> +    int i;
> +
> +    for (i = 0; i < s->total; i++) {
> +        bdrv_co_flush(s->bs[i]);

What if any of the individual flush calls return non-zero?

> +    }
> +
> +    return 0;

Shouldn't you then do likewise?
diff mbox

Patch

diff --git a/block/quorum.c b/block/quorum.c
index 878d930..1b40081 100644
--- a/block/quorum.c
+++ b/block/quorum.c
@@ -281,6 +281,18 @@  static BlockDriverAIOCB *quorum_aio_writev(BlockDriverState *bs,
     return &acb->common;
 }
 
+static coroutine_fn int quorum_co_flush(BlockDriverState *bs)
+{
+    BDRVQuorumState *s = bs->opaque;
+    int i;
+
+    for (i = 0; i < s->total; i++) {
+        bdrv_co_flush(s->bs[i]);
+    }
+
+    return 0;
+}
+
 static BlockDriver bdrv_quorum = {
     .format_name        = "quorum",
     .protocol_name      = "quorum",
@@ -289,6 +301,7 @@  static BlockDriver bdrv_quorum = {
 
     .bdrv_file_open     = quorum_open,
     .bdrv_close         = quorum_close,
+    .bdrv_co_flush_to_disk = quorum_co_flush,
 
     .bdrv_aio_writev    = quorum_aio_writev,
 };