From nobody Mon Feb 9 15:09:38 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1569592501; cv=none; d=zoho.com; s=zohoarc; b=KBzXZtMY3/XWMzL5ypiQK+V6zUf4AY3/qNBwh29G5PEEvYZMgtbufHZm8Z9Mqa84tp5n5kEpxpZjHFVpblUgbQlVbmmbGw/ANPAcUvy0ebLDCBaG4gRLr9q8YXc9nqPstSZtd7s3lO7BgLAq2lYvQqomPUnYFDpTVXCeLY5sG+Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569592501; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=UQQs0e24MlyGIAhCIxRer6HuOFjOL5qryuABN1Ctqlo=; b=KfIsLksBbIh7XNjYM4zNkM1+ikVsruCEGmMU1AA3ZdDpxv3qL3OHdgj3C6DcDrvrLOOp5N2qcWg0QuaQZw85Ue8yoe5jVDJJggv7lGK/G0id6fanH7Y9hGASniEPKiCkPSPXF+dd4eMwmpdNnAVPAQnff5+1Uir/jyRrWajfdUM= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1569592501659475.68350261410626; Fri, 27 Sep 2019 06:55:01 -0700 (PDT) Received: from localhost ([::1]:51052 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDqi4-0000Ag-3C for importer@patchew.org; Fri, 27 Sep 2019 09:55:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34503) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDqCl-0003Zv-8E for qemu-devel@nongnu.org; Fri, 27 Sep 2019 09:22:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iDqCj-0000L6-RR for qemu-devel@nongnu.org; Fri, 27 Sep 2019 09:22:39 -0400 Received: from relay.sw.ru ([185.231.240.75]:49752) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iDqCg-0000IU-FS; Fri, 27 Sep 2019 09:22:34 -0400 Received: from [10.94.3.0] (helo=kvm.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.92.2) (envelope-from ) id 1iDpHx-0003za-It; Fri, 27 Sep 2019 15:23:57 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v5 1/9] block: switch reopen queue from QSIMPLEQ to QTAILQ Date: Fri, 27 Sep 2019 15:23:47 +0300 Message-Id: <20190927122355.7344-2-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190927122355.7344-1-vsementsov@virtuozzo.com> References: <20190927122355.7344-1-vsementsov@virtuozzo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 185.231.240.75 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, qemu-devel@nongnu.org, mreitz@redhat.com, den@openvz.org, jsnow@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" We'll need reverse-foreach in the following commit, QTAILQ support it, so move to QTAILQ. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Max Reitz --- include/block/block.h | 2 +- block.c | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/include/block/block.h b/include/block/block.h index 37c9de7446..f509943513 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -195,7 +195,7 @@ typedef struct HDGeometry { #define BDRV_BLOCK_EOF 0x20 #define BDRV_BLOCK_RECURSE 0x40 =20 -typedef QSIMPLEQ_HEAD(BlockReopenQueue, BlockReopenQueueEntry) BlockReopen= Queue; +typedef QTAILQ_HEAD(BlockReopenQueue, BlockReopenQueueEntry) BlockReopenQu= eue; =20 typedef struct BDRVReopenState { BlockDriverState *bs; diff --git a/block.c b/block.c index 5944124845..6a3b33f1ec 100644 --- a/block.c +++ b/block.c @@ -1719,7 +1719,7 @@ typedef struct BlockReopenQueueEntry { bool prepared; bool perms_checked; BDRVReopenState state; - QSIMPLEQ_ENTRY(BlockReopenQueueEntry) entry; + QTAILQ_ENTRY(BlockReopenQueueEntry) entry; } BlockReopenQueueEntry; =20 /* @@ -1732,7 +1732,7 @@ static int bdrv_reopen_get_flags(BlockReopenQueue *q,= BlockDriverState *bs) BlockReopenQueueEntry *entry; =20 if (q !=3D NULL) { - QSIMPLEQ_FOREACH(entry, q, entry) { + QTAILQ_FOREACH(entry, q, entry) { if (entry->state.bs =3D=3D bs) { return entry->state.flags; } @@ -3249,7 +3249,7 @@ static bool bdrv_recurse_has_child(BlockDriverState *= bs, * Adds a BlockDriverState to a simple queue for an atomic, transactional * reopen of multiple devices. * - * bs_queue can either be an existing BlockReopenQueue that has had QSIMPL= E_INIT + * bs_queue can either be an existing BlockReopenQueue that has had QTAILQ= _INIT * already performed, or alternatively may be NULL a new BlockReopenQueue = will * be created and initialized. This newly created BlockReopenQueue should = be * passed back in for subsequent calls that are intended to be of the same @@ -3290,7 +3290,7 @@ static BlockReopenQueue *bdrv_reopen_queue_child(Bloc= kReopenQueue *bs_queue, =20 if (bs_queue =3D=3D NULL) { bs_queue =3D g_new0(BlockReopenQueue, 1); - QSIMPLEQ_INIT(bs_queue); + QTAILQ_INIT(bs_queue); } =20 if (!options) { @@ -3298,7 +3298,7 @@ static BlockReopenQueue *bdrv_reopen_queue_child(Bloc= kReopenQueue *bs_queue, } =20 /* Check if this BlockDriverState is already in the queue */ - QSIMPLEQ_FOREACH(bs_entry, bs_queue, entry) { + QTAILQ_FOREACH(bs_entry, bs_queue, entry) { if (bs =3D=3D bs_entry->state.bs) { break; } @@ -3354,7 +3354,7 @@ static BlockReopenQueue *bdrv_reopen_queue_child(Bloc= kReopenQueue *bs_queue, =20 if (!bs_entry) { bs_entry =3D g_new0(BlockReopenQueueEntry, 1); - QSIMPLEQ_INSERT_TAIL(bs_queue, bs_entry, entry); + QTAILQ_INSERT_TAIL(bs_queue, bs_entry, entry); } else { qobject_unref(bs_entry->state.options); qobject_unref(bs_entry->state.explicit_options); @@ -3455,7 +3455,7 @@ int bdrv_reopen_multiple(BlockReopenQueue *bs_queue, = Error **errp) =20 assert(bs_queue !=3D NULL); =20 - QSIMPLEQ_FOREACH(bs_entry, bs_queue, entry) { + QTAILQ_FOREACH(bs_entry, bs_queue, entry) { assert(bs_entry->state.bs->quiesce_counter > 0); if (bdrv_reopen_prepare(&bs_entry->state, bs_queue, errp)) { goto cleanup; @@ -3463,7 +3463,7 @@ int bdrv_reopen_multiple(BlockReopenQueue *bs_queue, = Error **errp) bs_entry->prepared =3D true; } =20 - QSIMPLEQ_FOREACH(bs_entry, bs_queue, entry) { + QTAILQ_FOREACH(bs_entry, bs_queue, entry) { BDRVReopenState *state =3D &bs_entry->state; ret =3D bdrv_check_perm(state->bs, bs_queue, state->perm, state->shared_perm, NULL, NULL, errp); @@ -3489,13 +3489,13 @@ int bdrv_reopen_multiple(BlockReopenQueue *bs_queue= , Error **errp) /* If we reach this point, we have success and just need to apply the * changes */ - QSIMPLEQ_FOREACH(bs_entry, bs_queue, entry) { + QTAILQ_FOREACH(bs_entry, bs_queue, entry) { bdrv_reopen_commit(&bs_entry->state); } =20 ret =3D 0; cleanup_perm: - QSIMPLEQ_FOREACH_SAFE(bs_entry, bs_queue, entry, next) { + QTAILQ_FOREACH_SAFE(bs_entry, bs_queue, entry, next) { BDRVReopenState *state =3D &bs_entry->state; =20 if (!bs_entry->perms_checked) { @@ -3512,7 +3512,7 @@ cleanup_perm: } } cleanup: - QSIMPLEQ_FOREACH_SAFE(bs_entry, bs_queue, entry, next) { + QTAILQ_FOREACH_SAFE(bs_entry, bs_queue, entry, next) { if (ret) { if (bs_entry->prepared) { bdrv_reopen_abort(&bs_entry->state); @@ -3552,7 +3552,7 @@ static BlockReopenQueueEntry *find_parent_in_reopen_q= ueue(BlockReopenQueue *q, { BlockReopenQueueEntry *entry; =20 - QSIMPLEQ_FOREACH(entry, q, entry) { + QTAILQ_FOREACH(entry, q, entry) { BlockDriverState *bs =3D entry->state.bs; BdrvChild *child; =20 --=20 2.21.0