[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 for-2.11] block: Make bdrv_next() keep strong
From: |
Max Reitz |
Subject: |
Re: [Qemu-devel] [PATCH v2 for-2.11] block: Make bdrv_next() keep strong references |
Date: |
Mon, 13 Nov 2017 17:18:27 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 |
On 2017-11-11 01:08, Paolo Bonzini wrote:
> On 10/11/2017 18:25, Max Reitz wrote:
>> if (bs) {
>> + bdrv_ref(bs);
>> + bdrv_unref(old_bs);
>> return bs;
>> }
>
> Maybe instead goto...
>
>> it->phase = BDRV_NEXT_MONITOR_OWNED;
>> + } else {
>> + old_bs = it->bs;
>> }
>>
>> /* Then return the monitor-owned BDSes without a BB attached. Ignore all
>> @@ -467,18 +483,46 @@ BlockDriverState *bdrv_next(BdrvNextIterator *it)
>> bs = it->bs;
>> } while (bs && bdrv_has_blk(bs));
>
> ... here?
I wouldn't mind too much, but I don't think a goto there makes the code
easier to read.
Max
> Paolo
>
>> + if (bs) {
>> + bdrv_ref(bs);
>> + }
>> + bdrv_unref(old_bs);
>> +
>> return bs;
>
signature.asc
Description: OpenPGP digital signature