From patchwork Wed Jul 26 17:14:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manos Pitsidianakis X-Patchwork-Id: 9865489 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 50DC8601A1 for ; Wed, 26 Jul 2017 17:21:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3830E287A6 for ; Wed, 26 Jul 2017 17:21:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2BB77287B7; Wed, 26 Jul 2017 17:21:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id 5D71B287A6 for ; Wed, 26 Jul 2017 17:21:34 +0000 (UTC) Received: from localhost ([::1]:39327 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1daQ05-0008Ny-70 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 26 Jul 2017 13:21:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43187) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1daPuf-0004MQ-S8 for qemu-devel@nongnu.org; Wed, 26 Jul 2017 13:15:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1daPuf-0000NP-3z for qemu-devel@nongnu.org; Wed, 26 Jul 2017 13:15:57 -0400 Received: from smtp1.ntua.gr ([2001:648:2000:de::183]:12535) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1daPuc-0000Ll-Pm; Wed, 26 Jul 2017 13:15:55 -0400 Received: from mail.ntua.gr ([IPv6:2a02:587:8024:a400:9420:81ef:9a0d:c8e9]) (authenticated bits=0) by smtp1.ntua.gr (8.15.2/8.15.2) with ESMTPSA id v6QHFJaw032970 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Jul 2017 20:15:19 +0300 (EEST) (envelope-from el13635@mail.ntua.gr) X-Authentication-Warning: smtp1.ntua.gr: Host [IPv6:2a02:587:8024:a400:9420:81ef:9a0d:c8e9] claimed to be mail.ntua.gr From: Manos Pitsidianakis To: qemu-devel Date: Wed, 26 Jul 2017 20:14:40 +0300 Message-Id: <20170726171444.32218-4-el13635@mail.ntua.gr> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170726171444.32218-1-el13635@mail.ntua.gr> References: <20170726171444.32218-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 v2 3/7] 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 , qemu-block , Stefan Hajnoczi Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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: 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 1fcf6055ff..74c1e7e058 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -215,9 +215,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 a979e86243..f711a3dc62 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); }