From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57116) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0Ean-0000GD-8i for qemu-devel@nongnu.org; Wed, 03 Jun 2015 15:44:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z0Eam-0000Sg-ED for qemu-devel@nongnu.org; Wed, 03 Jun 2015 15:44:49 -0400 From: Max Reitz Date: Wed, 3 Jun 2015 21:43:48 +0200 Message-Id: <1433360659-1915-8-git-send-email-mreitz@redhat.com> In-Reply-To: <1433360659-1915-1-git-send-email-mreitz@redhat.com> References: <1433360659-1915-1-git-send-email-mreitz@redhat.com> Subject: [Qemu-devel] [PATCH v3 07/38] block/quorum: Implement bdrv_is_inserted() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-block@nongnu.org Cc: Kevin Wolf , qemu-devel@nongnu.org, Markus Armbruster , Stefan Hajnoczi , Max Reitz , John Snow bdrv_is_inserted() should be invoked recursively on the children of quorum. Signed-off-by: Max Reitz Reviewed-by: Eric Blake --- block/quorum.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/block/quorum.c b/block/quorum.c index f91ef75..61fdcd0 100644 --- a/block/quorum.c +++ b/block/quorum.c @@ -1061,6 +1061,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", @@ -1084,6 +1098,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) -- 2.4.1