[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: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH 1/7] block: Convert BlockDriverState.in_use to refcount |
Date: |
Tue, 02 Jul 2013 13:41:17 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 |
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?
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
[Qemu-devel] [PATCH 4/7] block: simplify bdrv_drop_intermediate, Fam Zheng, 2013/07/02