qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: Wen Congyang <wency@cn.fujitsu.com>, qemu-block@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
	qemu-devel@nongnu.org, Markus Armbruster <armbru@redhat.com>
Subject: Re: [Qemu-devel] [RFC for-2.7 1/1] block/qapi: Add query-block-node-tree
Date: Sat, 26 Mar 2016 17:33:30 +0100	[thread overview]
Message-ID: <56F6B9DA.1090601@redhat.com> (raw)
In-Reply-To: <56F4E0C0.6080609@cn.fujitsu.com>


[-- Attachment #1.1: Type: text/plain, Size: 2026 bytes --]

On 25.03.2016 07:54, Wen Congyang wrote:
> On 03/25/2016 03:07 AM, Max Reitz wrote:
>> This command returns the tree of BlockDriverStates under a given root
>> node.
>>
>> Every tree node is described by its node name and the connection of a
>> parent node to its children additionally contains the role the child
>> assumes.
>>
>> A node's name can then be used e.g. in conjunction with
>> query-named-block-nodes to get more information about the node.
> 
> I found another problem:
> 
> {'execute': 'query-block-node-tree', 'arguments': {'root-node': 'disk1' } }
> {"return": {"children": [{"role": "children.1", "node": {"children": [{"role": "file", "node": {}}], "node-name": "test1"}}, {"role": "children.0", "node": {"children": [{"role": "file", "node": {}}]}}]}}
> 
> s->children[0] is children.0, and s->children[1] is children.1.
> But we output them in reverse order. The reason is:
> 
> BdrvChild *bdrv_attach_child(BlockDriverState *parent_bs,
>                              BlockDriverState *child_bs,
>                              const char *child_name,
>                              const BdrvChildRole *child_role)
> {
>     BdrvChild *child = bdrv_root_attach_child(child_bs, child_name, child_role);
>     QLIST_INSERT_HEAD(&parent_bs->children, child, next);
>     return child;
> }
> 
> We insert the new child to the head, not the tail...

Well, the idea is that the order of children doesn't really matter; The
only thing that describes the behavior of a child is its role. For
instance, for qcow2 it doesn't matter whether the "file" or the
"backing" BDS is the first child.

However, for quorum, the order might matter (e.g. in FIFO mode). But
then again, the order is clearly specified by the role again: The first
child is the one with the "children.0" role.

So I don't think this is real problem as long as I add a note to the
documentation that the order of objects in the @children array is
undefined and does not have any significance.

Max


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

  reply	other threads:[~2016-03-26 16:33 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-24 19:07 [Qemu-devel] [RFC for-2.7 0/1] block/qapi: Add query-block-node-tree Max Reitz
2016-03-24 19:07 ` [Qemu-devel] [RFC for-2.7 1/1] " Max Reitz
2016-03-25  2:50   ` Wen Congyang
2016-03-26 16:27     ` Max Reitz
2016-03-25  6:54   ` Wen Congyang
2016-03-26 16:33     ` Max Reitz [this message]
2016-03-28 15:25       ` Eric Blake
2016-03-29 15:29         ` Max Reitz
2016-03-29 15:39           ` Eric Blake
2016-03-29 15:43             ` Max Reitz
2016-03-29 15:51 ` [Qemu-devel] [RFC for-2.7 0/1] " Kevin Wolf
2016-03-29 15:56   ` Max Reitz
2016-03-29 16:09     ` Kevin Wolf
2016-03-29 16:10       ` Max Reitz
2016-03-30 12:43 ` [Qemu-devel] [Qemu-block] " Alberto Garcia
2016-03-30 14:22   ` Max Reitz
2016-03-31  9:49 ` Stefan Hajnoczi
2016-04-01 15:30   ` Max Reitz
2016-04-04 12:35     ` Stefan Hajnoczi

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=56F6B9DA.1090601@redhat.com \
    --to=mreitz@redhat.com \
    --cc=armbru@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=wency@cn.fujitsu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).