[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 01/11] block: replace in_use with refcnt_soft
From: |
Fam Zheng |
Subject: |
Re: [Qemu-devel] [PATCH v2 01/11] block: replace in_use with refcnt_soft and refcnt_hard |
Date: |
Thu, 18 Jul 2013 12:53:42 +0800 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Wed, 07/17 14:26, Paolo Bonzini wrote:
> Il 17/07/2013 11:42, Fam Zheng ha scritto:
> > Introduce refcnt_soft (soft reference) and refcnt_hard (hard reference)
> > to BlockDriverState, since in_use mechanism cannot provide proper
> > management of lifecycle when a BDS is referenced in multiple places
> > (e.g. pointed to by another bs's backing_hd while also used as a block
> > job device, in the use case of image fleecing).
> >
> > The original in_use case is considered a "hard reference" in this patch,
> > where the bs is busy and should not be used in other tasks that require
> > a hard reference. (However the interface doesn't force this, caller
> > still need to call bdrv_in_use() to check by itself.).
> >
> > A soft reference is implemented but not used yet. It will be used in
> > following patches to manage the lifecycle together with hard reference.
> >
> > If bdrv_ref() is called on a BDS, it must be released by exactly the
> > same numbers of bdrv_unref() with the same "soft/hard" type, and never
> > call bdrv_delete() directly. If the BDS is only used locally (unnamed),
> > bdrv_ref/bdrv_unref can be skipped and just use bdrv_delete().
>
> Pardon the stupid question: why do we need a "soft" reference?
Added in other patch of the series:
drive_add if=none,file=foo.qcow2,backing=bar
^^^^^^^^^^^
This is the reason, with it we can add arbitrary devices referencing bar
as backing_hd, which we can't backtrack from "bar" when user runs
drive_del, so we can't simply delete. Either we close all children (and
descendants), or we keep it until no one references it.
In this context, it's solved with reference count. Why not hard? Becasue
hard ref blocks block job.
--
Fam
- [Qemu-devel] [PATCH v2 00/11] Point-in-time snapshot exporting over NBD, Fam Zheng, 2013/07/17
- [Qemu-devel] [PATCH v2 01/11] block: replace in_use with refcnt_soft and refcnt_hard, Fam Zheng, 2013/07/17
- Re: [Qemu-devel] [PATCH v2 01/11] block: replace in_use with refcnt_soft and refcnt_hard, Paolo Bonzini, 2013/07/17
- Re: [Qemu-devel] [PATCH v2 01/11] block: replace in_use with refcnt_soft and refcnt_hard,
Fam Zheng <=
- Re: [Qemu-devel] [PATCH v2 01/11] block: replace in_use with refcnt_soft and refcnt_hard, Stefan Hajnoczi, 2013/07/23
- Re: [Qemu-devel] [PATCH v2 01/11] block: replace in_use with refcnt_soft and refcnt_hard, Fam Zheng, 2013/07/23
- Re: [Qemu-devel] [PATCH v2 01/11] block: replace in_use with refcnt_soft and refcnt_hard, Stefan Hajnoczi, 2013/07/23
- Re: [Qemu-devel] [PATCH v2 01/11] block: replace in_use with refcnt_soft and refcnt_hard, Fam Zheng, 2013/07/23
- Re: [Qemu-devel] [PATCH v2 01/11] block: replace in_use with refcnt_soft and refcnt_hard, Stefan Hajnoczi, 2013/07/24
- Re: [Qemu-devel] [PATCH v2 01/11] block: replace in_use with refcnt_soft and refcnt_hard, Fam Zheng, 2013/07/24
- Re: [Qemu-devel] [PATCH v2 01/11] block: replace in_use with refcnt_soft and refcnt_hard, Stefan Hajnoczi, 2013/07/25
[Qemu-devel] [PATCH v2 02/11] block: use refcnt for bs->backing_hd and bs->file, Fam Zheng, 2013/07/17
[Qemu-devel] [PATCH v2 03/11] block: use refcnt for drive_init/drive_uninit, Fam Zheng, 2013/07/17
[Qemu-devel] [PATCH v2 04/11] block: use refcnt for device attach/detach, Fam Zheng, 2013/07/17