qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>, qemu-block@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Fam Zheng <famz@redhat.com>,
	qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>
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	[thread overview]
Message-ID: <f5de0e4f-e561-c03a-d793-d205d6015ed0@redhat.com> (raw)
In-Reply-To: <e4501a6c-3643-d0cb-4b6f-a6569646edad@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 844 bytes --]

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;
> 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 512 bytes --]

  reply	other threads:[~2017-11-13 16:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-10 17:25 [Qemu-devel] [PATCH v2 for-2.11] block: Make bdrv_next() keep strong references Max Reitz
2017-11-11  0:08 ` Paolo Bonzini
2017-11-13 16:18   ` Max Reitz [this message]
2017-11-13 14:30 ` Stefan Hajnoczi
2017-11-17 16:08 ` Max Reitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f5de0e4f-e561-c03a-d793-d205d6015ed0@redhat.com \
    --to=mreitz@redhat.com \
    --cc=famz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).