From patchwork Wed May 11 13:24:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 9069711 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A33219F1C1 for ; Wed, 11 May 2016 13:27:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EB8AF20114 for ; Wed, 11 May 2016 13:27:16 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 00640200ED for ; Wed, 11 May 2016 13:27:16 +0000 (UTC) Received: from localhost ([::1]:52182 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b0UAU-00037q-Ts for patchwork-qemu-devel@patchwork.kernel.org; Wed, 11 May 2016 09:27:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55210) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b0U8B-0007HG-6G for qemu-devel@nongnu.org; Wed, 11 May 2016 09:24:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b0U85-0007o4-Q0 for qemu-devel@nongnu.org; Wed, 11 May 2016 09:24:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47150) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b0U7y-0007kk-3V; Wed, 11 May 2016 09:24:38 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AE8ED28A5F; Wed, 11 May 2016 13:24:37 +0000 (UTC) Received: from noname.str.redhat.com. (dhcp-192-197.str.redhat.com [10.33.192.197]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u4BDOSq6028301; Wed, 11 May 2016 09:24:36 -0400 From: Kevin Wolf To: qemu-block@nongnu.org Date: Wed, 11 May 2016 15:24:15 +0200 Message-Id: <1462973065-9876-5-git-send-email-kwolf@redhat.com> In-Reply-To: <1462973065-9876-1-git-send-email-kwolf@redhat.com> References: <1462973065-9876-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 11 May 2016 13:24:37 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 04/14] block: Convert throttle_group_get_name() to BlockBackend 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: kwolf@redhat.com, berto@igalia.com, qemu-devel@nongnu.org, mreitz@redhat.com, stefanha@redhat.com, pbonzini@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Kevin Wolf Reviewed-by: Alberto Garcia --- block/block-backend.c | 2 +- block/io.c | 2 +- block/qapi.c | 2 +- block/throttle-groups.c | 12 ++++++------ include/block/throttle-groups.h | 2 +- tests/test-throttle.c | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/block/block-backend.c b/block/block-backend.c index 2f8acbd..964a205 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -1525,7 +1525,7 @@ void blk_update_root_state(BlockBackend *blk) throttle_group_unref(blk->root_state.throttle_state); } if (blk->root->bs->throttle_state) { - const char *name = throttle_group_get_name(blk->root->bs); + const char *name = throttle_group_get_name(blk); blk->root_state.throttle_group = g_strdup(name); blk->root_state.throttle_state = throttle_group_incref(name); } else { diff --git a/block/io.c b/block/io.c index ede74c5..f6fb868 100644 --- a/block/io.c +++ b/block/io.c @@ -89,7 +89,7 @@ void bdrv_io_limits_update_group(BlockDriverState *bs, const char *group) } /* this bs is a part of the same group than the one we want */ - if (!g_strcmp0(throttle_group_get_name(bs), group)) { + if (!g_strcmp0(throttle_group_get_name(bs->blk), group)) { return; } diff --git a/block/qapi.c b/block/qapi.c index c5f6ba6..a3e514d 100644 --- a/block/qapi.c +++ b/block/qapi.c @@ -118,7 +118,7 @@ BlockDeviceInfo *bdrv_block_device_info(BlockBackend *blk, info->iops_size = cfg.op_size; info->has_group = true; - info->group = g_strdup(throttle_group_get_name(bs)); + info->group = g_strdup(throttle_group_get_name(bs->blk)); } info->write_threshold = bdrv_write_threshold_get(bs); diff --git a/block/throttle-groups.c b/block/throttle-groups.c index 1e6e2e5..e50ccaa 100644 --- a/block/throttle-groups.c +++ b/block/throttle-groups.c @@ -133,16 +133,16 @@ void throttle_group_unref(ThrottleState *ts) qemu_mutex_unlock(&throttle_groups_lock); } -/* Get the name from a BlockDriverState's ThrottleGroup. The name (and - * the pointer) is guaranteed to remain constant during the lifetime - * of the group. +/* Get the name from a BlockBackend's ThrottleGroup. The name (and the pointer) + * is guaranteed to remain constant during the lifetime of the group. * - * @bs: a BlockDriverState that is member of a throttling group + * @blk: a BlockBackend that is member of a throttling group * @ret: the name of the group. */ -const char *throttle_group_get_name(BlockDriverState *bs) +const char *throttle_group_get_name(BlockBackend *blk) { - ThrottleGroup *tg = container_of(bs->throttle_state, ThrottleGroup, ts); + ThrottleGroup *tg = container_of(blk_bs(blk)->throttle_state, + ThrottleGroup, ts); return tg->name; } diff --git a/include/block/throttle-groups.h b/include/block/throttle-groups.h index b9114ee..bd55a34 100644 --- a/include/block/throttle-groups.h +++ b/include/block/throttle-groups.h @@ -28,7 +28,7 @@ #include "qemu/throttle.h" #include "block/block_int.h" -const char *throttle_group_get_name(BlockDriverState *bs); +const char *throttle_group_get_name(BlockBackend *blk); ThrottleState *throttle_group_incref(const char *name); void throttle_group_unref(ThrottleState *ts); diff --git a/tests/test-throttle.c b/tests/test-throttle.c index beaa2a3..1a322f1 100644 --- a/tests/test-throttle.c +++ b/tests/test-throttle.c @@ -598,8 +598,8 @@ static void test_groups(void) g_assert(bdrv2->throttle_state != NULL); g_assert(bdrv3->throttle_state != NULL); - g_assert(!strcmp(throttle_group_get_name(bdrv1), "bar")); - g_assert(!strcmp(throttle_group_get_name(bdrv2), "foo")); + g_assert(!strcmp(throttle_group_get_name(blk1), "bar")); + g_assert(!strcmp(throttle_group_get_name(blk2), "foo")); g_assert(bdrv1->throttle_state == bdrv3->throttle_state); /* Setting the config of a group member affects the whole group */