qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 1/7] block: Convert BlockDriverState.in_use to r


From: Fam Zheng
Subject: Re: [Qemu-devel] [PATCH 1/7] block: Convert BlockDriverState.in_use to refcount
Date: Wed, 3 Jul 2013 08:59:17 +0800
User-agent: Mutt/1.5.21 (2010-09-15)

On Tue, 07/02 13:41, Eric Blake wrote:
> On 07/01/2013 11:59 PM, Fam Zheng wrote:
> > Use numeric value to replace in_use flag in BDS, this will make
> > lifecycle management with ref count possible. This patch only replaces
> > existing uses of bdrv_set_in_use, so no logic change here.
> > 
> > Signed-off-by: Fam Zheng <address@hidden>
> > ---
> >  block-migration.c               |  4 ++--
> >  block.c                         | 23 +++++++++++++++--------
> >  blockjob.c                      |  6 +++---
> >  hw/block/dataplane/virtio-blk.c |  4 ++--
> >  include/block/block.h           |  3 ++-
> >  include/block/block_int.h       |  2 +-
> >  6 files changed, 25 insertions(+), 17 deletions(-)
> > 
> > diff --git a/block-migration.c b/block-migration.c
> > index 2fd7699..2efb6c0 100644
> > --- a/block-migration.c
> > +++ b/block-migration.c
> > @@ -321,7 +321,7 @@ static void init_blk_migration_it(void *opaque, 
> > BlockDriverState *bs)
> >          bmds->shared_base = block_mig_state.shared_base;
> >          alloc_aio_bitmap(bmds);
> >          drive_get_ref(drive_get_by_blockdev(bs));
> > -        bdrv_set_in_use(bs, 1);
> > +        bdrv_get_ref(bs);
> 
> The old code sets the flag, the new code gets a ref.
> 
> >  
> >          block_mig_state.total_sector_sum += sectors;
> >  
> > @@ -557,7 +557,7 @@ static void blk_mig_cleanup(void)
> >      blk_mig_lock();
> >      while ((bmds = QSIMPLEQ_FIRST(&block_mig_state.bmds_list)) != NULL) {
> >          QSIMPLEQ_REMOVE_HEAD(&block_mig_state.bmds_list, entry);
> > -        bdrv_set_in_use(bmds->bs, 0);
> > +        bdrv_get_ref(bmds->bs);
> 
> The old code sets the flag, the new code gets a ref.  Shouldn't this be
> clearing a ref, with bdrv_put_ref?
Yes, thanks for pointing out.



-- 
Fam



reply via email to

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