From patchwork Thu Aug 24 12:05:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manos Pitsidianakis X-Patchwork-Id: 805461 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 3xdNMl6Rg9z9sNd for ; Thu, 24 Aug 2017 22:07:31 +1000 (AEST) Received: from localhost ([::1]:48266 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dkqv3-0006sg-KZ for incoming@patchwork.ozlabs.org; Thu, 24 Aug 2017 08:07:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50011) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dkquL-0006qb-Rs for qemu-devel@nongnu.org; Thu, 24 Aug 2017 08:06:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dkquH-0003m0-VP for qemu-devel@nongnu.org; Thu, 24 Aug 2017 08:06:45 -0400 Received: from smtp1.ntua.gr ([2001:648:2000:de::183]:40365) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dkquB-0003gi-TV; Thu, 24 Aug 2017 08:06:36 -0400 Received: from mail.ntua.gr (carp0.noc.ntua.gr [147.102.222.60]) (authenticated bits=0) by smtp1.ntua.gr (8.15.2/8.15.2) with ESMTPSA id v7OC6SWH074231 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 24 Aug 2017 15:06:28 +0300 (EEST) (envelope-from el13635@mail.ntua.gr) X-Authentication-Warning: smtp1.ntua.gr: Host carp0.noc.ntua.gr [147.102.222.60] claimed to be mail.ntua.gr From: Manos Pitsidianakis To: qemu-devel Date: Thu, 24 Aug 2017 15:05:58 +0300 Message-Id: <20170824120601.26963-4-el13635@mail.ntua.gr> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170824120601.26963-1-el13635@mail.ntua.gr> References: <20170824120601.26963-1-el13635@mail.ntua.gr> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:648:2000:de::183 Subject: [Qemu-devel] [PATCH v8 3/6] block: tidy ThrottleGroupMember initializations 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: Kevin Wolf , Alberto Garcia , Stefan Hajnoczi , qemu-block Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Move the CoMutex and CoQueue inits inside throttle_group_register_tgm() which is called whenever a ThrottleGroupMember is initialized. There's no need for them to be separate. Reviewed-by: Alberto Garcia Reviewed-by: Stefan Hajnoczi Signed-off-by: Manos Pitsidianakis --- block/block-backend.c | 3 --- block/throttle-groups.c | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/block/block-backend.c b/block/block-backend.c index 9ba800e733..c51fb8c8aa 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -252,9 +252,6 @@ BlockBackend *blk_new(uint64_t perm, uint64_t shared_perm) blk->shared_perm = shared_perm; blk_set_enable_write_cache(blk, true); - qemu_co_mutex_init(&blk->public.throttle_group_member.throttled_reqs_lock); - qemu_co_queue_init(&blk->public.throttle_group_member.throttled_reqs[0]); - qemu_co_queue_init(&blk->public.throttle_group_member.throttled_reqs[1]); block_acct_init(&blk->stats); notifier_list_init(&blk->remove_bs_notifiers); diff --git a/block/throttle-groups.c b/block/throttle-groups.c index 3b07b25f39..7749cf043f 100644 --- a/block/throttle-groups.c +++ b/block/throttle-groups.c @@ -508,6 +508,9 @@ void throttle_group_register_tgm(ThrottleGroupMember *tgm, read_timer_cb, write_timer_cb, tgm); + qemu_co_mutex_init(&tgm->throttled_reqs_lock); + qemu_co_queue_init(&tgm->throttled_reqs[0]); + qemu_co_queue_init(&tgm->throttled_reqs[1]); qemu_mutex_unlock(&tg->lock); }