Message ID | 1437414365-11881-8-git-send-email-mreitz@redhat.com |
---|---|
State | New |
Headers | show |
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
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
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 --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)