All of lore.kernel.org
 help / color / mirror / Atom feed
From: Changlong Xie <xiecl.fnst@cn.fujitsu.com>
To: zhanghailiang <zhang.zhanghailiang@huawei.com>,
	qemu-devel@nongnu.org, qemu-block@nongnu.org
Cc: stefanha@redhat.com, kwolf@redhat.com, mreitz@redhat.com,
	pbonzini@redhat.com, wency@cn.fujitsu.com
Subject: Re: [Qemu-devel] [PATCH RFC 2/7] block-backend: Introduce blk_root() helper
Date: Tue, 25 Oct 2016 17:58:18 +0800	[thread overview]
Message-ID: <580F2CBA.4@cn.fujitsu.com> (raw)
In-Reply-To: <1476971860-20860-3-git-send-email-zhang.zhanghailiang@huawei.com>

I know you need blk->root in the next patch, but we strongly don't 
recommend your current solution.  Please refer Kevin's cf2ab8fc

1409     /* XXX Ugly way to get blk->root, but that's a feature, not a 
bug. This
1410      * hack makes it obvious that vhdx_write_header() bypasses the 
BlockBackend
1411      * here, which it really shouldn't be doing. */
1412     child = QLIST_FIRST(&bs->parents);
1413     assert(!QLIST_NEXT(child, next_parent));

Then you can drop this commit.

On 10/20/2016 09:57 PM, zhanghailiang wrote:
> With this helper function, we can get the BdrvChild struct
> from BlockBackend
>
> Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
> ---
>   block/block-backend.c          | 5 +++++
>   include/sysemu/block-backend.h | 1 +
>   2 files changed, 6 insertions(+)
>
> diff --git a/block/block-backend.c b/block/block-backend.c
> index 1a724a8..66387f0 100644
> --- a/block/block-backend.c
> +++ b/block/block-backend.c
> @@ -389,6 +389,11 @@ BlockDriverState *blk_bs(BlockBackend *blk)
>       return blk->root ? blk->root->bs : NULL;
>   }
>
> +BdrvChild *blk_root(BlockBackend *blk)
> +{
> +    return blk->root;
> +}
> +
>   static BlockBackend *bdrv_first_blk(BlockDriverState *bs)
>   {
>       BdrvChild *child;
> diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h
> index b07159b..867f9f5 100644
> --- a/include/sysemu/block-backend.h
> +++ b/include/sysemu/block-backend.h
> @@ -99,6 +99,7 @@ void blk_remove_bs(BlockBackend *blk);
>   void blk_insert_bs(BlockBackend *blk, BlockDriverState *bs);
>   bool bdrv_has_blk(BlockDriverState *bs);
>   bool bdrv_is_root_node(BlockDriverState *bs);
> +BdrvChild *blk_root(BlockBackend *blk);
>
>   void blk_set_allow_write_beyond_eof(BlockBackend *blk, bool allow);
>   void blk_iostatus_enable(BlockBackend *blk);
>

  reply	other threads:[~2016-10-25  9:50 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-20 13:57 [Qemu-devel] [PATCH RFC 0/7] COLO block replication supports shared disk case zhanghailiang
2016-10-20 13:57 ` [Qemu-devel] [PATCH RFC 1/7] docs/block-replication: Add description for shared-disk case zhanghailiang
2016-10-25  9:03   ` Changlong Xie
2016-11-28  5:13     ` Hailiang Zhang
2016-11-28  6:00       ` Changlong Xie
2016-11-28  5:58         ` Hailiang Zhang
2016-10-20 13:57 ` [Qemu-devel] [PATCH RFC 2/7] block-backend: Introduce blk_root() helper zhanghailiang
2016-10-25  9:58   ` Changlong Xie [this message]
2016-12-05  2:41     ` Hailiang Zhang
2016-10-20 13:57 ` [Qemu-devel] [PATCH RFC 3/7] replication: add shared-disk and shared-disk-id options zhanghailiang
2016-10-25 10:01   ` Changlong Xie
2016-12-05  3:08     ` Hailiang Zhang
2016-10-26  1:58   ` Changlong Xie
2016-10-20 13:57 ` [Qemu-devel] [PATCH RFC 4/7] replication: Split out backup_do_checkpoint() from secondary_do_checkpoint() zhanghailiang
2016-10-26  1:40   ` Changlong Xie
2016-12-05  3:41     ` Hailiang Zhang
2016-10-20 13:57 ` [Qemu-devel] [PATCH RFC 5/7] replication: fix code logic with the new shared_disk option zhanghailiang
2016-10-20 13:57 ` [Qemu-devel] [PATCH RFC 6/7] replication: Implement block replication for shared disk case zhanghailiang
2016-10-20 13:57 ` [Qemu-devel] [PATCH RFC 7/7] nbd/replication: implement .bdrv_get_info() for nbd and replication driver zhanghailiang
2016-10-20 15:34   ` Eric Blake
2016-10-24  2:44     ` Hailiang Zhang
2016-10-26  2:06 ` [Qemu-devel] [PATCH RFC 0/7] COLO block replication supports shared disk case Changlong Xie
2016-11-22 10:33 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2016-11-23  1:47   ` Hailiang Zhang

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=580F2CBA.4@cn.fujitsu.com \
    --to=xiecl.fnst@cn.fujitsu.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=wency@cn.fujitsu.com \
    --cc=zhang.zhanghailiang@huawei.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.