qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: Alberto Garcia <berto@igalia.com>, qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>,
	qemu-stable@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/2] blockdev: Fix regression with the default naming of throttling groups
Date: Fri, 8 Jul 2016 16:23:03 +0200	[thread overview]
Message-ID: <9589dde4-638e-efe5-5791-a990fc93fe3d@redhat.com> (raw)
In-Reply-To: <af5cd58bd2c4b9f6c57f260d9cfe586b9fb7d34d.1467986342.git.berto@igalia.com>

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

On 08.07.2016 16:03, Alberto Garcia wrote:
> When I/O limits are set for a block device, the name of the throttling
> group is taken from the BlockBackend if the user doesn't specify one.
> 
> Commit efaa7c4eeb7490c6f37f3 moved the naming of the BlockBackend in
> blockdev_init() to the end of the function, after I/O limits are set.
> The consequence is that the throttling group gets an empty name.
> 
> Signed-off-by: Alberto Garcia <berto@igalia.com>
> Reported-by: Stefan Hajnoczi <stefanha@redhat.com>
> Cc: Max Reitz <mreitz@redhat.com>
> Cc: qemu-stable@nongnu.org
> ---
>  blockdev.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/blockdev.c b/blockdev.c
> index 0f8065c..3ad7d29 100644
> --- a/blockdev.c
> +++ b/blockdev.c
> @@ -483,6 +483,7 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts,
>      const char *id;
>      BlockdevDetectZeroesOptions detect_zeroes =
>          BLOCKDEV_DETECT_ZEROES_OPTIONS_OFF;
> +    const char *blk_id;
>      const char *throttling_group = NULL;
>  
>      /* Check common options by copying from bs_opts to opts, all other options
> @@ -512,6 +513,8 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts,
>  
>      writethrough = !qemu_opt_get_bool(opts, BDRV_OPT_CACHE_WB, true);
>  
> +    blk_id = qemu_opts_id(opts);
> +

Side note: The "id" variable is supposed to contain the exact same
value, but the string it points to is invalidated by the
qdict_del(bs_opts, "id") call.

So indeed we need to obtain the ID anew here (or we'd have to do
g_strdup() before and g_free() after, which is cumbersome). But
regarding the variable itself, you could have actually reused "id" (I
only noticed that just now).

But that's just a minor thing, so:

Reviewed-by: Max Reitz <mreitz@redhat.com>

>      qdict_extract_subqdict(bs_opts, &interval_dict, "stats-intervals.");
>      qdict_array_split(interval_dict, &interval_list);
>  
> @@ -616,7 +619,7 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts,
>      /* disk I/O throttling */
>      if (throttle_enabled(&cfg)) {
>          if (!throttling_group) {
> -            throttling_group = blk_name(blk);
> +            throttling_group = blk_id;
>          }
>          blk_io_limits_enable(blk, throttling_group);
>          blk_set_io_limits(blk, &cfg);
> @@ -625,7 +628,7 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts,
>      blk_set_enable_write_cache(blk, !writethrough);
>      blk_set_on_error(blk, on_read_error, on_write_error);
>  
> -    if (!monitor_add_blk(blk, qemu_opts_id(opts), errp)) {
> +    if (!monitor_add_blk(blk, blk_id, errp)) {
>          blk_unref(blk);
>          blk = NULL;
>          goto err_no_bs_opts;
> 



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

  reply	other threads:[~2016-07-08 14:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-08 14:02 [Qemu-devel] [PATCH 0/2] Fix regression with the default naming of throttling groups Alberto Garcia
2016-07-08 14:03 ` [Qemu-devel] [PATCH 1/2] blockdev: " Alberto Garcia
2016-07-08 14:23   ` Max Reitz [this message]
2016-07-08 14:25     ` Alberto Garcia
2016-07-08 14:03 ` [Qemu-devel] [PATCH 2/2] qemu-iotests: Test " Alberto Garcia
2016-07-08 14:31   ` Max Reitz
2016-07-08 14:36 ` [Qemu-devel] [PATCH 0/2] Fix regression with the default " Max Reitz
2016-07-08 16:29 ` Stefan Hajnoczi

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=9589dde4-638e-efe5-5791-a990fc93fe3d@redhat.com \
    --to=mreitz@redhat.com \
    --cc=berto@igalia.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@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).