[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
- Re: [Qemu-devel] [PATCH v2 13/16] block: Implement bdrv_append() without bdrv_swap(), (continued)
- [Qemu-devel] [PATCH v2 16/16] block: Remove bdrv_swap(), Kevin Wolf, 2015/10/08
- [Qemu-devel] [PATCH v2 08/16] block: Manage backing file references in bdrv_set_backing_hd(), Kevin Wolf, 2015/10/08
- [Qemu-devel] [PATCH v2 07/16] block: Convert bs->backing_hd to BdrvChild, Kevin Wolf, 2015/10/08
- [Qemu-devel] [PATCH v2 09/16] block: Split bdrv_move_feature_fields(), Kevin Wolf, 2015/10/08
- [Qemu-devel] [PATCH v2 02/16] vmdk: Use BdrvChild instead of BDS for references to extents, Kevin Wolf, 2015/10/08
- [Qemu-devel] [PATCH v2 04/16] quorum: Convert to BdrvChild, Kevin Wolf, 2015/10/08
- [Qemu-devel] [PATCH v2 01/16] block: Introduce BDS.file_child, Kevin Wolf, 2015/10/08
- [Qemu-devel] [PATCH v2 12/16] block: Introduce parents list, Kevin Wolf, 2015/10/08
- [Qemu-devel] [PATCH v2 14/16] blockjob: Store device name at job creation, Kevin Wolf, 2015/10/08
- [Qemu-devel] [PATCH v2 10/16] block/io: Make bdrv_requests_pending() public, Kevin Wolf, 2015/10/08