diff mbox

[v4,07/38] block/quorum: Implement bdrv_is_inserted()

Message ID 1437414365-11881-8-git-send-email-mreitz@redhat.com
State New
Headers show

Commit Message

Max Reitz July 20, 2015, 5:45 p.m. UTC
bdrv_is_inserted() should be invoked recursively on the children of
quorum.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
---
 block/quorum.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Comments

Kevin Wolf Sept. 7, 2015, 6:03 p.m. UTC | #1
Am 20.07.2015 um 19:45 hat Max Reitz geschrieben:
> bdrv_is_inserted() should be invoked recursively on the children of
> quorum.
> 
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> Reviewed-by: Eric Blake <eblake@redhat.com>
> Reviewed-by: Alberto Garcia <berto@igalia.com>

If you implement patch 6 like I suggested, this one could be dropped.

Kevin
Max Reitz Sept. 7, 2015, 6:04 p.m. UTC | #2
On 07.09.2015 20:03, Kevin Wolf wrote:
> Am 20.07.2015 um 19:45 hat Max Reitz geschrieben:
>> bdrv_is_inserted() should be invoked recursively on the children of
>> quorum.
>>
>> Signed-off-by: Max Reitz <mreitz@redhat.com>
>> Reviewed-by: Eric Blake <eblake@redhat.com>
>> Reviewed-by: Alberto Garcia <berto@igalia.com>
> 
> If you implement patch 6 like I suggested, this one could be dropped.

Now that we have this infrastructure, yes. :-)

Max
Kevin Wolf Sept. 7, 2015, 6:16 p.m. UTC | #3
Am 07.09.2015 um 20:04 hat Max Reitz geschrieben:
> On 07.09.2015 20:03, Kevin Wolf wrote:
> > Am 20.07.2015 um 19:45 hat Max Reitz geschrieben:
> >> bdrv_is_inserted() should be invoked recursively on the children of
> >> quorum.
> >>
> >> Signed-off-by: Max Reitz <mreitz@redhat.com>
> >> Reviewed-by: Eric Blake <eblake@redhat.com>
> >> Reviewed-by: Alberto Garcia <berto@igalia.com>
> > 
> > If you implement patch 6 like I suggested, this one could be dropped.
> 
> Now that we have this infrastructure, yes. :-)

It hardly ever feels like it, but sometimes we do make progress. :-)

Kevin
diff mbox

Patch

diff --git a/block/quorum.c b/block/quorum.c
index 4e66221..b7a4c09 100644
--- a/block/quorum.c
+++ b/block/quorum.c
@@ -1034,6 +1034,20 @@  static void quorum_refresh_filename(BlockDriverState *bs)
     bs->full_open_options = opts;
 }
 
+static bool quorum_is_inserted(BlockDriverState *bs)
+{
+    BDRVQuorumState *s = bs->opaque;
+    int i;
+
+    for (i = 0; i < s->num_children; i++) {
+        if (!bdrv_is_inserted(s->bs[i])) {
+            return false;
+        }
+    }
+
+    return true;
+}
+
 static BlockDriver bdrv_quorum = {
     .format_name                        = "quorum",
     .protocol_name                      = "quorum",
@@ -1057,6 +1071,8 @@  static BlockDriver bdrv_quorum = {
 
     .is_filter                          = true,
     .bdrv_recurse_is_first_non_filter   = quorum_recurse_is_first_non_filter,
+
+    .bdrv_is_inserted                   = quorum_is_inserted,
 };
 
 static void bdrv_quorum_init(void)