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 <kw...@redhat.com>
> > @@ -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