qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 12/16] block: Introduce parents list


From: Alberto Garcia
Subject: Re: [Qemu-devel] [PATCH 12/16] block: Introduce parents list
Date: Tue, 29 Sep 2015 16:00:09 +0200
User-agent: Notmuch/0.13.2 (http://notmuchmail.org) Emacs/23.2.1 (i486-pc-linux-gnu)

On Tue 29 Sep 2015 02:21:37 PM CEST, Kevin Wolf wrote:
>> > @@ -1090,6 +1090,7 @@ static BdrvChild *bdrv_attach_child(BlockDriverState 
>> > *parent_bs,
>> >      };
>> >  
>> >      QLIST_INSERT_HEAD(&parent_bs->children, child, next);
>> > +    QLIST_INSERT_HEAD(&child_bs->parents, child, next_parent);
>> >  
>> >      return child;
>> >  }
>> 
>> Ok, I'm probably slow today, but what is this used for? :-? And why
>> is it called 'parents'? The list doesn't contain pointers to the
>> parents of child_bs, but to child_bs itself...
>
> It's the list of BdrvChild objects that point to the given
> BlockDriverState.

Ok I see now. I think the names here are misleading, 'parent' means the
BdrvChild object, not parent_bs.

The name child_bs->parents suggests that you can actually iterate over
the BDSs that have child_bs as a child, but that's not the case, it's a
mechanism that allows children to change the pointers that are pointing
at them.

I'm not sure what a better name would be ("reverse refs"?), but at least
I think this deserves a comment.

Berto



reply via email to

[Prev in Thread] Current Thread [Next in Thread]