[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 11/16] block-backend: Add blk_set_bs()
From: |
Kevin Wolf |
Subject: |
Re: [Qemu-devel] [PATCH 11/16] block-backend: Add blk_set_bs() |
Date: |
Wed, 23 Sep 2015 17:51:37 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Am 23.09.2015 um 17:46 hat Max Reitz geschrieben:
> On 17.09.2015 15:48, Kevin Wolf wrote:
> > It allows changing the BlockDriverState that a BlockBackend points to.
> >
> > Signed-off-by: Kevin Wolf <address@hidden>
> > ---
> > block/block-backend.c | 16 ++++++++++++++++
> > include/block/block_int.h | 2 ++
> > 2 files changed, 18 insertions(+)
> >
> > diff --git a/block/block-backend.c b/block/block-backend.c
> > index c2e8732..a2afcff 100644
> > --- a/block/block-backend.c
> > +++ b/block/block-backend.c
> > @@ -239,6 +239,22 @@ BlockDriverState *blk_bs(BlockBackend *blk)
> > }
> >
> > /*
> > + * Changes the BlockDriverState attached to @blk
> > + */
> > +void blk_set_bs(BlockBackend *blk, BlockDriverState *bs)
> > +{
> > + bdrv_ref(bs);
> > +
> > + if (blk->bs) {
> > + blk->bs->blk = NULL;
> > + bdrv_unref(blk->bs);
> > + }
> > +
> > + blk->bs = bs;
> > + bs->blk = blk;
> > +}
> > +
> > +/*
>
> As discussed in the BlockBackend and media thread, you should probably
> assert(bs->blk == NULL),
Yes, my current branch has this already.
> and I'd rather have this implemented as
> blk_remove_bs(blk); blk_insert_bs(blk, bs);, but that's probably
> something that won't happen until I do so myself.
Let's see which series hits master first. If yours is first, I'll
happily change this patch to make use of the new functions; otherwise,
you get to rebase.
Kevin
pgpsIMli99LGe.pgp
Description: PGP signature
- Re: [Qemu-devel] [PATCH 06/16] block: Remove bdrv_open_image(), (continued)
- [Qemu-devel] [PATCH 09/16] block: Split bdrv_move_feature_fields(), Kevin Wolf, 2015/09/17
- [Qemu-devel] [PATCH 08/16] block: Manage backing file references in bdrv_set_backing_hd(), Kevin Wolf, 2015/09/17
- [Qemu-devel] [PATCH 10/16] block/io: Make bdrv_requests_pending() public, Kevin Wolf, 2015/09/17
- [Qemu-devel] [PATCH 11/16] block-backend: Add blk_set_bs(), Kevin Wolf, 2015/09/17
- [Qemu-devel] [PATCH 07/16] block: Convert bs->backing_hd to BdrvChild, Kevin Wolf, 2015/09/17
- [Qemu-devel] [PATCH 14/16] blockjob: Store device name at job creation, Kevin Wolf, 2015/09/17
- [Qemu-devel] [PATCH 13/16] block: Implement bdrv_append() without bdrv_swap(), Kevin Wolf, 2015/09/17
- Re: [Qemu-devel] [PATCH 13/16] block: Implement bdrv_append() without bdrv_swap(), Max Reitz, 2015/09/23