From patchwork Thu Mar 17 15:56:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 8612541 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 52086C0554 for ; Thu, 17 Mar 2016 15:59:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AC7F420351 for ; Thu, 17 Mar 2016 15:59:13 +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 D485120364 for ; Thu, 17 Mar 2016 15:59:12 +0000 (UTC) Received: from localhost ([::1]:36123 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agaKO-0006E2-7a for patchwork-qemu-devel@patchwork.kernel.org; Thu, 17 Mar 2016 11:59:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37682) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agaIK-0001vM-81 for qemu-devel@nongnu.org; Thu, 17 Mar 2016 11:57:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1agaIJ-0001hz-7M for qemu-devel@nongnu.org; Thu, 17 Mar 2016 11:57:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53245) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agaIF-0001gA-0l; Thu, 17 Mar 2016 11:56:59 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 8AE2E263F; Thu, 17 Mar 2016 15:56:58 +0000 (UTC) Received: from noname.redhat.com (ovpn-116-71.ams2.redhat.com [10.36.116.71]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u2HFuj1F010106; Thu, 17 Mar 2016 11:56:57 -0400 From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 17 Mar 2016 16:56:22 +0100 Message-Id: <1458230202-29136-10-git-send-email-kwolf@redhat.com> In-Reply-To: <1458230202-29136-1-git-send-email-kwolf@redhat.com> References: <1458230202-29136-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 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 09/29] blockdev: Rename blk_backends 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org 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 From: Max Reitz The blk_backends list does not contain all BlockBackends but only the ones which are referenced by the monitor, and that is not necessarily true for every BlockBackend. Rename the list to monitor_block_backends to make that fact clear. Signed-off-by: Max Reitz Signed-off-by: Kevin Wolf --- block/block-backend.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/block/block-backend.c b/block/block-backend.c index e75b8fe..3bb2a6a 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -29,7 +29,7 @@ struct BlockBackend { int refcnt; BlockDriverState *bs; DriveInfo *legacy_dinfo; /* null unless created by drive_new() */ - QTAILQ_ENTRY(BlockBackend) link; /* for blk_backends */ + QTAILQ_ENTRY(BlockBackend) monitor_link; /* for monitor_block_backends */ void *dev; /* attached device model, if any */ /* TODO change to DeviceState when all users are qdevified */ @@ -69,9 +69,10 @@ static const AIOCBInfo block_backend_aiocb_info = { static void drive_info_del(DriveInfo *dinfo); -/* All the BlockBackends (except for hidden ones) */ -static QTAILQ_HEAD(, BlockBackend) blk_backends = - QTAILQ_HEAD_INITIALIZER(blk_backends); +/* All BlockBackends referenced by the monitor and which are iterated through by + * blk_next() */ +static QTAILQ_HEAD(, BlockBackend) monitor_block_backends = + QTAILQ_HEAD_INITIALIZER(monitor_block_backends); /* * Create a new BlockBackend with @name, with a reference count of one. @@ -105,7 +106,7 @@ BlockBackend *blk_new(const char *name, Error **errp) blk->refcnt = 1; notifier_list_init(&blk->remove_bs_notifiers); notifier_list_init(&blk->insert_bs_notifiers); - QTAILQ_INSERT_TAIL(&blk_backends, blk, link); + QTAILQ_INSERT_TAIL(&monitor_block_backends, blk, monitor_link); return blk; } @@ -178,7 +179,7 @@ static void blk_delete(BlockBackend *blk) } /* Avoid double-remove after blk_hide_on_behalf_of_hmp_drive_del() */ if (blk->name[0]) { - QTAILQ_REMOVE(&blk_backends, blk, link); + QTAILQ_REMOVE(&monitor_block_backends, blk, monitor_link); } g_free(blk->name); drive_info_del(blk->legacy_dinfo); @@ -241,7 +242,7 @@ void blk_remove_all_bs(void) } /* - * Return the BlockBackend after @blk. + * Return the monitor-owned BlockBackend after @blk. * If @blk is null, return the first one. * Else, return @blk's next sibling, which may be null. * @@ -252,7 +253,8 @@ void blk_remove_all_bs(void) */ BlockBackend *blk_next(BlockBackend *blk) { - return blk ? QTAILQ_NEXT(blk, link) : QTAILQ_FIRST(&blk_backends); + return blk ? QTAILQ_NEXT(blk, monitor_link) + : QTAILQ_FIRST(&monitor_block_backends); } /* @@ -353,7 +355,7 @@ BlockBackend *blk_by_legacy_dinfo(DriveInfo *dinfo) */ void blk_hide_on_behalf_of_hmp_drive_del(BlockBackend *blk) { - QTAILQ_REMOVE(&blk_backends, blk, link); + QTAILQ_REMOVE(&monitor_block_backends, blk, monitor_link); blk->name[0] = 0; if (blk->bs) { bdrv_make_anon(blk->bs);