qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alberto Garcia <berto@igalia.com>
To: Eric Blake <eblake@redhat.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
	qemu-block@nongnu.org, Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 1/3] block: Allow x-blockdev-del on a BB with a monitor-owned BDS
Date: Tue, 09 Feb 2016 16:39:50 +0100	[thread overview]
Message-ID: <w51vb5xq4e1.fsf@maestria.local.igalia.com> (raw)
In-Reply-To: <56BA06F1.20704@redhat.com>

On Tue 09 Feb 2016 04:34:09 PM CET, Eric Blake wrote:
> On 02/08/2016 07:14 AM, Alberto Garcia wrote:
>
> When sending a multi-patch series, you should always include a 0/3 cover
> letter.  The cover letter is optional only for a lone patch.

Sorry, I didn't know. The description of the first patch already
contains everything that would go into the cover letter, that's why I
decided to do it like this. I'll include the cover letter in the future.

>>          if (bs->refcnt > 1) {
>> -            error_setg(errp, "Block device %s is in use",
>> -                       bdrv_get_device_or_node_name(bs));
>> -            goto out;
>> +            /* We allow deleting a BlockBackend that has a BDS with an
>> +             * extra reference if that extra reference is from the
>> +             * monitor. */
>> +            bool bs_has_only_monitor_ref =
>> +                blk && bs->monitor_list.tqe_prev && bs->refcnt == 2;
>> +            if (!bs_has_only_monitor_ref) {
>
> I don't think the temporary bool or nested 'if' are necessary; but at
> the same time, I don't think the following is any more legible:
>
> /* Prohibit deleting a BlockBackend whose BDS is in use by any more than
> a single monitor */
> if (bs->refcnt > 1 + (blk && bs->monitor_list.tqe_prev)) {
>     error_setg(...

Exactly, I considered several options and I thought the one I finally
chose would be the easiest to read.

Thanks!

Berto

      reply	other threads:[~2016-02-09 15:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-08 14:14 Alberto Garcia
2016-02-08 14:14 ` [Qemu-devel] [PATCH 2/3] iotests: Update test 139 after the changes in x-blockdev-del Alberto Garcia
2016-02-09 15:36   ` Eric Blake
2016-02-09 15:44     ` Alberto Garcia
2016-02-08 14:14 ` [Qemu-devel] [PATCH 3/3] block: Update the x-blockdev-del documentation Alberto Garcia
2016-02-09 15:38   ` Eric Blake
2016-02-09 10:32 ` [Qemu-devel] [PATCH 1/3] block: Allow x-blockdev-del on a BB with a monitor-owned BDS Kevin Wolf
2016-02-09 10:47   ` Alberto Garcia
2016-02-09 15:34 ` Eric Blake
2016-02-09 15:39   ` Alberto Garcia [this message]

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=w51vb5xq4e1.fsf@maestria.local.igalia.com \
    --to=berto@igalia.com \
    --cc=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --subject='Re: [Qemu-devel] [PATCH 1/3] block: Allow x-blockdev-del on a BB with a monitor-owned BDS' \
    /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

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).