[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 23/23] block: Make device model's references
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH v3 23/23] block: Make device model's references to BlockBackend strong |
Date: |
Tue, 30 Sep 2014 14:04:57 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Kevin Wolf <address@hidden> writes:
> Am 16.09.2014 um 20:12 hat Markus Armbruster geschrieben:
>> Doesn't make a difference just yet, but it's the right thing to do.
>>
>> Signed-off-by: Markus Armbruster <address@hidden>
>> ---
>> block/block-backend.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/block/block-backend.c b/block/block-backend.c
>> index d49c988..5646628 100644
>> --- a/block/block-backend.c
>> +++ b/block/block-backend.c
>> @@ -253,6 +253,7 @@ int blk_attach_dev(BlockBackend *blk, void *dev)
>> if (blk->dev) {
>> return -EBUSY;
>> }
>> + blk_ref(blk);
>> blk->dev = dev;
>> bdrv_iostatus_reset(blk->bs);
>>
>> @@ -281,9 +282,10 @@ void blk_detach_dev(BlockBackend *blk, void *dev)
>> /* TODO change to DeviceState *dev when all users are qdevified */
>> {
>> assert(blk->dev == dev);
>> - blk->dev = NULL;
>> blk->dev_ops = NULL;
>> blk->dev_opaque = NULL;
>> + blk->dev = NULL;
>
> Is the move of blk->dev intentional or a rebase artifact?
Artifact, already cleaned up in my tree.
>> + blk_unref(blk);
>> bdrv_set_guest_block_size(blk->bs, 512);
>> qemu_coroutine_adjust_pool_size(-COROUTINE_POOL_RESERVATION);
>> }
>
> hw/sd/sd.c calls blk_attach_dev_nofail(), but never detaches the BB
> again. The reference count will therefore never become zero.
Feature!
> Probably
> okay for a device that isn't unpluggable, bdrv_close_all() should still
> do everything that is important for a clean shutdown.
Yes, that's its mission.
> Reviewed-by: Kevin Wolf <address@hidden>
Thanks!
[Qemu-devel] [PATCH v3 16/23] pc87312: Drop unused members of PC87312State, Markus Armbruster, 2014/09/16