From patchwork Fri Oct 23 17:01:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 535108 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 25955140D7F for ; Sat, 24 Oct 2015 04:15:09 +1100 (AEDT) Received: from localhost ([::1]:40040 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zpfvm-0005YH-T5 for incoming@patchwork.ozlabs.org; Fri, 23 Oct 2015 13:15:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55283) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZpfjQ-0008Hd-Dg for qemu-devel@nongnu.org; Fri, 23 Oct 2015 13:02:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZpfjK-0006sS-DB for qemu-devel@nongnu.org; Fri, 23 Oct 2015 13:02:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44974) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZpfjG-0006qe-Ei; Fri, 23 Oct 2015 13:02:10 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 14F478EA45; Fri, 23 Oct 2015 17:02:10 +0000 (UTC) Received: from noname.redhat.com (ovpn-116-127.ams2.redhat.com [10.36.116.127]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t9NH1RSa019423; Fri, 23 Oct 2015 13:02:09 -0400 From: Kevin Wolf To: qemu-block@nongnu.org Date: Fri, 23 Oct 2015 19:01:14 +0200 Message-Id: <1445619684-18216-28-git-send-email-kwolf@redhat.com> In-Reply-To: <1445619684-18216-1-git-send-email-kwolf@redhat.com> References: <1445619684-18216-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, qemu-devel@nongnu.org Subject: [Qemu-devel] [PULL 27/37] throttle: Remove throttle_group_lock/unlock() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Alberto Garcia The group throttling code was always meant to handle its locking internally. However, bdrv_swap() was touching the ThrottleGroup structure directly and therefore needed an API for that. Now that bdrv_swap() no longer exists there's no need for the throttle_group_lock() API anymore. Signed-off-by: Alberto Garcia Signed-off-by: Kevin Wolf --- block/throttle-groups.c | 31 +------------------------------ include/block/throttle-groups.h | 3 --- 2 files changed, 1 insertion(+), 33 deletions(-) diff --git a/block/throttle-groups.c b/block/throttle-groups.c index 20cb216..3419af7 100644 --- a/block/throttle-groups.c +++ b/block/throttle-groups.c @@ -33,8 +33,7 @@ * its own locking. * * This locking is however handled internally in this file, so it's - * mostly transparent to outside users (but see the documentation in - * throttle_groups_lock()). + * transparent to outside users. * * The whole ThrottleGroup structure is private and invisible to * outside users, that only use it through its ThrottleState. @@ -468,34 +467,6 @@ void throttle_group_unregister_bs(BlockDriverState *bs) bs->throttle_state = NULL; } -/* Acquire the lock of this throttling group. - * - * You won't normally need to use this. None of the functions from the - * ThrottleGroup API require you to acquire the lock since all of them - * deal with it internally. - * - * This should only be used in exceptional cases when you want to - * access the protected fields of a BlockDriverState directly - * (e.g. bdrv_swap()). - * - * @bs: a BlockDriverState that is member of the group - */ -void throttle_group_lock(BlockDriverState *bs) -{ - ThrottleGroup *tg = container_of(bs->throttle_state, ThrottleGroup, ts); - qemu_mutex_lock(&tg->lock); -} - -/* Release the lock of this throttling group. - * - * See the comments in throttle_group_lock(). - */ -void throttle_group_unlock(BlockDriverState *bs) -{ - ThrottleGroup *tg = container_of(bs->throttle_state, ThrottleGroup, ts); - qemu_mutex_unlock(&tg->lock); -} - static void throttle_groups_init(void) { qemu_mutex_init(&throttle_groups_lock); diff --git a/include/block/throttle-groups.h b/include/block/throttle-groups.h index f3b75b3..aba28f3 100644 --- a/include/block/throttle-groups.h +++ b/include/block/throttle-groups.h @@ -43,7 +43,4 @@ void coroutine_fn throttle_group_co_io_limits_intercept(BlockDriverState *bs, unsigned int bytes, bool is_write); -void throttle_group_lock(BlockDriverState *bs); -void throttle_group_unlock(BlockDriverState *bs); - #endif