From 98a7a38f81af2b79a134eaa6cbed543aa3ca5fe2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Canet?= Date: Fri, 21 Feb 2014 22:21:19 +0100 Subject: quorum: Implement recursive .bdrv_recurse_is_first_non_filter in quorum. This is used to activate quorum snapshot. Signed-off-by: Benoit Canet Reviewed-by: Max Reitz Signed-off-by: Kevin Wolf --- block/quorum.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'block/quorum.c') diff --git a/block/quorum.c b/block/quorum.c index 840afda..1b2b56f 100644 --- a/block/quorum.c +++ b/block/quorum.c @@ -655,6 +655,23 @@ static coroutine_fn int quorum_co_flush(BlockDriverState *bs) return result; } +static bool quorum_recurse_is_first_non_filter(BlockDriverState *bs, + BlockDriverState *candidate) +{ + BDRVQuorumState *s = bs->opaque; + int i; + + for (i = 0; i < s->num_children; i++) { + bool perm = bdrv_recurse_is_first_non_filter(s->bs[i], + candidate); + if (perm) { + return true; + } + } + + return false; +} + static BlockDriver bdrv_quorum = { .format_name = "quorum", .protocol_name = "quorum", @@ -668,6 +685,8 @@ static BlockDriver bdrv_quorum = { .bdrv_aio_readv = quorum_aio_readv, .bdrv_aio_writev = quorum_aio_writev, .bdrv_invalidate_cache = quorum_invalidate_cache, + + .bdrv_recurse_is_first_non_filter = quorum_recurse_is_first_non_filter, }; static void bdrv_quorum_init(void) -- cgit v1.1