From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 75AFAC43334 for ; Fri, 24 Jun 2022 21:47:17 +0000 (UTC) Received: from localhost ([::1]:55710 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4r92-0002Ac-Cr for qemu-devel@archiver.kernel.org; Fri, 24 Jun 2022 17:47:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60916) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4qs3-0000WF-D2; Fri, 24 Jun 2022 17:29:43 -0400 Received: from forwardcorp1o.mail.yandex.net ([95.108.205.193]:44566) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4qs1-0004TW-FB; Fri, 24 Jun 2022 17:29:43 -0400 Received: from myt5-4c5921969858.qloud-c.yandex.net (myt5-4c5921969858.qloud-c.yandex.net [IPv6:2a02:6b8:c12:3b1a:0:640:4c59:2196]) by forwardcorp1o.mail.yandex.net (Yandex) with ESMTP id 9EEC72E1FC1; Sat, 25 Jun 2022 00:29:34 +0300 (MSK) Received: from myt6-81d8ab6a9f9d.qloud-c.yandex.net (myt6-81d8ab6a9f9d.qloud-c.yandex.net [2a02:6b8:c12:520a:0:640:81d8:ab6a]) by myt5-4c5921969858.qloud-c.yandex.net (mxbackcorp/Yandex) with ESMTP id 7oM0dLSYga-TYJSVQna; Sat, 25 Jun 2022 00:29:34 +0300 X-Yandex-Fwd: 2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1656106174; bh=xfaHaHrgAaMjieeR1Ioq2wGXaCIzsSOpBlzFiGD40ZQ=; h=Message-Id:References:Date:Subject:In-Reply-To:Cc:To:From; b=EYJGVz2Is5SqcIhyrvp+vjMDsQOWew+XwmbEbOFXRpj28JxrUvBpWJrZoGqoBSakq TXmHYQ2qFDTTx9g+HcHiPP7c8KH1/KsFr6i8yKUJb3EmBxz03PR/lI3X07bhLng93B ITid2Uh9Y41SIkZnat39n8B3L2wv4msqC+fZdjpw= Authentication-Results: myt5-4c5921969858.qloud-c.yandex.net; dkim=pass header.i=@yandex-team.ru Received: from vsementsov-win.yandex-team.ru (unknown [2a02:6b8:b081:b64c::1:2c]) by myt6-81d8ab6a9f9d.qloud-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id KXs24KJ458-TYMSxxgM; Sat, 25 Jun 2022 00:29:34 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, kwolf@redhat.com, hreitz@redhat.com, vsementsov@yandex-team.ru Subject: [PATCH v6 12/15] Revert "block: Pass BdrvChild ** to replace_child_noperm" Date: Sat, 25 Jun 2022 00:28:27 +0300 Message-Id: <20220624212830.316919-13-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220624212830.316919-1-vsementsov@yandex-team.ru> References: <20220624212830.316919-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=95.108.205.193; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1o.mail.yandex.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" That's a preparation to previously reverted "block: Let replace_child_noperm free children". Drop it too, we don't need it for a new approach. This reverts commit be64bbb0149748f3999c49b13976aafb8330ea86. Signed-off-by: Vladimir Sementsov-Ogievskiy --- block.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/block.c b/block.c index 3ac332a460..ca86cd86d3 100644 --- a/block.c +++ b/block.c @@ -90,7 +90,7 @@ static BlockDriverState *bdrv_open_inherit(const char *filename, static bool bdrv_recurse_has_child(BlockDriverState *bs, BlockDriverState *child); -static void bdrv_replace_child_noperm(BdrvChild **child, +static void bdrv_replace_child_noperm(BdrvChild *child, BlockDriverState *new_bs); static void bdrv_remove_file_or_backing_child(BlockDriverState *bs, BdrvChild *child, @@ -2352,7 +2352,7 @@ static void bdrv_replace_child_abort(void *opaque) GLOBAL_STATE_CODE(); /* old_bs reference is transparently moved from @s to @s->child */ - bdrv_replace_child_noperm(&s->child, s->old_bs); + bdrv_replace_child_noperm(s->child, s->old_bs); bdrv_unref(new_bs); } @@ -2382,7 +2382,7 @@ static void bdrv_replace_child_tran(BdrvChild *child, BlockDriverState *new_bs, if (new_bs) { bdrv_ref(new_bs); } - bdrv_replace_child_noperm(&child, new_bs); + bdrv_replace_child_noperm(child, new_bs); /* old_bs reference is transparently moved from @child to @s */ } @@ -2764,10 +2764,9 @@ uint64_t bdrv_qapi_perm_to_blk_perm(BlockPermission qapi_perm) return permissions[qapi_perm]; } -static void bdrv_replace_child_noperm(BdrvChild **childp, +static void bdrv_replace_child_noperm(BdrvChild *child, BlockDriverState *new_bs) { - BdrvChild *child = *childp; BlockDriverState *old_bs = child->bs; int new_bs_quiesce_counter; int drain_saldo; @@ -2865,7 +2864,7 @@ static void bdrv_attach_child_common_abort(void *opaque) BlockDriverState *bs = child->bs; GLOBAL_STATE_CODE(); - bdrv_replace_child_noperm(s->child, NULL); + bdrv_replace_child_noperm(child, NULL); if (bdrv_get_aio_context(bs) != s->old_child_ctx) { bdrv_try_set_aio_context(bs, s->old_child_ctx, &error_abort); @@ -2966,7 +2965,7 @@ static int bdrv_attach_child_common(BlockDriverState *child_bs, } bdrv_ref(child_bs); - bdrv_replace_child_noperm(&new_child, child_bs); + bdrv_replace_child_noperm(new_child, child_bs); *child = new_child; @@ -3022,13 +3021,13 @@ static int bdrv_attach_child_noperm(BlockDriverState *parent_bs, return 0; } -static void bdrv_detach_child(BdrvChild **childp) +static void bdrv_detach_child(BdrvChild *child) { - BlockDriverState *old_bs = (*childp)->bs; + BlockDriverState *old_bs = child->bs; GLOBAL_STATE_CODE(); - bdrv_replace_child_noperm(childp, NULL); - bdrv_child_free(*childp); + bdrv_replace_child_noperm(child, NULL); + bdrv_child_free(child); if (old_bs) { /* @@ -3140,7 +3139,7 @@ void bdrv_root_unref_child(BdrvChild *child) GLOBAL_STATE_CODE(); child_bs = child->bs; - bdrv_detach_child(&child); + bdrv_detach_child(child); bdrv_unref(child_bs); } -- 2.25.1