From: Paolo Bonzini <pbonzini@redhat.com>
To: Liu Yuan <namei.unix@gmail.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Benoit Canet <benoit@irqsave.net>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] block/quorum: implement .bdrv_co_get_block_status
Date: Fri, 18 Jul 2014 15:35:57 +0200 [thread overview]
Message-ID: <53C922BD.20408@redhat.com> (raw)
In-Reply-To: <1405597808-15975-1-git-send-email-namei.unix@gmail.com>
Il 17/07/2014 13:50, Liu Yuan ha scritto:
> - allow drive-mirror to create sprase mirror on images like qcow2
> - allow qemu-img map to work as expected on quorum driver
>
> Cc: Benoit Canet <benoit@irqsave.net>
> Cc: Kevin Wolf <kwolf@redhat.com>
> Cc: Stefan Hajnoczi <stefanha@redhat.com>
> Signed-off-by: Liu Yuan <namei.unix@gmail.com>
> ---
> block/quorum.c | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/block/quorum.c b/block/quorum.c
> index ebf5c71..f0d0a98 100644
> --- a/block/quorum.c
> +++ b/block/quorum.c
> @@ -780,6 +780,21 @@ static coroutine_fn int quorum_co_flush(BlockDriverState *bs)
> return result;
> }
>
> +static int64_t coroutine_fn quorum_co_get_block_status(BlockDriverState *bs,
> + int64_t sector_num,
> + int nb_sectors,
> + int *pnum)
> +{
> + BDRVQuorumState *s = bs->opaque;
> + BlockDriverState *child_bs = s->bs[0];
> +
> + if (child_bs->drv->bdrv_co_get_block_status)
> + return child_bs->drv->bdrv_co_get_block_status(child_bs, sector_num,
> + nb_sectors, pnum);
Is this "if" necessary?
> + return bdrv_get_block_status(child_bs, sector_num, nb_sectors, pnum);
Also, the definition of BDRV_BLOCK_OFFSET_VALID explicitly refers to
bs->file, so you probably have to exclude it from the result as well as
BDRV_BLOCK_RAW.
Paolo
> +
> static bool quorum_recurse_is_first_non_filter(BlockDriverState *bs,
> BlockDriverState *candidate)
> {
> @@ -1038,6 +1053,7 @@ static BlockDriver bdrv_quorum = {
> .bdrv_close = quorum_close,
>
> .bdrv_co_flush_to_disk = quorum_co_flush,
> + .bdrv_co_get_block_status = quorum_co_get_block_status,
>
> .bdrv_getlength = quorum_getlength,
>
>
next prev parent reply other threads:[~2014-07-18 13:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-17 11:50 [Qemu-devel] [PATCH] block/quorum: implement .bdrv_co_get_block_status Liu Yuan
2014-07-18 3:11 ` Fam Zheng
2014-07-18 5:52 ` Liu Yuan
2014-07-18 11:10 ` Kevin Wolf
2014-07-18 12:14 ` Eric Blake
2014-07-18 13:35 ` Paolo Bonzini [this message]
2014-07-21 3:01 ` Liu Yuan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53C922BD.20408@redhat.com \
--to=pbonzini@redhat.com \
--cc=benoit@irqsave.net \
--cc=kwolf@redhat.com \
--cc=namei.unix@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.