qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 07/16] block: Convert bs->backing_hd to BdrvC


From: Kevin Wolf
Subject: Re: [Qemu-devel] [PATCH v2 07/16] block: Convert bs->backing_hd to BdrvChild
Date: Fri, 9 Oct 2015 13:36:48 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

Am 09.10.2015 um 03:39 hat Fam Zheng geschrieben:
> On Thu, 10/01 15:13, Kevin Wolf wrote:
> > This is the final step in converting all of the BlockDriverState
> > pointers that block drivers use to BdrvChild.
> > 
> > After this patch, bs->children contains the full list of child nodes
> > that are referenced by a given BDS, and these children are only
> > referenced through BdrvChild, so that updating the pointer in there is
> > enough for changing edges in the graph.
> > 
> > Signed-off-by: Kevin Wolf <address@hidden>

> > @@ -2366,11 +2365,20 @@ int bdrv_change_backing_file(BlockDriverState *bs,
> >  BlockDriverState *bdrv_find_overlay(BlockDriverState *active,
> >                                      BlockDriverState *bs)
> >  {
> > -    while (active && bs != active->backing_hd) {
> > -        active = active->backing_hd;
> > +    while (active) {
> > +        if (active->backing) {
> > +            if (bs == active->backing->bs) {
> > +                return active;
> > +            }
> > +            active = active->backing->bs;
> > +        } else if (bs == NULL) {
> > +            return active;
> > +        } else {
> > +            return NULL;
> > +        }
> 
> Why not just
> 
>     while (active && bs != backing_bs(active)) {
>         active = backing_bs(active);
>     }
> 
>     return active;
> 
> ?

Because backing_bs() didn't exist yet when I converted this function.

Thanks for noticing, I'll change it into the simpler version.

Kevin



reply via email to

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