From patchwork Fri Jul 8 14:05:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alberto Garcia X-Patchwork-Id: 646420 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3rmGjL0Bmdz9t0G for ; Sat, 9 Jul 2016 00:15:18 +1000 (AEST) Received: from localhost ([::1]:45858 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLWYm-0002mA-0h for incoming@patchwork.ozlabs.org; Fri, 08 Jul 2016 10:15:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47060) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLWPV-0000aw-Oh for qemu-devel@nongnu.org; Fri, 08 Jul 2016 10:05:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bLWPS-0006mb-Hj for qemu-devel@nongnu.org; Fri, 08 Jul 2016 10:05:40 -0400 Received: from smtp3.mundo-r.com ([212.51.32.191]:49778 helo=smtp4.mundo-r.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLWPS-0006ly-2w; Fri, 08 Jul 2016 10:05:38 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2BxAgAvsn9X/5tjdVtbHQGDIIFSjSqXBpJVgg+Be4YYAoEnOBQBAQEBAQEBZSeETQIEJ1IQPxI8GxmINAG9XwEwhV+CSIQGAYNThQ8FjgRwiiCOT4lNhV+QDh42ghYmgThriTIBAQE X-IPAS-Result: A2BxAgAvsn9X/5tjdVtbHQGDIIFSjSqXBpJVgg+Be4YYAoEnOBQBAQEBAQEBZSeETQIEJ1IQPxI8GxmINAG9XwEwhV+CSIQGAYNThQ8FjgRwiiCOT4lNhV+QDh42ghYmgThriTIBAQE X-IronPort-AV: E=Sophos;i="5.28,330,1464645600"; d="scan'208";a="82788930" Received: from fanzine.igalia.com ([91.117.99.155]) by smtp4.mundo-r.com with ESMTP; 08 Jul 2016 16:05:35 +0200 Received: from [194.100.51.2] (helo=perseus.local) by fanzine.igalia.com with esmtpsa (Cipher TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim) id 1bLWPP-00036S-7s; Fri, 08 Jul 2016 16:05:35 +0200 Received: from berto by perseus.local with local (Exim 4.87) (envelope-from ) id 1bLWP9-0000js-KC; Fri, 08 Jul 2016 17:05:19 +0300 From: Alberto Garcia To: qemu-devel@nongnu.org Date: Fri, 8 Jul 2016 17:05:13 +0300 Message-Id: <4b0273851beba772975be3e3a0decb2b93846874.1467986629.git.berto@igalia.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 212.51.32.191 Subject: [Qemu-devel] [PATCH for-2.6 1/2] blockdev: Fix regression with the default naming of throttling groups X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alberto Garcia , Stefan Hajnoczi , qemu-stable@nongnu.org, qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 Reported-by: Stefan Hajnoczi Cc: Max Reitz Cc: qemu-stable@nongnu.org Reviewed-by: Max Reitz --- blockdev.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/blockdev.c b/blockdev.c index f1f520a..260a6f5 100644 --- a/blockdev.c +++ b/blockdev.c @@ -481,6 +481,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 @@ -510,6 +511,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); + qdict_extract_subqdict(bs_opts, &interval_dict, "stats-intervals."); qdict_array_split(interval_dict, &interval_list); @@ -579,7 +582,7 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts, if (throttle_enabled(&cfg)) { if (!throttling_group) { - throttling_group = blk_name(blk); + throttling_group = blk_id; } blk_rs->throttle_group = g_strdup(throttling_group); blk_rs->throttle_state = throttle_group_incref(throttling_group); @@ -614,7 +617,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; } bdrv_io_limits_enable(bs, throttling_group); bdrv_set_io_limits(bs, &cfg); @@ -636,7 +639,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;