From nobody Thu May 16 17:05:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1638563343; cv=pass; d=zohomail.com; s=zohoarc; b=Ukr5sFEcaG/WGnzYbUUdcF+ZrICXthBjydZ2hnOQIPHqKkRHnaMYFpw8OXXtZqDJa2O9lZqG/JYSnrJHNrmiPjZculpGrAV4+Fw38yJBj+insmk3B7+EqZXFWROsr1oUfZIHu7YSOhDYb0Q7Aa4etHnjzY/5K1CllL5VfuBUoA0= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638563343; h=Content-Type: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; bh=8Y9LPTxEfEll8hr7ZfNbGMzDqY1ke2XkpUh154uh+aE=; b=kilsc96fljjjapb6MHzWa6kKAyKPty7bHsgIjRHtXIVCVuIM+pN0t/F8Kt31hipO58NT7eQ3clDEg5EL2XO5aSWZGKLL59KGvHfQ0O8zLHrPkT+YDb0Drdyw2VYDAYZSFij8zz1vf66nIxTbneBirHkWk0QMTkl6AXeQEnNmuFE= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1638563342976528.1870725824358; Fri, 3 Dec 2021 12:29:02 -0800 (PST) Received: from localhost ([::1]:58346 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mtFAz-0003sv-Hx for importer@patchew.org; Fri, 03 Dec 2021 15:29:01 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57550) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mtF8j-0000mO-0d; Fri, 03 Dec 2021 15:26:42 -0500 Received: from mail-eopbgr150139.outbound.protection.outlook.com ([40.107.15.139]:14661 helo=EUR01-DB5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mtF8V-0001cv-2m; Fri, 03 Dec 2021 15:26:30 -0500 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by AM0PR08MB3841.eurprd08.prod.outlook.com (2603:10a6:208:106::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.22; Fri, 3 Dec 2021 20:26:17 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::2078:5a2:1898:d83a]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::2078:5a2:1898:d83a%7]) with mapi id 15.20.4669.024; Fri, 3 Dec 2021 20:26:17 +0000 Received: from kvm.ch-qa.sw.ru (130.117.225.5) by AM6PR10CA0086.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:8c::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.16 via Frontend Transport; Fri, 3 Dec 2021 20:26:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CLxBFoyV1HVSDnho8fAMai/2hhjAZS8BJFBg8wHCGS9qRNlV8jz9HAZiCaVGm4D9e5vhNWJLXmeG9Kdqd3k2OXaRsq5hQQTXKWvJJcMdw6QuBCtWLlxbXXVSFkgB3fIkaoGj9jPNpUvlOXhrvD4nzNwGE6nBJ5QwJ0F9t0re6odGpNd2EYKvz4z3Y7o4bSMwpKI9QfDCV8nrkzP/I1ZtpMRXAGXZbLHraRHM9cOkFA91qedgd/+fs7kPl0aa13fUjPIm3hvsyHnhZKrTfYHFD4Y3MgUWnHknKHspQZeDraaC/ydFwxj8Pf4KaTMCGyNfAPJVJfh3Ia8P//nLtQqbJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8Y9LPTxEfEll8hr7ZfNbGMzDqY1ke2XkpUh154uh+aE=; b=cKcMabTEvhX+w0UEr0kE9fwZJZtnDIRG/gMFz7dLd85cWrakiv/nokubIjWv8o8mLQQJhJCX8CGsuq5m35djRXOa9URzNJrjUW0OeoUJyTzb4kdUnapddVhd5Du8I9JrsAn9iovCHw7OQV05pP3jJ1F53pn/pqI/FpeAKjLihOGZ8MW4zDCPORZCt7/uBI8aH6Fpz/InAIWzpRrTlVqkYCsK7kzowZeud55ktSnkW0FWtgf6K3mqix4ogyrri2AYc1FlxcDu8YjpjDoGKESx0XROOD25xA5oc6Gqq/OCugttOueC1l9EfyMPBUYKc311gcty0lEHfr3NSpYwXm+UeA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8Y9LPTxEfEll8hr7ZfNbGMzDqY1ke2XkpUh154uh+aE=; b=WlvN+8N6dL+ozIJGdFPEyKCnqJUAl5ulMSsYw/UM+0BHKTzdEgFwxnpoPtXdcpM9Wsu0jMVdbgzDjzLE1kcOgkFzgpx7rsfKjzyYRm+2PX2R+1WDgqE/T8/ECm5MeWYKpAcO5Mxx2qzPEQo8AftCjdIBxSQgo8dCPpEHgrk3V3k= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, kwolf@redhat.com, hreitz@redhat.com, vsementsov@virtuozzo.com, John Snow Subject: [PATCH 01/14] block: BlockDriver: add .filtered_child_is_backing field Date: Fri, 3 Dec 2021 21:25:40 +0100 Message-Id: <20211203202553.3231580-2-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211203202553.3231580-1-vsementsov@virtuozzo.com> References: <20211203202553.3231580-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM6PR10CA0086.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:8c::27) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a94453e4-788a-4d52-16cb-08d9b69b2889 X-MS-TrafficTypeDiagnostic: AM0PR08MB3841: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3276; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KhlXKqJDc8yYES/XTQ8YHeXM77U4M6F5xuhgN243mXcNyDeSK/hkCFfaBDfPiVdHkHrbNzyW/l6wBbv8/gD2B3nxthuVc6eDmyxVQRZV+z0DtAoNK8NMH66wLAZrSahneUlUBSasmDYbVRauI01YPbbMyjnxp2HIOqwRUtBQjQDnSXq5kFPoj5A5EPpau87Nf0eJDKqvOf/uQiPAxHJg+c2vSvi96CQ2P74+j8JPttjfLymLhp2pxMvvB8ZBnOmXQDFa263il8h7nVnORjnDBYjPJb/OWE/vmTFeYOIah0n0oPZ1qmKO23GP+l/47YFKYVc6B6RSl6N/u+Uu1H3luBkQZ+vxRidwhtsNT6XvHRy5F5Y15vNkqiG2T+TMVtnwgfsvngL3kEj/URlVPfN2Ca2Ylo1w7nAdQY79m7DZAOy/Wd/RYP4b3knxjK+nlpzjnxxRPWvxefmK41kLtFpxmuCPFvYvuUtoLcA/Ty8fEU1zd5VRuKOuKYzT81RIeCo6NqIRlZHm4p8RjnxijkXGh8wSYeivj4/g+nRZJCDa/LRQC4xtNhLmNE3wNM8dHQJgHapCEWZ2HAlVopgm9TIRf5PXLwRJJZ74CXvEhS90uYc1QIRUtMbuItCqFRpXbjYeyuEJO1O8ItU+XCQqJla+LXHR2bUKLcD8jDvVCUnOsUNrP9DT3pNPOr4sspSKhm2iMYlUJPigkuX2VbLB2tlTFbfZCTcwC8y2WVSr8oQpwkM= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(186003)(86362001)(2906002)(2616005)(6506007)(6916009)(1076003)(66946007)(26005)(36756003)(6666004)(66556008)(6512007)(52116002)(38100700002)(83380400001)(38350700002)(8936002)(8676002)(5660300002)(508600001)(4326008)(6486002)(316002)(956004)(66476007)(142923001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?Msmb5Vaht9DYDc1D8wF/Ur0Qqx5SjOHMnu1dupCOQGUAyzge7F3E11jhAJDw?= =?us-ascii?Q?mvEMcIa91eYaghENWsmNPnwZOQ0YYhC8b08JQ0uPEMvs/ZEcGGt4IV2EddId?= =?us-ascii?Q?Nacky4xSinzOyxYauP6xdxOfR1OnF7ZcfbfytH7iPciYvnvy4LJ+EDtmCqYS?= =?us-ascii?Q?ibNTncjeuyOOLzb7chEPFffAImncakIvoB2zYpt4EwLbluaT6knfd6dPf181?= =?us-ascii?Q?32uh1Yfl48qjbkPNtOnuZP2bDOqCxCfT5ym2fTNbV9LjJNKMxB6kOTQjJq7Y?= =?us-ascii?Q?8JDT70T2GiaGef1N1IApbhIGDc7TrC+oIrDeNTufsmU/t7wb+ILRBovg/wk3?= =?us-ascii?Q?52v9PcAQNWAgRF3wHTpLJhg0GnhWysdIdfma3D1MCjih2SuTftDJ8Ijr6DcL?= =?us-ascii?Q?168p8/tZKmw6mCZMEOxVL3CK9r0ycwi6AFh1ahSIDFiOMhvgmIz1bwl64jBz?= =?us-ascii?Q?p+O8bZjRDNZE/kD6DwHJKD3ZmKzQXBJ+ePLoRmIFRu18O0iiIQtLp3JM57JZ?= =?us-ascii?Q?spgDTewEuO3IH0DMBgLHRreeIq9VnswORSWAy7tXBsNBCa35mDpLYJ75sXkD?= =?us-ascii?Q?3mDef+cUCM3zGQyb9DCLvMxwPZ+8XYDjRkxts6tRdGdQh/BeVwYufEiVg7Ci?= =?us-ascii?Q?GLsJfOsTRwE7nMW2TWJS0MBHtn9XuVIk6W7VUaM8hNF3BFEwVPWjaXfUg6HN?= =?us-ascii?Q?PkNwZNfWFxlxSNkh6VwywoW2V3H/DrDdjxP0u+I4pklvVLf/jUeA5bRRLecw?= =?us-ascii?Q?r0lff4lXEMM4BlAVTP8xQkGiYwtCUGv00/M5Vq9e9J+L4AyZSsE5/WdwCcVs?= =?us-ascii?Q?FfNfw9/WTQOy4xQWgpyQIL/GznuNXQw0QU5hfDu5ZivxtUbKKhc56bfpnYYL?= =?us-ascii?Q?VeWeDENL8mgXG4jEWPabRIp7du2TYrlQ6GB93LliE+kh63UCUyPI0fKbtKM2?= =?us-ascii?Q?DVx/aTqXUQ0bqFLm7VfVP6Qxyfb8kYkLMSo6gi1mvBl3/tpW9TvGCl8pMy/O?= =?us-ascii?Q?rCHf9VqRxNj7KPmbj986l4oaFskSnsm0993VT+ZPViO9WmqHkk7KND4mKgYA?= =?us-ascii?Q?8ypduYBblAQUyyapp8kxKT+yuYbAm4JS/8dK/E9cZAy7CfiPjolBmMjvUZ0V?= =?us-ascii?Q?s6jbCDB1JpeMxhFKtQDRTBgByOKN0SIYIiEWdsZvhPiepF6YYJ5k8nNGNIyT?= =?us-ascii?Q?LZTDlVWOyPe6MzCwXi4q0BP6ugcn+1uGPV9xLGfXBcCBYSvF9zltunSD5jWB?= =?us-ascii?Q?s4p82Ubd35+8EQYvIKaf/NHyAwn1DNIWVzEb6wTZqrkp3Lm2wx2468hmYNje?= =?us-ascii?Q?uFsln9+xXB65wh4wtelqY1T2BqvRMPJSv3ch464a7x7bVYSAKzvlWO2njI+/?= =?us-ascii?Q?hr8XFvKTrn7pyg6vsHzFo6jGScVY+7VJJm7Xv+MlnzCReOZLLbtvlTbN/BSH?= =?us-ascii?Q?w9UYSINsmXv0uyyQXsa4YSqCtQQJ65RFaWR+jTgiMomBNdoo/ozqQLUQ56Ct?= =?us-ascii?Q?uwyULW/tgnyhB620+h+n+ahQmuHfH8qO0mBH7kWGs5ck8hUwaNY3Thio9otE?= =?us-ascii?Q?V10M/WIf4y98Z88wnjJa24r9UnCghCFRgtNAPyjBc6QI1IKKFHY4kbWHYM2n?= =?us-ascii?Q?K+9oD7Hzj2yFLSs54q3eJSNIjsAlbHp2LMIKkFT50SOBofr1vcB4+EbdJgYW?= =?us-ascii?Q?2kxkWYEhkJ1Jrpmjx5L5G3G8Two=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: a94453e4-788a-4d52-16cb-08d9b69b2889 X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2021 20:26:17.2356 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ax04YpyCKa8/J5c6bMC8pauNiJPBOwaqLRZBqMjUCvCkZiyg9hIpj+tikPxVbfjNs8VgNdndwoMFWkli6ZjeM26IoKifa8UFXOHr8sAbRTg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3841 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=40.107.15.139; envelope-from=vsementsov@virtuozzo.com; helo=EUR01-DB5-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1638563345212100001 Content-Type: text/plain; charset="utf-8" Unfortunately not all filters use .file child as filtered child. Two exclusions are mirror_top and commit_top. Happily they both are private filters. Bad thing is that this inconsistency is observable through qmp commands query-block / query-named-block-nodes. So, could we just change mirror_top and commit_top to use file child as all other filter driver is an open question. Probably, we could do that with some kind of deprecation period, but how to warn users during it? For now, let's just add a field so we can distinguish them in generic code, it will be used in further commits. Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/block/block_int.h | 14 ++++++++++++++ block/commit.c | 1 + block/mirror.c | 1 + 3 files changed, 16 insertions(+) diff --git a/include/block/block_int.h b/include/block/block_int.h index f4c75e8ba9..9c06f8816e 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -117,6 +117,20 @@ struct BlockDriver { * (And this filtered child must then be bs->file or bs->backing.) */ bool is_filter; + + /* + * Only make sense for filter drivers, for others must be false. + * If true, filtered child is bs->backing. Otherwise it's bs->file. + * Only two internal filters use bs->backing as filtered child and has= this + * field set to true: mirror_top and commit_top. + * + * Never create any more such filters! + * + * TODO: imagine how to deprecate this behavior and make all filters w= ork + * similarly using bs->file as filtered child. + */ + bool filtered_child_is_backing; + /* * Set to true if the BlockDriver is a format driver. Format nodes * generally do not expect their children to be other format nodes diff --git a/block/commit.c b/block/commit.c index 10cc5ff451..23d60aebf4 100644 --- a/block/commit.c +++ b/block/commit.c @@ -237,6 +237,7 @@ static BlockDriver bdrv_commit_top =3D { .bdrv_child_perm =3D bdrv_commit_top_child_perm, =20 .is_filter =3D true, + .filtered_child_is_backing =3D true, }; =20 void commit_start(const char *job_id, BlockDriverState *bs, diff --git a/block/mirror.c b/block/mirror.c index efec2c7674..22e2b7b110 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -1587,6 +1587,7 @@ static BlockDriver bdrv_mirror_top =3D { .bdrv_child_perm =3D bdrv_mirror_top_child_perm, =20 .is_filter =3D true, + .filtered_child_is_backing =3D true, }; =20 static BlockJob *mirror_start_job( --=20 2.31.1 From nobody Thu May 16 17:05:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1638563645; cv=pass; d=zohomail.com; s=zohoarc; b=gRguAwL/YzgHi9uE9NHI4MP3laF/3osiG/k6KODsXwem36EkH01/1qjATXPa/BsLG4FOgMd4dPyvsuZDydc/aJysQPQSyT2mVSYkkhlpdle8Y9Nf6oPfKADUTD8Q8XYSVSgI/ewb1kbZeoJuyVo7caFmhPbPgshV50ZBAbt4fvA= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638563645; h=Content-Type: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; bh=LZPWIGAerzxn5KHBLmT+bIVXzg7sxl6k7Hk+9IS1jo8=; b=l76hnXwKl1I4zqDL2O7uKx70MaPCyL9FWPRCykm+WNxw5I672sQoMA8lNJ4PiCnmsJy9awUUziopNGiTFs1qkbz0ZyUQu+f3IyHBJyM6URsKnTofHOLODUjYCt6aCoEpe5V2PyX1L7WJIRygvsq8nJD1kH+5EoNLwVTWM6I3ua0= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1638563645143283.5698290336495; Fri, 3 Dec 2021 12:34:05 -0800 (PST) Received: from localhost ([::1]:48390 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mtFFq-0007nM-0r for importer@patchew.org; Fri, 03 Dec 2021 15:34:03 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57660) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mtF8o-0000pC-PO; Fri, 03 Dec 2021 15:26:46 -0500 Received: from mail-eopbgr150139.outbound.protection.outlook.com ([40.107.15.139]:14661 helo=EUR01-DB5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mtF8j-0001cv-L6; Fri, 03 Dec 2021 15:26:46 -0500 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by AM0PR08MB3841.eurprd08.prod.outlook.com (2603:10a6:208:106::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.22; Fri, 3 Dec 2021 20:26:18 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::2078:5a2:1898:d83a]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::2078:5a2:1898:d83a%7]) with mapi id 15.20.4669.024; Fri, 3 Dec 2021 20:26:18 +0000 Received: from kvm.ch-qa.sw.ru (130.117.225.5) by AM6PR10CA0086.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:8c::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.16 via Frontend Transport; Fri, 3 Dec 2021 20:26:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M+oqbECkkfhD5HGhzwvMn48SU8tM/anaUSEzCmymXOnhNSJ9Jf1yHKC5Y8LnN0JuMWtbgZjgX5m/gUcADfyrhlapIqwmD3J2mshf6m3n1F2mG125lzHHY8nkr9EwflrTrowT+cQl341OqAkOiAM5Gp3CWuLrxdnF/TvC7LaApIsRSMNb2fV51VWiIiCqOiTI0bqxYhas3lNWqrDAPOa/bzsvcJMBpQbNoDUFZLoM/P1SJN4xm5kDZ/iphw+TF4L6LcSI/zp5tXXhbH94rh4Bpa72euBl04eceAkozbdFCpMaC2lRqfhWGI0qSb0TjclZWqfxr7+/a8H2jRs4nleArw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=LZPWIGAerzxn5KHBLmT+bIVXzg7sxl6k7Hk+9IS1jo8=; b=WXQxWj7gypxA54ZBqtZxT8yIXQgpCQmgt81wXMtRPx1xuRGWqYWrlOVI2CGwPcZ6U8z01ig+R0UuTN2uDsEHUzmW3kxSbsOlj11mmdEHs1TZiGTsXosxN9HZ8SF8VQtFVges5oZsR4P3sqgJBmsxSIFGClPPJ1PW6gE+rUfqemm/2OzOFvb2BFdY49DGFiharQLDEnSjKaMYnzlUyKkQiFuPdiWgSfgMktOxRv47wG24nNjYSmwbZe2lkqJKg0mCCqu1fAdi2jyVrnTCKLGfBeFAm4LYqm4jmd9AE2hKk582hLvlszY6W0wVZIetkdBm6XTrAS5Qzc13D2eAOmHlSg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LZPWIGAerzxn5KHBLmT+bIVXzg7sxl6k7Hk+9IS1jo8=; b=NfzhPlA4BVkcaHDELG+8AKGek1+XLeX6RO6nN+X/BRmSlBIIyg66etVUSTRBY4PxVbBAv0rPnTDBoXSy8k6wamPsfRPPuHpGKcw1AEK+ebNkNJBtoe9EvYHw09BUxuFokSzZC4r1TPNQ0lVEiva26RV3P2BNcwF0txRLNCRISdc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, kwolf@redhat.com, hreitz@redhat.com, vsementsov@virtuozzo.com, Ari Sundholm , Pavel Dovgalyuk , Paolo Bonzini , Stefan Hajnoczi , John Snow , "Denis V. Lunev" , Wen Congyang , Xie Changlong , Stefan Weil , Jeff Cody , Fam Zheng Subject: [PATCH 02/14] block: introduce bdrv_open_file_child() helper Date: Fri, 3 Dec 2021 21:25:41 +0100 Message-Id: <20211203202553.3231580-3-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211203202553.3231580-1-vsementsov@virtuozzo.com> References: <20211203202553.3231580-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM6PR10CA0086.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:8c::27) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d8722c69-829a-45a8-85d7-08d9b69b294d X-MS-TrafficTypeDiagnostic: AM0PR08MB3841: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:431; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kmdXILhK/TK+mMU7NOx//SNONXzdQzqSqLLgBp+m3VfbpHUOMU4o4ynQHH3Ja+q7rEKwLmp/aMPwnNoYW6wtrmaJvi3af0T6k/68m62G8TvaG8k05RKIUAm/e5sZmsuxTTTBDmimvHRElus/swcuiJQ6xwGFY4ah0HI5yhwOIfx9yiVTzAPLKjnb/C+fGrFECcEGSpRVXQ6UPDqknZzPbzZ3zJlCVz/dxH5itB1g7tvk5sZWK5xtsuPXkVEyjImeVarLICSCbxkN2oB9bDFu80+FYvimM63LmMgQctia+5VFtbAtcv5ZeAvjE2KCOCM5ejQjsCzHzh7ekRHT7VD8awDwG81+iU8pjM31I0bqomGRU5en6XEXbAdHNxSfxekUn0YEBlItFd+32tH8UbRGJ1ZPc02lpiyrByza65ZP5RN3GB1hTzhvohmrU04XIAL2nxw2bxe0gr+5yrWTSBbGglnx1qE0ON0KqBASD7iEEUZ/sz4NPNO8GsMHNZUxu/wI8jz4jYs5StJeTQG37aZLF3CpOZtCjTjZHn/7Arkk8FIcDm2N5h+FEdjttiuGVxtw8RPFl/Wt+Ra4VLMrxtIe6cP9sbZXXxf7uNU3JzXXgV6mQOLIBrT+odTjPX4sm28fE0uOJFI/FBS9cJTGUd1Tnp1oT2wmJNSh78ugao7kKB89R3R6J/4i1eJSbnXfapTOyVaNU7EgubwNNYxRDntxvA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(186003)(86362001)(2906002)(2616005)(7416002)(54906003)(6506007)(6916009)(1076003)(66946007)(26005)(30864003)(36756003)(6666004)(66556008)(6512007)(52116002)(38100700002)(83380400001)(38350700002)(8936002)(8676002)(5660300002)(508600001)(4326008)(6486002)(316002)(956004)(66476007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?tgurNpzvOgZ+O4hl5u9TfaPcfusaOidpvKpc8JbTzN+iN6Z+q94d9GR7nyOJ?= =?us-ascii?Q?EpmwV2hhN4ikE19N/zvDjk8LyNG825GiYnltEOxEYc3fDBCW1EZNYUGC7CON?= =?us-ascii?Q?w9D01pbORBdIoQbW+uSt3gWklEu9mr0UPQC8204gB99o563gWQOGE9iJLvcJ?= =?us-ascii?Q?uCGMoK8V/Wx/b0VoRvaKzpc67QVgKWqZQN+ONjjRtTCg3NNThtvrN6r1N2Gd?= =?us-ascii?Q?gBshYpGUJuZmc/1blZjCaLEpHCBBTA6erDMpDAqFAz6nF6Mcp/mD5pQvpFWq?= =?us-ascii?Q?s7IfCyNPslG/O75BCPTQ9Ey/QOx0JiiIliN+ku2Gd5NbfT7L/NIUJQlQaTrT?= =?us-ascii?Q?MVjeFTAyIATBwjtczArTF/Gss1zqzYhuuANoZjgvGULPYC51io+BHay5hSSo?= =?us-ascii?Q?SCRsygxe3NkWshx3VGTCjd1/DAxu2FD7SZjI78+AIiTZ/qcIjr32vQFOGEoB?= =?us-ascii?Q?Sq41l7kS+NpQiJGRnJbaak62dyTAl055gl9dmRQRbez21E6V8A6ikXHmmZBG?= =?us-ascii?Q?kZEL3ccPJT8d2pEj5eL36Wb+OfKwWZf+ulIK3KfxA3BJ5QlfXnk6UCd6RVq6?= =?us-ascii?Q?5E8szMY6NL01mMZ0DU2DiZrCkPnQ4JTb44jo8z6shJ2nnubuL1N+9nlStAqF?= =?us-ascii?Q?3apRf9Vmkhnh5ge1bF2hT3Bg31fjYDWMeRs+4X1qhgcnH3Izem72laBCPa9/?= =?us-ascii?Q?UcvX2Q3xfuA7CpLnzPwlf5E956Q8zcD/kz4s3l3ii/36eoP7IgZjkFPokiKJ?= =?us-ascii?Q?1aiwoNXrsZZkqKWzDFtv/5XRsVvFkpASaUcT8A8SCLjzrfaHSce5KXRY8fOO?= =?us-ascii?Q?fvbM+Ujxn+mqqZKK9yw5qs9G3okPZ+Il+/sAsnjw9vw1H6VVDcVnC1Ay5tfr?= =?us-ascii?Q?sk6POlykvm62/J2IT7m4IzzFL2Upc3M8rxq9YkhO/Gd/KdO8NE+haW+9XaYu?= =?us-ascii?Q?qDY8WPHndQG4LqIDxPmFl9UrLRQFA8FN2ldbrBnJJ2ZpvncxeRV4eWCQVA0O?= =?us-ascii?Q?PemHZJBEisxtFDLnYUeFxOoP21LwCNggxGuBtpRiluJ9Z6AKwcQqjBfWZXOy?= =?us-ascii?Q?xPlKOX5BeBmwamkFK/zVVyQQf0InppLjBOtKKmuVCXNPY4tOCieLvbxfHtJR?= =?us-ascii?Q?Kqy2ttnrUEI3wqg3Vc+dAKuwnEJK53EFct3241YcSAYeJMCbPMT+4iXw3zAM?= =?us-ascii?Q?YAehcqBkFyLzqn+wpwe9uEVuuD87MU3TohubkumDJI2m/02QriosclmhGwMg?= =?us-ascii?Q?aCuPAkR/FrTxtajoyHnB5v+Eh3DJD+f7S5jZ5IyVQNB0fahVocNv2GFeQqvr?= =?us-ascii?Q?5XcI6xVAso48Gf72cc+ybMxEkD87QNPTsCFB89iWpgMpr4zA4niJDR2z4yfU?= =?us-ascii?Q?kT8uOnB0YFFaJfOoEy8hjmejWF2g8vR4zPMghQHOqO7Bs1ZR5acpj8MgG3kG?= =?us-ascii?Q?JedA6AGzvE8tFtRhkI3N4UynXNvT9eQU1rNBLIAub98R/UX3YOYcTc1Hlr46?= =?us-ascii?Q?0ct6ZSTP5hqFkCXE3GAdjjtgJbKk4zN2nW3D/ZE/3FVSZw+Yk9qUESy2WYVY?= =?us-ascii?Q?je0bHA4MSd/WrjDlpvo/I6eyodQ36Fa7X7LLczSbvFxbFgGD+2vQIquIPCsm?= =?us-ascii?Q?5+CkWseLMvri9mE7pGWTehlugaW8dsh9dEqP3ZNN1erIJNJ/aMYvC1bJbmCa?= =?us-ascii?Q?6NEbiA=3D=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: d8722c69-829a-45a8-85d7-08d9b69b294d X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2021 20:26:18.0490 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: jEqcsms+5C6GSikMPE+kCfCOnoVibulYwdgb8oj6H0IBFCdeRfT23jqYCtZnOYk3deOHFpr9Xxa/uEm3ep8ywGnGvsGLQYtLxhOIX9V5H1w= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3841 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=40.107.15.139; envelope-from=vsementsov@virtuozzo.com; helo=EUR01-DB5-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1638563647676100001 Content-Type: text/plain; charset="utf-8" Almost all drivers call bdrv_open_child() similarly. Let's create a helper for this. The only not updated driver that call bdrv_open_child() to set bs->file is raw-format, as it sometimes want to have filtered child but don't set drv->is_filter to true. Possibly we should implement drv->is_filter_func() handler, to consider raw-format as filter when it works as filter.. But it's another story. Note also, that we decrease assignments to bs->file in code: it helps us restrict modifying this field in further commit. Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/block/block.h | 3 +++ block.c | 21 +++++++++++++++++++++ block/blkdebug.c | 9 +++------ block/blklogwrites.c | 7 ++----- block/blkreplay.c | 7 ++----- block/blkverify.c | 9 +++------ block/bochs.c | 7 +++---- block/cloop.c | 7 +++---- block/copy-before-write.c | 9 ++++----- block/copy-on-read.c | 9 ++++----- block/crypto.c | 11 ++++++----- block/dmg.c | 7 +++---- block/filter-compress.c | 6 ++---- block/parallels.c | 7 +++---- block/preallocate.c | 9 ++++----- block/qcow.c | 6 ++---- block/qcow2.c | 8 ++++---- block/qed.c | 8 ++++---- block/replication.c | 8 +++----- block/throttle.c | 8 +++----- block/vdi.c | 7 +++---- block/vhdx.c | 7 +++---- block/vmdk.c | 7 +++---- block/vpc.c | 7 +++---- 24 files changed, 94 insertions(+), 100 deletions(-) diff --git a/include/block/block.h b/include/block/block.h index e5dd22b034..f885f113ef 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -376,6 +376,9 @@ BdrvChild *bdrv_open_child(const char *filename, const BdrvChildClass *child_class, BdrvChildRole child_role, bool allow_none, Error **errp); +int bdrv_open_file_child(const char *filename, + QDict *options, const char *bdref_key, + BlockDriverState *parent, Error **errp); BlockDriverState *bdrv_open_blockdev_ref(BlockdevRef *ref, Error **errp); int bdrv_set_backing_hd(BlockDriverState *bs, BlockDriverState *backing_hd, Error **errp); diff --git a/block.c b/block.c index 0ac5b163d2..a97720c5eb 100644 --- a/block.c +++ b/block.c @@ -3546,6 +3546,27 @@ BdrvChild *bdrv_open_child(const char *filename, errp); } =20 +/* + * Wrapper on bdrv_open_child() for most popular case: open primary child = of bs. + */ +int bdrv_open_file_child(const char *filename, + QDict *options, const char *bdref_key, + BlockDriverState *parent, Error **errp) +{ + BdrvChildRole role; + + /* commit_top and mirror_top don't use this function */ + assert(!parent->drv->filtered_child_is_backing); + + role =3D parent->drv->is_filter ? + (BDRV_CHILD_FILTERED | BDRV_CHILD_PRIMARY) : BDRV_CHILD_IMAGE; + + parent->file =3D bdrv_open_child(filename, options, bdref_key, parent, + &child_of_bds, role, false, errp); + + return parent->file ? 0 : -EINVAL; +} + /* * TODO Future callers may need to specify parent/child_class in order for * option inheritance to work. Existing callers use it for the root node. diff --git a/block/blkdebug.c b/block/blkdebug.c index bbf2948703..5fcfc8ac6f 100644 --- a/block/blkdebug.c +++ b/block/blkdebug.c @@ -503,12 +503,9 @@ static int blkdebug_open(BlockDriverState *bs, QDict *= options, int flags, } =20 /* Open the image file */ - bs->file =3D bdrv_open_child(qemu_opt_get(opts, "x-image"), options, "= image", - bs, &child_of_bds, - BDRV_CHILD_FILTERED | BDRV_CHILD_PRIMARY, - false, errp); - if (!bs->file) { - ret =3D -EINVAL; + ret =3D bdrv_open_file_child(qemu_opt_get(opts, "x-image"), options, "= image", + bs, errp); + if (ret < 0) { goto out; } =20 diff --git a/block/blklogwrites.c b/block/blklogwrites.c index f7a251e91f..f66a617eb3 100644 --- a/block/blklogwrites.c +++ b/block/blklogwrites.c @@ -155,11 +155,8 @@ static int blk_log_writes_open(BlockDriverState *bs, Q= Dict *options, int flags, } =20 /* Open the file */ - bs->file =3D bdrv_open_child(NULL, options, "file", bs, &child_of_bds, - BDRV_CHILD_FILTERED | BDRV_CHILD_PRIMARY, f= alse, - errp); - if (!bs->file) { - ret =3D -EINVAL; + ret =3D bdrv_open_file_child(NULL, options, "file", bs, errp); + if (ret < 0) { goto fail; } =20 diff --git a/block/blkreplay.c b/block/blkreplay.c index dcbe780ddb..76a0b8d12a 100644 --- a/block/blkreplay.c +++ b/block/blkreplay.c @@ -26,11 +26,8 @@ static int blkreplay_open(BlockDriverState *bs, QDict *o= ptions, int flags, int ret; =20 /* Open the image file */ - bs->file =3D bdrv_open_child(NULL, options, "image", bs, &child_of_bds, - BDRV_CHILD_FILTERED | BDRV_CHILD_PRIMARY, - false, errp); - if (!bs->file) { - ret =3D -EINVAL; + ret =3D bdrv_open_file_child(NULL, options, "image", bs, errp); + if (ret < 0) { goto fail; } =20 diff --git a/block/blkverify.c b/block/blkverify.c index d1facf5ba9..920e891684 100644 --- a/block/blkverify.c +++ b/block/blkverify.c @@ -121,12 +121,9 @@ static int blkverify_open(BlockDriverState *bs, QDict = *options, int flags, } =20 /* Open the raw file */ - bs->file =3D bdrv_open_child(qemu_opt_get(opts, "x-raw"), options, "ra= w", - bs, &child_of_bds, - BDRV_CHILD_FILTERED | BDRV_CHILD_PRIMARY, - false, errp); - if (!bs->file) { - ret =3D -EINVAL; + ret =3D bdrv_open_file_child(qemu_opt_get(opts, "x-raw"), options, "ra= w", + bs, errp); + if (ret < 0) { goto fail; } =20 diff --git a/block/bochs.c b/block/bochs.c index 4d68658087..b2dc06bbfd 100644 --- a/block/bochs.c +++ b/block/bochs.c @@ -110,10 +110,9 @@ static int bochs_open(BlockDriverState *bs, QDict *opt= ions, int flags, return ret; } =20 - bs->file =3D bdrv_open_child(NULL, options, "file", bs, &child_of_bds, - BDRV_CHILD_IMAGE, false, errp); - if (!bs->file) { - return -EINVAL; + ret =3D bdrv_open_file_child(NULL, options, "file", bs, errp); + if (ret < 0) { + return ret; } =20 ret =3D bdrv_pread(bs->file, 0, &bochs, sizeof(bochs)); diff --git a/block/cloop.c b/block/cloop.c index b8c6d0eccd..bee87da173 100644 --- a/block/cloop.c +++ b/block/cloop.c @@ -71,10 +71,9 @@ static int cloop_open(BlockDriverState *bs, QDict *optio= ns, int flags, return ret; } =20 - bs->file =3D bdrv_open_child(NULL, options, "file", bs, &child_of_bds, - BDRV_CHILD_IMAGE, false, errp); - if (!bs->file) { - return -EINVAL; + ret =3D bdrv_open_file_child(NULL, options, "file", bs, errp); + if (ret < 0) { + return ret; } =20 /* read header */ diff --git a/block/copy-before-write.c b/block/copy-before-write.c index c30a5ff8de..8aa2cb6a85 100644 --- a/block/copy-before-write.c +++ b/block/copy-before-write.c @@ -150,12 +150,11 @@ static int cbw_open(BlockDriverState *bs, QDict *opti= ons, int flags, { BDRVCopyBeforeWriteState *s =3D bs->opaque; BdrvDirtyBitmap *copy_bitmap; + int ret; =20 - bs->file =3D bdrv_open_child(NULL, options, "file", bs, &child_of_bds, - BDRV_CHILD_FILTERED | BDRV_CHILD_PRIMARY, - false, errp); - if (!bs->file) { - return -EINVAL; + ret =3D bdrv_open_file_child(NULL, options, "file", bs, errp); + if (ret < 0) { + return ret; } =20 s->target =3D bdrv_open_child(NULL, options, "target", bs, &child_of_b= ds, diff --git a/block/copy-on-read.c b/block/copy-on-read.c index 1fc7fb3333..815ac1d835 100644 --- a/block/copy-on-read.c +++ b/block/copy-on-read.c @@ -41,12 +41,11 @@ static int cor_open(BlockDriverState *bs, QDict *option= s, int flags, BDRVStateCOR *state =3D bs->opaque; /* Find a bottom node name, if any */ const char *bottom_node =3D qdict_get_try_str(options, "bottom"); + int ret; =20 - bs->file =3D bdrv_open_child(NULL, options, "file", bs, &child_of_bds, - BDRV_CHILD_FILTERED | BDRV_CHILD_PRIMARY, - false, errp); - if (!bs->file) { - return -EINVAL; + ret =3D bdrv_open_file_child(NULL, options, "file", bs, errp); + if (ret < 0) { + return ret; } =20 bs->supported_read_flags =3D BDRV_REQ_PREFETCH; diff --git a/block/crypto.c b/block/crypto.c index c8ba4681e2..abfce39230 100644 --- a/block/crypto.c +++ b/block/crypto.c @@ -260,15 +260,14 @@ static int block_crypto_open_generic(QCryptoBlockForm= at format, { BlockCrypto *crypto =3D bs->opaque; QemuOpts *opts =3D NULL; - int ret =3D -EINVAL; + int ret; QCryptoBlockOpenOptions *open_opts =3D NULL; unsigned int cflags =3D 0; QDict *cryptoopts =3D NULL; =20 - bs->file =3D bdrv_open_child(NULL, options, "file", bs, &child_of_bds, - BDRV_CHILD_IMAGE, false, errp); - if (!bs->file) { - return -EINVAL; + ret =3D bdrv_open_file_child(NULL, options, "file", bs, errp); + if (ret < 0) { + return ret; } =20 bs->supported_write_flags =3D BDRV_REQ_FUA & @@ -276,6 +275,7 @@ static int block_crypto_open_generic(QCryptoBlockFormat= format, =20 opts =3D qemu_opts_create(opts_spec, NULL, 0, &error_abort); if (!qemu_opts_absorb_qdict(opts, options, errp)) { + ret =3D -EINVAL; goto cleanup; } =20 @@ -284,6 +284,7 @@ static int block_crypto_open_generic(QCryptoBlockFormat= format, =20 open_opts =3D block_crypto_open_opts_init(cryptoopts, errp); if (!open_opts) { + ret =3D -EINVAL; goto cleanup; } =20 diff --git a/block/dmg.c b/block/dmg.c index 447901fbb8..38c363dd39 100644 --- a/block/dmg.c +++ b/block/dmg.c @@ -439,10 +439,9 @@ static int dmg_open(BlockDriverState *bs, QDict *optio= ns, int flags, return ret; } =20 - bs->file =3D bdrv_open_child(NULL, options, "file", bs, &child_of_bds, - BDRV_CHILD_IMAGE, false, errp); - if (!bs->file) { - return -EINVAL; + ret =3D bdrv_open_file_child(NULL, options, "file", bs, errp); + if (ret < 0) { + return ret; } =20 block_module_load_one("dmg-bz2"); diff --git a/block/filter-compress.c b/block/filter-compress.c index d5be538619..b2cfa9a9a5 100644 --- a/block/filter-compress.c +++ b/block/filter-compress.c @@ -30,10 +30,8 @@ static int compress_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { - bs->file =3D bdrv_open_child(NULL, options, "file", bs, &child_of_bds, - BDRV_CHILD_FILTERED | BDRV_CHILD_PRIMARY, - false, errp); - if (!bs->file) { + int ret =3D bdrv_open_file_child(NULL, options, "file", bs, errp); + if (ret < 0) { return -EINVAL; } =20 diff --git a/block/parallels.c b/block/parallels.c index 6ebad2a2bb..ed4debd899 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -735,10 +735,9 @@ static int parallels_open(BlockDriverState *bs, QDict = *options, int flags, Error *local_err =3D NULL; char *buf; =20 - bs->file =3D bdrv_open_child(NULL, options, "file", bs, &child_of_bds, - BDRV_CHILD_IMAGE, false, errp); - if (!bs->file) { - return -EINVAL; + ret =3D bdrv_open_file_child(NULL, options, "file", bs, errp); + if (ret < 0) { + return ret; } =20 ret =3D bdrv_pread(bs->file, 0, &ph, sizeof(ph)); diff --git a/block/preallocate.c b/block/preallocate.c index 1d4233f730..332408bdc9 100644 --- a/block/preallocate.c +++ b/block/preallocate.c @@ -134,6 +134,7 @@ static int preallocate_open(BlockDriverState *bs, QDict= *options, int flags, Error **errp) { BDRVPreallocateState *s =3D bs->opaque; + int ret; =20 /* * s->data_end and friends should be initialized on permission update. @@ -141,11 +142,9 @@ static int preallocate_open(BlockDriverState *bs, QDic= t *options, int flags, */ s->file_end =3D s->zero_start =3D s->data_end =3D -EINVAL; =20 - bs->file =3D bdrv_open_child(NULL, options, "file", bs, &child_of_bds, - BDRV_CHILD_FILTERED | BDRV_CHILD_PRIMARY, - false, errp); - if (!bs->file) { - return -EINVAL; + ret =3D bdrv_open_file_child(NULL, options, "file", bs, errp); + if (ret < 0) { + return ret; } =20 if (!preallocate_absorb_opts(&s->opts, options, bs->file->bs, errp)) { diff --git a/block/qcow.c b/block/qcow.c index c39940f33e..544a17261f 100644 --- a/block/qcow.c +++ b/block/qcow.c @@ -120,10 +120,8 @@ static int qcow_open(BlockDriverState *bs, QDict *opti= ons, int flags, qdict_extract_subqdict(options, &encryptopts, "encrypt."); encryptfmt =3D qdict_get_try_str(encryptopts, "format"); =20 - bs->file =3D bdrv_open_child(NULL, options, "file", bs, &child_of_bds, - BDRV_CHILD_IMAGE, false, errp); - if (!bs->file) { - ret =3D -EINVAL; + ret =3D bdrv_open_file_child(NULL, options, "file", bs, errp); + if (ret < 0) { goto fail; } =20 diff --git a/block/qcow2.c b/block/qcow2.c index d509016756..99715c498a 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -1890,11 +1890,11 @@ static int qcow2_open(BlockDriverState *bs, QDict *= options, int flags, .errp =3D errp, .ret =3D -EINPROGRESS }; + int ret; =20 - bs->file =3D bdrv_open_child(NULL, options, "file", bs, &child_of_bds, - BDRV_CHILD_IMAGE, false, errp); - if (!bs->file) { - return -EINVAL; + ret =3D bdrv_open_file_child(NULL, options, "file", bs, errp); + if (ret < 0) { + return ret; } =20 /* Initialise locks */ diff --git a/block/qed.c b/block/qed.c index 558d3646c4..e3b06a3d00 100644 --- a/block/qed.c +++ b/block/qed.c @@ -558,11 +558,11 @@ static int bdrv_qed_open(BlockDriverState *bs, QDict = *options, int flags, .errp =3D errp, .ret =3D -EINPROGRESS }; + int ret; =20 - bs->file =3D bdrv_open_child(NULL, options, "file", bs, &child_of_bds, - BDRV_CHILD_IMAGE, false, errp); - if (!bs->file) { - return -EINVAL; + ret =3D bdrv_open_file_child(NULL, options, "file", bs, errp); + if (ret < 0) { + return ret; } =20 bdrv_qed_init_state(bs); diff --git a/block/replication.c b/block/replication.c index 55c8f894aa..2f17397764 100644 --- a/block/replication.c +++ b/block/replication.c @@ -88,11 +88,9 @@ static int replication_open(BlockDriverState *bs, QDict = *options, const char *mode; const char *top_id; =20 - bs->file =3D bdrv_open_child(NULL, options, "file", bs, &child_of_bds, - BDRV_CHILD_FILTERED | BDRV_CHILD_PRIMARY, - false, errp); - if (!bs->file) { - return -EINVAL; + ret =3D bdrv_open_file_child(NULL, options, "file", bs, errp); + if (ret < 0) { + return ret; } =20 ret =3D -EINVAL; diff --git a/block/throttle.c b/block/throttle.c index 6e8d52fa24..4fb5798c27 100644 --- a/block/throttle.c +++ b/block/throttle.c @@ -78,11 +78,9 @@ static int throttle_open(BlockDriverState *bs, QDict *op= tions, char *group; int ret; =20 - bs->file =3D bdrv_open_child(NULL, options, "file", bs, &child_of_bds, - BDRV_CHILD_FILTERED | BDRV_CHILD_PRIMARY, - false, errp); - if (!bs->file) { - return -EINVAL; + ret =3D bdrv_open_file_child(NULL, options, "file", bs, errp); + if (ret < 0) { + return ret; } bs->supported_write_flags =3D bs->file->bs->supported_write_flags | BDRV_REQ_WRITE_UNCHANGED; diff --git a/block/vdi.c b/block/vdi.c index bdc58d726e..c50c0ed61f 100644 --- a/block/vdi.c +++ b/block/vdi.c @@ -376,10 +376,9 @@ static int vdi_open(BlockDriverState *bs, QDict *optio= ns, int flags, int ret; QemuUUID uuid_link, uuid_parent; =20 - bs->file =3D bdrv_open_child(NULL, options, "file", bs, &child_of_bds, - BDRV_CHILD_IMAGE, false, errp); - if (!bs->file) { - return -EINVAL; + ret =3D bdrv_open_file_child(NULL, options, "file", bs, errp); + if (ret < 0) { + return ret; } =20 logout("\n"); diff --git a/block/vhdx.c b/block/vhdx.c index 356ec4c455..e7d6d7509a 100644 --- a/block/vhdx.c +++ b/block/vhdx.c @@ -996,10 +996,9 @@ static int vhdx_open(BlockDriverState *bs, QDict *opti= ons, int flags, uint64_t signature; Error *local_err =3D NULL; =20 - bs->file =3D bdrv_open_child(NULL, options, "file", bs, &child_of_bds, - BDRV_CHILD_IMAGE, false, errp); - if (!bs->file) { - return -EINVAL; + ret =3D bdrv_open_file_child(NULL, options, "file", bs, errp); + if (ret < 0) { + return ret; } =20 s->bat =3D NULL; diff --git a/block/vmdk.c b/block/vmdk.c index 0dfab6e941..7d7e56b36c 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -1262,10 +1262,9 @@ static int vmdk_open(BlockDriverState *bs, QDict *op= tions, int flags, BDRVVmdkState *s =3D bs->opaque; uint32_t magic; =20 - bs->file =3D bdrv_open_child(NULL, options, "file", bs, &child_of_bds, - BDRV_CHILD_IMAGE, false, errp); - if (!bs->file) { - return -EINVAL; + ret =3D bdrv_open_file_child(NULL, options, "file", bs, errp); + if (ret < 0) { + return ret; } =20 buf =3D vmdk_read_desc(bs->file, 0, errp); diff --git a/block/vpc.c b/block/vpc.c index 297a26262a..430cab1cbb 100644 --- a/block/vpc.c +++ b/block/vpc.c @@ -232,10 +232,9 @@ static int vpc_open(BlockDriverState *bs, QDict *optio= ns, int flags, int ret; int64_t bs_size; =20 - bs->file =3D bdrv_open_child(NULL, options, "file", bs, &child_of_bds, - BDRV_CHILD_IMAGE, false, errp); - if (!bs->file) { - return -EINVAL; + ret =3D bdrv_open_file_child(NULL, options, "file", bs, errp); + if (ret < 0) { + return ret; } =20 opts =3D qemu_opts_create(&vpc_runtime_opts, NULL, 0, &error_abort); --=20 2.31.1 From nobody Thu May 16 17:05:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1638563640; cv=pass; d=zohomail.com; s=zohoarc; b=QD6+M9YaG+lBfbfj1PJh42rVgqAB++dMM2YVCiVKGG6lyldYR0sBzp529hiW5KXnAV1g3vAiKYyteqN/lVCIyzSkAmoJvcPbfoKEoHCCsskUhJWyVzYEDmkaob4tlqs5BoVnO6Qky3NTaCrj4yZvGc9SntRrj+j+Avdymllx3aA= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638563640; h=Content-Type: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; bh=dOr0HWuR3O0+5qlixqfI+5w2UMg5tnLevoDOA0CQUOg=; b=TuYpCRmi0JVKOwp2d5/h9futOg9x0YxLSxCRosz/4wkXI8EXwsyh80dzA9R438K3wUzD6Ih2OiYNitnQ0p8NhnAQNK/MzIYhH9j9csJz7v9XAs2HLnq/s/f64+iHAv0q/KxQIgHiBtrco+X8uJthAxrys4Pwv3DSsFkW7RKZszw= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1638563640407710.8550807558659; Fri, 3 Dec 2021 12:34:00 -0800 (PST) Received: from localhost ([::1]:48252 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mtFFn-0007hR-8C for importer@patchew.org; Fri, 03 Dec 2021 15:33:59 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57674) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mtF8p-0000qb-Dt; Fri, 03 Dec 2021 15:26:48 -0500 Received: from mail-eopbgr150132.outbound.protection.outlook.com ([40.107.15.132]:11453 helo=EUR01-DB5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mtF8k-0001bp-Rc; Fri, 03 Dec 2021 15:26:47 -0500 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by AM0PR08MB3841.eurprd08.prod.outlook.com (2603:10a6:208:106::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.22; Fri, 3 Dec 2021 20:26:19 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::2078:5a2:1898:d83a]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::2078:5a2:1898:d83a%7]) with mapi id 15.20.4669.024; Fri, 3 Dec 2021 20:26:18 +0000 Received: from kvm.ch-qa.sw.ru (130.117.225.5) by AM6PR10CA0086.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:8c::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.16 via Frontend Transport; Fri, 3 Dec 2021 20:26:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GuI1lZbjICSiu0nJutufwAz61UlwbTGO9n7QhFSp6SeKuPCUWex5TS8wZUW++fcjJCWCEIuuHTLapVG0E8rewiYcOHRwDIb5M5qqsP67nKP6aunpLbpAbnWdYnF0hf9MNYnJoKZ/0VJqvIOhZfbmyraPNV1wL3sCnnTS4HDWDspaaU+KSMOH39nvNPdhbUJuxeAK4FVL3P0pyQx9cyx9+b8/Z/EjnrY51h0yowWIPITiNFGh9LZ6wMvuxi//bBjTybmtT7U2j0lnVcvb1yRJzL7KwJptDx+r1M3P3Uv3oaFBTaNGXvyvnJLVHJWXuyXeqy6/pzxUgBt+EZeAI0binw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=dOr0HWuR3O0+5qlixqfI+5w2UMg5tnLevoDOA0CQUOg=; b=mQnNnCakZSx7J/QagspPMdVVo8UVa3EPP9js8oJ/7S8DT59xe+qZjXx/TukPs2c9zPWkRF+XEMj12kJ0mDXhNJdSaljSDHXdv+NsIYJMRWQ4u7KXHVuyxDDfEQvsCf5aEWGPicB3ZMjXeJKEn3hAm8MwZf7N/NUqtwkfDWt/MIpM45IRv23UnjhKgKQnlZzJgcSeMpkbCRlnukhkViu/uGTI92cVUp+M0FKf9zhrtnjgAU4He9JzSRk0y2b0iXOpvkvu29Bi/cOtzneiM+hO8yXoov6p0yP1Vuwn8y0T6ubMM/nZ0ihM1ezojk0Oo6nxBHDP8SFeKclueoaCp0P3qw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dOr0HWuR3O0+5qlixqfI+5w2UMg5tnLevoDOA0CQUOg=; b=YwBJJiSjnnrBQ86i/fJZ0MQCv21ZP54GSDo9HC+hjT9dommKZPbYrl1sNZbi1Hat+FbKEqPu2NxSSB7cazCz5u761+SHUvDPZLTOY1+PiiLIeUIaQF2FEEQOtLVdXot1o8V5b3cf7n4vBTA+Zu5yDQ/9MwRnJBmHR176h+KCgl0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, kwolf@redhat.com, hreitz@redhat.com, vsementsov@virtuozzo.com, Ari Sundholm Subject: [PATCH 03/14] block/blklogwrites: don't care to remove bs->file child on failure Date: Fri, 3 Dec 2021 21:25:42 +0100 Message-Id: <20211203202553.3231580-4-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211203202553.3231580-1-vsementsov@virtuozzo.com> References: <20211203202553.3231580-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM6PR10CA0086.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:8c::27) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bc1e384f-b78d-4d8f-78c3-08d9b69b29a0 X-MS-TrafficTypeDiagnostic: AM0PR08MB3841: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:288; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TAA19pqxRrR0ZNBliqhsj/3uOp6GSkLcS/geW7OLY92jvVgegPmZR3TFZmD5gXkbptODVfOZOhCaCB4i7e9RunSIz+rS+c/AlXhQcxlShO9mZNggXK2DGcD9zBD+BI0ZVrJF3CGDsc7GXPsSjypFAcSV65pJVjnDnouzIR1RmkHqv8zESzUCukVorGoZ82dV27fjygYQQL0QHZsh0HgCuUhmwEjsmG7vxdKDgZtsMg3wkwsUd6M+jcqC7+8xXUOdsqdx19u5sEesEae80/8Jby1LlGVm0b91tR59KQqrCC71jNDjmkAH7EpU5eNjN0vHinnQJERUA7bTtUQ3wfDglSxZlCGlwwgsF3zEma5hqu+yqzpTIoxPMFAZDKmcPTCOE7jxMxRy2/13D9LO6LuIK6QN5GXd9To90/FA7t1Y++R9GjxaOOhWm4/sw6ht1/pMrU6QbYUWnuF6OUO1IVd3LqLkfF3lf4gsvuyGEPTI+C9G8gjzHzPESSS9he0uUAll4bk7EVS4NGB/tW3vwRvGhYSZFMgzHqoINGP79WQ7NtbfJ2QN1qoJXT+hE47BM/HhcezjqU2OUDl47NiNpnqbBxMxvKWYAjYqegpWQcwEnfsQ6pdStvDjuHFS5wbsSXL50bOU2RtouPKA6rL35jQ2nxvnvIqa+8EonnvwaeOfI9CKlFzf9DheK4MT4QpJ0xm78qQCB4jNH/Zrc8xUIv0WZA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(186003)(86362001)(2906002)(2616005)(6506007)(6916009)(1076003)(66946007)(26005)(36756003)(6666004)(66556008)(6512007)(52116002)(38100700002)(4744005)(83380400001)(38350700002)(8936002)(8676002)(5660300002)(508600001)(4326008)(6486002)(316002)(956004)(66476007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?pIwfIA2Ysg/xBN4quk7juRwgmS1/k1m/5kotxFJlqJkPSZsRSZl8grVWrLEC?= =?us-ascii?Q?asg1reNwfupX1OQexv3YcFeWqWV/drQEdj8NAW+HutjlgSfgYGade7grUlqZ?= =?us-ascii?Q?Nrk6LeGwD+BoWTRXMjOhdPcBzVYjNw+vagNGP4VwnTkh8jxWX7pwjrxuzJ+h?= =?us-ascii?Q?/i0iRDn187wwTHxyfa+KVR5Tr2qvTtBD/S1WtqVBy/r2ZxKn6sFCTAwEUcG/?= =?us-ascii?Q?CsbrApcfJ+YtYpF3Jn0n6m7yYaGiUmIn5J9ojAfMm33bx3C9D4cf3bRD4j+d?= =?us-ascii?Q?VShRgeEqAizpcdP/T+Zy3x2bq7p8pvzuN2xc8uvvl/8S/TAy++sZDgx2f1gj?= =?us-ascii?Q?0c8aFEy5UGo9fYeVdrlY5OFGKOWN0ViktThialceJiYnHoDA90TSEbxtEeut?= =?us-ascii?Q?2yUlnnwsJdL3OYqMg011YdQ0EepTXh6faKwNp9ydfIK7NDutBm8Y36HhSVqP?= =?us-ascii?Q?u6Bo1tsFXShgd+l4bDsDbBBvPoB+OI79nUB8jcnyJpS10zYI+B+sZ+kQ4rE2?= =?us-ascii?Q?znf+nXfNaMUj5CDZ3m08rmReKrMduSYAXG3sAHj+pSlKtcxST1QnDYGxRKHS?= =?us-ascii?Q?melFp1Dp+L7hDJTZ79QYyZ4PV7yw6atlnA7UN6LbU0ko+YFbHAjNBNhG0NVf?= =?us-ascii?Q?X1W4K8GX7S5sod7Ef2sDMf658BA0NNaikY2w+0tVyrw8e5KxN31d9F5C/RKK?= =?us-ascii?Q?Lc34OebWbBfbbuDG8K6ZzxWKs7oynnFI/gHUaM06mz29dYaylFx/ROmXrFDK?= =?us-ascii?Q?r49pTzWhBT6BCjyROBJBVRnHl2jcpskwOqMfYwEfLfLq2z2WmVk1zXolzh62?= =?us-ascii?Q?5xiob3wDS6uRV7cNHy+dq1ebFfJvSHp2dvISS1MnFIc8m/erEdG5pc63Oy+L?= =?us-ascii?Q?oyFKalSz70Ir8KC/lgQ+sWob47ypRbFziFI9RJhXAIV/HIgzSVjgVg+OFYDi?= =?us-ascii?Q?s8CwsXlSFRvvwAm5J3vlvE0+i9GMvEuMCljW8RrO7V6yySsexiHN2oSshi5s?= =?us-ascii?Q?1EdCc8WienyjaIf+jl8ORnEez5iBFrccT2yCTtFXVS6XSKCeVuW9sRaLxg7K?= =?us-ascii?Q?9698XKzU5RxHhZiti1eZimDh7+9lrohgCmIIoiGZ1IoPxvHTfYBPCmJ+YPP2?= =?us-ascii?Q?ctNcT3qSg64VvcZ86RPrCfqrTtDKAASaBB6aNr9ypoK8QxB93VszqdHlx2w9?= =?us-ascii?Q?8v80MGaZKliM1YXrwB7nnS3cDFvgjp1Wu71IOaF5M+4GDH27eswNik0tbQ6a?= =?us-ascii?Q?DWKWDdle5ADjF/n6qPU6h61ahxm6T90d9SOFuT6PlpMhO8XNmh+GPbD+jDfG?= =?us-ascii?Q?sk9Wddfi1PFjLob9WiLcr9sJ8LRyj7PMrWrKEOD6+ZG6jeO4GKN98oM318H9?= =?us-ascii?Q?ZVE3KGEBHPQymtlRabMoY8iBOgvpOf6ZVnG/D/K4RJ3woZmpwU1wYCkVQSGx?= =?us-ascii?Q?vnCiRr3G4Mkw0rjgm/mPUeYZR/8FBb5C661tRxJ3jxNAMwNo0ZGxhexsrg/z?= =?us-ascii?Q?zsgsyU273UocPrSkfqq/zsoccAAdCz/Mx6FRB//Hc2J8dkDmTpPh+5Yvw/N4?= =?us-ascii?Q?3/dtjNjOwWb3ktiJIj1CZx6mZc0fpFZi0f0QVD+8TvbxD3yjuRMixRBsGEcO?= =?us-ascii?Q?PAHJ4rHZuxcYTecmC0Q/WKLZaGJQYY7q9TMMIqBuFaacGaEDF7Z6ZaocGSMp?= =?us-ascii?Q?6Rse3Q=3D=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: bc1e384f-b78d-4d8f-78c3-08d9b69b29a0 X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2021 20:26:18.6076 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: nL7+MOE6GNS/buib8GBN7obtC4c214IUcP3MUtChkO+77CKhvvRIFlG/zQLOS6b4opRbK2G4fvP8tF2Pf1+mycpzt2VuUj7ILd0BQEyUc34= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3841 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=40.107.15.132; envelope-from=vsementsov@virtuozzo.com; helo=EUR01-DB5-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1638563641956100001 Content-Type: text/plain; charset="utf-8" We don't need to remove bs->file, generic layer takes care of it. No other driver cares to remove bs->file on failure by hand. Signed-off-by: Vladimir Sementsov-Ogievskiy --- block/blklogwrites.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/block/blklogwrites.c b/block/blklogwrites.c index f66a617eb3..7d25df97cc 100644 --- a/block/blklogwrites.c +++ b/block/blklogwrites.c @@ -254,10 +254,6 @@ fail_log: s->log_file =3D NULL; } fail: - if (ret < 0) { - bdrv_unref_child(bs, bs->file); - bs->file =3D NULL; - } qemu_opts_del(opts); return ret; } --=20 2.31.1 From nobody Thu May 16 17:05:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1638563728; cv=pass; d=zohomail.com; s=zohoarc; b=VAOnJtTobSfSKFx0OuKIyyA6VnlnjCIJSTC3vBL1DmhR6GSFnqLhe5FtvKyH6MqRkJhNCN5jpAOXY6ug6wQYwpgsJumrEI9XWR0JxYq5+9JP29axes9cJQJvosft/ejICCNCVTMjYFzygjixcZCwj7Gh5IQmhKah0vyqNZX+zOs= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638563728; h=Content-Type: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; bh=ru2Qyekc23yNTSSZ7f+D4q9vcp3smdZW3BCxktVLiMU=; b=h7WhRoeURO7eXkQ8hwl6z2PGyJpOkGNDzBVoGVJKrKhMAtYbKOf2FvbInju3gJ8OjPSvubM/cx15Nl3oyCTnuiHkT67GtO4t1u6mRG/QE4iQCSFR+jdWRuwTXf056i9ioX/L2yL0IEe52OMrV5FcH6QOcL+IBsftw+3brCNI4L4= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1638563728448355.3300291538915; Fri, 3 Dec 2021 12:35:28 -0800 (PST) Received: from localhost ([::1]:51362 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mtFHD-0001LB-Co for importer@patchew.org; Fri, 03 Dec 2021 15:35:27 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57716) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mtF8s-0000uj-5C; Fri, 03 Dec 2021 15:26:50 -0500 Received: from mail-eopbgr150139.outbound.protection.outlook.com ([40.107.15.139]:14661 helo=EUR01-DB5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mtF8p-0001cv-Bw; Fri, 03 Dec 2021 15:26:49 -0500 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by AM0PR08MB3841.eurprd08.prod.outlook.com (2603:10a6:208:106::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.22; Fri, 3 Dec 2021 20:26:20 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::2078:5a2:1898:d83a]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::2078:5a2:1898:d83a%7]) with mapi id 15.20.4669.024; Fri, 3 Dec 2021 20:26:19 +0000 Received: from kvm.ch-qa.sw.ru (130.117.225.5) by AM6PR10CA0086.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:8c::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.16 via Frontend Transport; Fri, 3 Dec 2021 20:26:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=A1tuwxQ0mTDEu5jvvoSA8wvLsSbKKqOsgGPqxl42vogGcc41X5+eDLRFqsWxDyjrsdKGQKkgrOTZQxUJfPkWhWWeyjiTafGUiMaRcS03UM/1PPxvl5Kpx4dgMJdCVcGMBydeEapHPSvY+8eVHdZfKLCB2tbSStra2V4TEaftoNGjyVno7ncHWAVADNO2nVnX9IrhRHbBGlop7iksJP2dvX+ECqwiOb3Svgs45LDDZSJEtC14dPk365D5L7bvQDbSK84Bk70V3yPsQ/FPXr/oiwpISiEql0fvZ3zx29266HDWRA3N8b4fnb89M9ja5YaI8LTldx6wD2KmFNR7YEf0jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ru2Qyekc23yNTSSZ7f+D4q9vcp3smdZW3BCxktVLiMU=; b=FFCeMP2cM1dIHkkmHXvVwtvHP3VnHVMhJ3oSv7KhtlLzEUB6QK0bngQJG8eV7tzOPtXjqUpfwQJQ+Bz6YSIRhvttrEV64jCvghIeAhMsVKPQSgzWSF7KZ6MDj9WrLYkA9AphDbvENEA5qROkcqiAEg7AtwDDILKVebuIxdqpJ/lnOPzREGAFMpB1Qx2UvVWVzyM4M5wjOZae0D/YaWuQVEDqyd8USq9+aJQMrC0F2rfkd000V7UMZNTv10BYo9mwZAi5D6Tnto1bMkewWcXDE0NjzewRbZ48geb1Ik6zwuT+YiZo3nmMy/HNHiy/a2e6+ecdjYgVmBbMwNZeSq5ZsQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ru2Qyekc23yNTSSZ7f+D4q9vcp3smdZW3BCxktVLiMU=; b=C6SsBQD/oZr1loYorjEMDpBvv6926RIxz1fz1/Js4CztGtBSMeSAYcbpN8HdC2afIE9q2dorRZSy2mC7DsVO5jwxwWLOfaZhjT37quZUFM6d1EiLrab39/jfqSL5BEvdX/DLWm6EKgpGvr1OzUJJMONs5Vr2zUV2Jt4jXygTDK8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, kwolf@redhat.com, hreitz@redhat.com, vsementsov@virtuozzo.com, Alberto Garcia , Eric Blake , Paolo Bonzini Subject: [PATCH 04/14] test-bdrv-graph-mod: update test_parallel_perm_update test case Date: Fri, 3 Dec 2021 21:25:43 +0100 Message-Id: <20211203202553.3231580-5-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211203202553.3231580-1-vsementsov@virtuozzo.com> References: <20211203202553.3231580-1-vsementsov@virtuozzo.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM6PR10CA0086.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:8c::27) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 05cef809-91fa-452c-6a87-08d9b69b2a2a X-MS-TrafficTypeDiagnostic: AM0PR08MB3841: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3276; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: U6NvLSbLUE2HEv11V8w3lAUTg70aLbCX8rTXNnmsMCI1RMdesTr+F5H/tv8yTq0UY5RN2cXA3zwwBMIz/jWIHZffcY2yqjr+RyFTKd8OtTxq/8pdVOabNbMq6GGZbMgMzOipj8pyLE0IEIzdHKHwLaTnzV8OAjyWpRmwJvpkeHLpXPs2WxTOvork89NhWFczlyF3TgVHpSCzGkDFlTB3LUiWstgZGEdECR2yR1vcWhclSvbBNtOji8TwCix6GXJPyJuAoh/ks/r/+BWIvHx3bzGwJlGYKK8xSJ8yznpaXzeDGTaocEEqdCgrO63nawPISklln/xvPoFiLLOtg4K84+0k9LGP6EdRuVAwpFlUXaSE5linaKlIJFymGqScmivhmG0ZxIQMJDlBYI+beYK1U9AXG09j372+bM4SqGIsUFIOeRKXFslMbDhOerSakBgUYWR6dn6y/CFMaUhPZkgXRos+b4t7qZNVlkzdcS2fsXZSR++iQAoaA/RFID35f7vKYzJTFayixUBde25NEjhkxNRORYlBOeT61E4JUwVCEFSmexdm3aNmkN91x+pD+faeJRpLJRp7i/SwtAVtatzRSXyK/GJmNKukZnbukgA2ooDfXAY8NqXRzm6ot1NguuQ14no7Ut5dsODmgKnI3QDikz206rG2F9+JqxNGnbAhoj2CK0nEPr9s8bIaja4UQRwKZFolCRgvC/TY2onxFRXxnQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(186003)(86362001)(2906002)(15650500001)(2616005)(54906003)(6506007)(6916009)(1076003)(66946007)(26005)(36756003)(6666004)(66556008)(6512007)(52116002)(38100700002)(83380400001)(38350700002)(8936002)(8676002)(5660300002)(508600001)(4326008)(6486002)(316002)(956004)(66476007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?R1MzdVYvTE10SjE0cnc0RjRTVURRZVNCdGxNVGhNVmtkMlUzeUFBMEN2aUZX?= =?utf-8?B?Y1E0cXY0cVFWY0loTW9PdURVRVEvTVppeDc1MmRucythLy9wbWRNMDZqQzBC?= =?utf-8?B?NTd1ejhIUitkaGROQ2FzTGIzUk9aVlM1clM0dU9GTjh1aUlyazJyNE5qQkt5?= =?utf-8?B?VnBQTXZlb3VwSDZaQ1gzUVIzSHhjOXhwNGs1Wk5meDdvQXkxMXhNWWxVS3Z3?= =?utf-8?B?bUxidysyL2FSUkJOQTBNbms1LzRiS1NJenI3NnFXZ0Q2MGR1emVsWXVnekFt?= =?utf-8?B?L3hnQlZEczVoakdrQkpSSGhSV0ZBVHJaL2lRMHR3alBqY0hFdi9xdG4xQ1FW?= =?utf-8?B?ekVvRXU1bUNsd1Z5S2hjSHgrdTRuL0dCaktUMk82dUpTLzNzVXZZa1dvMHR0?= =?utf-8?B?OHRwTkZxWjdlUzFSSlBZeTJsMUVmdVp4Vkh0ZG9SdEtTK0RhSEpQTGM4ODNp?= =?utf-8?B?c0FoNWdEazJSclpnbHVvUDIrYzMwOXNyUGdGNHVOQW9qdjdldGsrZlJweWcw?= =?utf-8?B?L0VZOG9nekxVdTdMVEQ2UHp3eURJc0ZzVHg2K0xKZG9hMG1QOWF3YnBFMTFB?= =?utf-8?B?S2RFWkx2ZlRUeElFMHdQUEtyNGJtSmxrOVNPcWIrcE52M3pUZFlwcGZrWFYw?= =?utf-8?B?dmsvNHhTdkQxT2F0MmJMQ2ZKQW5lSHJ0ZTEvY0IydGdBZE4vc1hOS0ZsR0tp?= =?utf-8?B?bGZsTDM2MjEzTnljT2JRZDQ3VWZCbUVEQi9lME5rc2plaUdXbVovQ2M2aTNZ?= =?utf-8?B?S25rMDFUY2F3NGxtVVVMZ0taV3gyZ1FSOGwwL3RZYVdZU1pOMHZMU3dzWExy?= =?utf-8?B?Q3MwMGdMSGZ6eUc1Nm9iUytSOEFuUTlQZG1GaE9XZFdDbzFyaWFTWDlDeWR3?= =?utf-8?B?QVJ5UEdxTk8zcUxYajYyenVCN0Y1L01xbkVybFdZeHR3emw2QzNjektRdU5C?= =?utf-8?B?M3ROaldXS1BjejRTT0VVTEpFOXpiWU55cjMvak1ZUjM5Y1d3TFcrUlo3S3lV?= =?utf-8?B?Ymd0YTMxKy9kbEZPT3lPcnRjc3o0TjNLeHpRRzFpWnNucEExaHI2SjducHZh?= =?utf-8?B?Z1ppVEJGL25BcHZtMjQrcDl4WGwzTERkVkI0U2ZKQm9peUEzdEdON2JKd2pm?= =?utf-8?B?eVp6SkpuVW1MWnI3WFVHV0VuWFNQeGRqQ2pMQUdEY3VvdG1ibEZOMG13emhj?= =?utf-8?B?TmhlRmVjRGw5bjlPNkxOTmhUMUtyVDVEYmNwZm4zcWtLOG8xbENzVmt6SE9u?= =?utf-8?B?WHBxbEkvRDBKVG1rZG5PcHc4aHVlWnl2QlYwU0ZPbHNiZTk0a2IvaUFwaVhm?= =?utf-8?B?aW9PUmxIdHVpVDk2MzY5RmlDSldYNjJnRzllZll6LzJJQ3hqWldWZHBRUWNr?= =?utf-8?B?ZjhhUTh6VWl0YkZsU1hQb1JDcmhNbWMva1VnSWZiUDdFMHp5NUpYUnhoNzB6?= =?utf-8?B?RU8xbjNUREgycWxNODN5M05oWnpxL05sQ2R3eVk3MU56NXc5Vm12dW1KMmNx?= =?utf-8?B?dmNoL1dRZ3FrTlV4MXZNVGF4YytKSkZ5b21VWjZTUHZYQmpNLzBnZ1h0ZFRH?= =?utf-8?B?WE0zc1dFTUI1bjRyNVp6Wkp2emNDM1dPeFplTWhkUUJ6V1FWWGdUWHh6VmVo?= =?utf-8?B?TVFVM3Jpci8wVEtSSEdUSG4zMEFYSGFkblkyUFhPRmhqbjZvSkQ2TGxzekRV?= =?utf-8?B?MHFuZHFuL1RYSXBGTTlmbkhRL0FHdGpWdURuUzdTS0h4TkgwK09GN3BzUTN3?= =?utf-8?B?VmNIZGFncDQ4Q2k5bTdVenJHK3dEc0J2U2xvazVQcnVYc09EVXNIaTVBM0Zp?= =?utf-8?B?Q3pvUjRTOFhWa2kzcXRHOXRMZ2R1TjhkTVNqWmpCTk14bEFqU1lLSDhDN3RQ?= =?utf-8?B?MnREVEFFUUxvQ00yc1hLTnRMa0VlbWFqQVdOMWxyU1IrdXovZHpSc0NDMk91?= =?utf-8?B?UEk3QjFjQWhBZmlFMHNlb2hKSHVBRmxJakx5bDhOcG00RjZSWTZUdzRNeWFJ?= =?utf-8?B?WkZ0Sm1laGw2ejlXQUhDNWNobEM1bWwwcWwxSUQ1cjVveCsxS3d1QU9BQUtW?= =?utf-8?B?dWNFTENiRDdmWmZNYWI5TjFic1NFdjQ0d0R2WjJ0MmVYdEdwclYyd3g0a0xF?= =?utf-8?B?WkpWSEZQZUVKcWR4TjJveEVDTHFOSDVLNkxVbU5ON1VnUSthN3BaSmJlU1Q1?= =?utf-8?B?TlNEa29tdVBvRk1IV0NHeTlwbGhaWE9uOGNselZuUWowcmpqbk03bW16VDg2?= =?utf-8?B?WmdveVpQV0NvV0ZIQzhoNFFxWFJRPT0=?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 05cef809-91fa-452c-6a87-08d9b69b2a2a X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2021 20:26:19.4887 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 39tT7ypFl1RiobYKKd4vI9ZnmG1tYDDaIRI75ZyWGUP7+FmE+HCRziug54CMrd/8ixSZVACC8BDWj64JinpuTYbjomF7qnIkrzotyvkjSg0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3841 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=40.107.15.139; envelope-from=vsementsov@virtuozzo.com; helo=EUR01-DB5-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1638563729533100003 test_parallel_perm_update() does two things that we are going to restrict in the near future: 1. It updates bs->file field by hand. bs->file will be managed automatically by generic code (together with bs->children list). Let's better refactor our "tricky" bds to have own state where one of children is linked as "selected". This also looks less "tricky", so avoid using this word. 2. It create FILTERED children that are not PRIMARY. Except for tests all FILTERED children in the Qemu block layer are always PRIMARY as well. We are going to formalize this rule, so let's better use DATA children here. While being here, update the picture to better correspond to the test code. Signed-off-by: Vladimir Sementsov-Ogievskiy --- tests/unit/test-bdrv-graph-mod.c | 70 ++++++++++++++++++++------------ 1 file changed, 44 insertions(+), 26 deletions(-) diff --git a/tests/unit/test-bdrv-graph-mod.c b/tests/unit/test-bdrv-graph-= mod.c index a6e3bb79be..40795d3c04 100644 --- a/tests/unit/test-bdrv-graph-mod.c +++ b/tests/unit/test-bdrv-graph-mod.c @@ -241,13 +241,26 @@ static void test_parallel_exclusive_write(void) bdrv_unref(top); } =20 -static void write_to_file_perms(BlockDriverState *bs, BdrvChild *c, - BdrvChildRole role, - BlockReopenQueue *reopen_queue, - uint64_t perm, uint64_t shared, - uint64_t *nperm, uint64_t *nshared) +/* + * write-to-selected node may have several DATA children, one of them may = be + * "selected". Exclusive write permission is taken on selected child. + * + * We don't realize write handler itself, as we need only to test how perm= ission + * update works. + */ +typedef struct BDRVWriteToSelectedState { + BdrvChild *selected; +} BDRVWriteToSelectedState; + +static void write_to_selected_perms(BlockDriverState *bs, BdrvChild *c, + BdrvChildRole role, + BlockReopenQueue *reopen_queue, + uint64_t perm, uint64_t shared, + uint64_t *nperm, uint64_t *nshared) { - if (bs->file && c =3D=3D bs->file) { + BDRVWriteToSelectedState *s =3D bs->opaque; + + if (s->selected && c =3D=3D s->selected) { *nperm =3D BLK_PERM_WRITE; *nshared =3D BLK_PERM_ALL & ~BLK_PERM_WRITE; } else { @@ -256,9 +269,10 @@ static void write_to_file_perms(BlockDriverState *bs, = BdrvChild *c, } } =20 -static BlockDriver bdrv_write_to_file =3D { - .format_name =3D "tricky-perm", - .bdrv_child_perm =3D write_to_file_perms, +static BlockDriver bdrv_write_to_selected =3D { + .format_name =3D "write-to-selected", + .instance_size =3D sizeof(BDRVWriteToSelectedState), + .bdrv_child_perm =3D write_to_selected_perms, }; =20 =20 @@ -266,15 +280,18 @@ static BlockDriver bdrv_write_to_file =3D { * The following test shows that topological-sort order is required for * permission update, simple DFS is not enough. * - * Consider the block driver which has two filter children: one active - * with exclusive write access and one inactive with no specific - * permissions. + * Consider the block driver (write-to-selected) which has two children: o= ne is + * selected so we have exclusive write access to it and for the other one = we + * don't need any specific permissions. * * And, these two children has a common base child, like this: + * (additional "top" on top is used in test just because the only public + * function to update permission should get a specific child to update. + * Making bdrv_refresh_perms() public just for this test doesn't worth = it) * - * =E2=94=8C=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=90 =E2= =94=8C=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=90 - * =E2=94=82 fl2 =E2=94=82 =E2=97=80=E2=94=80=E2=94=80 =E2=94=82 top =E2= =94=82 - * =E2=94=94=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=98 =E2= =94=94=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=98 + * =E2=94=8C=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=90 =E2= =94=8C=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=90 =E2=94=8C=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=90 + * =E2=94=82 fl2 =E2=94=82 =E2=97=80=E2=94=80=E2=94=80 =E2=94=82 write-to-= selected =E2=94=82 =E2=97=80=E2=94=80=E2=94=80 =E2=94=82 top =E2=94=82 + * =E2=94=94=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=98 =E2= =94=94=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=98 =E2=94=94=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=98 * =E2=94=82 =E2=94=82 * =E2=94=82 =E2=94=82 w * =E2=94=82 =E2=96=BC @@ -290,7 +307,7 @@ static BlockDriver bdrv_write_to_file =3D { * * So, exclusive write is propagated. * - * Assume, we want to make fl2 active instead of fl1. + * Assume, we want to select fl2 instead of fl1. * So, we set some option for top driver and do permission update. * * With simple DFS, if permission update goes first through @@ -306,9 +323,10 @@ static BlockDriver bdrv_write_to_file =3D { static void test_parallel_perm_update(void) { BlockDriverState *top =3D no_perm_node("top"); - BlockDriverState *tricky =3D - bdrv_new_open_driver(&bdrv_write_to_file, "tricky", BDRV_O_RDW= R, + BlockDriverState *ws =3D + bdrv_new_open_driver(&bdrv_write_to_selected, "ws", BDRV_O_RDW= R, &error_abort); + BDRVWriteToSelectedState *s =3D ws->opaque; BlockDriverState *base =3D no_perm_node("base"); BlockDriverState *fl1 =3D pass_through_node("fl1"); BlockDriverState *fl2 =3D pass_through_node("fl2"); @@ -320,33 +338,33 @@ static void test_parallel_perm_update(void) */ bdrv_ref(base); =20 - bdrv_attach_child(top, tricky, "file", &child_of_bds, BDRV_CHILD_DATA, + bdrv_attach_child(top, ws, "file", &child_of_bds, BDRV_CHILD_DATA, &error_abort); - c_fl1 =3D bdrv_attach_child(tricky, fl1, "first", &child_of_bds, - BDRV_CHILD_FILTERED, &error_abort); - c_fl2 =3D bdrv_attach_child(tricky, fl2, "second", &child_of_bds, - BDRV_CHILD_FILTERED, &error_abort); + c_fl1 =3D bdrv_attach_child(ws, fl1, "first", &child_of_bds, + BDRV_CHILD_DATA, &error_abort); + c_fl2 =3D bdrv_attach_child(ws, fl2, "second", &child_of_bds, + BDRV_CHILD_DATA, &error_abort); bdrv_attach_child(fl1, base, "backing", &child_of_bds, BDRV_CHILD_FILT= ERED, &error_abort); bdrv_attach_child(fl2, base, "backing", &child_of_bds, BDRV_CHILD_FILT= ERED, &error_abort); =20 /* Select fl1 as first child to be active */ - tricky->file =3D c_fl1; + s->selected =3D c_fl1; bdrv_child_refresh_perms(top, top->children.lh_first, &error_abort); =20 assert(c_fl1->perm & BLK_PERM_WRITE); assert(!(c_fl2->perm & BLK_PERM_WRITE)); =20 /* Now, try to switch active child and update permissions */ - tricky->file =3D c_fl2; + s->selected =3D c_fl2; bdrv_child_refresh_perms(top, top->children.lh_first, &error_abort); =20 assert(c_fl2->perm & BLK_PERM_WRITE); assert(!(c_fl1->perm & BLK_PERM_WRITE)); =20 /* Switch once more, to not care about real child order in the list */ - tricky->file =3D c_fl1; + s->selected =3D c_fl1; bdrv_child_refresh_perms(top, top->children.lh_first, &error_abort); =20 assert(c_fl1->perm & BLK_PERM_WRITE); --=20 2.31.1 From nobody Thu May 16 17:05:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1638563377; cv=pass; d=zohomail.com; s=zohoarc; b=O/3hMeW1P6U2MWYL/y/yL7petKT7sp2+48k/Tq0veduK3TxtEYwYjZyvPu4nQT0hfiFjPTcNk03SL2kXBrqYTOWFkrmlmicrJP06cpBAioPeGZr0I+FUQxHUfRNKC7qVkeHV8PKTuTJjWkR5hgs6c0Cv8fliA52XMGqadnroqXE= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638563377; h=Content-Type: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; bh=hVEciihopY4LWBv8udTvqAdszKG8R0KJlDSLT6UCO3U=; b=CMXBH/Nr3QRE66qHp+yRfFgNy77oQ26oSip09NOhox2mUihmM4QECD2VUvLSMZ9rVjiMmRw073wDSNFL0VieLnvzTb7hk9VXQjFURkMS7YM3ygzqXoSKzWindyEST8/s8bnSv86kyvHyRtBV4cRvccmS76HISnwOdKNraivn4+M= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1638563377799543.8505286345921; Fri, 3 Dec 2021 12:29:37 -0800 (PST) Received: from localhost ([::1]:60620 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mtFBY-0005Ra-Bv for importer@patchew.org; Fri, 03 Dec 2021 15:29:36 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57724) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mtF8s-0000w8-GQ; Fri, 03 Dec 2021 15:26:50 -0500 Received: from mail-eopbgr150132.outbound.protection.outlook.com ([40.107.15.132]:11453 helo=EUR01-DB5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mtF8q-0001bp-0R; Fri, 03 Dec 2021 15:26:50 -0500 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by AM0PR08MB3841.eurprd08.prod.outlook.com (2603:10a6:208:106::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.22; Fri, 3 Dec 2021 20:26:21 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::2078:5a2:1898:d83a]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::2078:5a2:1898:d83a%7]) with mapi id 15.20.4669.024; Fri, 3 Dec 2021 20:26:20 +0000 Received: from kvm.ch-qa.sw.ru (130.117.225.5) by AM6PR10CA0086.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:8c::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.16 via Frontend Transport; Fri, 3 Dec 2021 20:26:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Pi8UyQpbnsPOG1hEVcT82H8CsrQ9wrBCL3UtlLut470t0P8KZ7OCms2VUvzrfMQ2HmNEIlrWhV2poHljJ3R7zL3eM0kCJqneHPd3129iRmWKuwWO+PtFhE3qiS5xoE5YTZRdk46AHDKZGoq2UuWjrVo/wen4/hDr9D7KhGObsfNrN5dtvAb89lM9/95DOQGjqT6tiKJDToL92pbMTA27aU/0xm2fGFLjusqZtdkY4XRHX+wbBacS643eUbBGsegFie4emxwv5uP2856NuysI9ZqwddIWkp8xluaKAz7n9h7M16dz+gUfUsxeUyyX7Ei1ymmAN1G7kNsfLFRfRTQKxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=hVEciihopY4LWBv8udTvqAdszKG8R0KJlDSLT6UCO3U=; b=MpYkwFy7vrjTyIETg7fPUG2eaZOvxokTuo7aPbnVpcSX7FeB9RnTmoXcDpdTvRtYXjDu86ogtaqhhQlwXEWNiwMJfy7ToYUW6HUPogTH4OareCbzHoPAdq+oe9VCC78KxLcgZamKGH20SmSLhkFYeUh+OQ42s80SRP5EIlwufzsvg7veKdHd1TOPrsEgYhDSP9VX+PNFTJIQGWv2bEETzl9ChYYTI1Q5mjeFCXIlDnQSUGhucLTDNsdYOX6dgOW7YBI3bdcxouYRH1Za6y+AV1LkOSKcXJxiemkaVLXYPsOYVT72KkISS1Nu23pDJlFFHteLY7VaLnCh3RDxR7EG8g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hVEciihopY4LWBv8udTvqAdszKG8R0KJlDSLT6UCO3U=; b=HHFa2AaVQg5xsevieBOEPR/RblemTbhZ2ItT4z25ooa/1xdMQNMNg1jZYwgHfa+/IEoJcDElVWpB2o1W0iCMAAaDn8R6BfTmPIl6UUDsKl6vQC/9M3w6HQ9TPGt3Lyi0e7lvBWLDvzPWTQVAmh8et93JswNdx1VBXZXlrcHxDpg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, kwolf@redhat.com, hreitz@redhat.com, vsementsov@virtuozzo.com, Eric Blake , Thomas Huth , Paolo Bonzini Subject: [PATCH 05/14] tests-bdrv-drain: bdrv_replace_test driver: declare supports_backing Date: Fri, 3 Dec 2021 21:25:44 +0100 Message-Id: <20211203202553.3231580-6-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211203202553.3231580-1-vsementsov@virtuozzo.com> References: <20211203202553.3231580-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM6PR10CA0086.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:8c::27) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b32a485b-b890-4691-f298-08d9b69b2a7f X-MS-TrafficTypeDiagnostic: AM0PR08MB3841: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:133; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: E8ipvKoaHfMYQsVU3QXimu9tMCqHUKPZMXgF3rSfOwuOMzEByvZNISbfGnLeicOt0neVlcqoVVBimLRvZNW2ClallTW59FimE5xUP1aPi6U1sJqExINS37oJAXb0ngK0ay/UToP/daouq8gtc3quZ5Soi7CWTcKU78kQVsiXhP7lLHO3dujLM1ADSx4qywV5mSzT9R58YxPHk27UsJqzZ2p8sw16MP70/sWnauKz5eYhgjr1kan69MtAf1YHlxRfaq7i3HljdqtsP6U7lGRoeI4lzhBnZ6BUcse8TTjroIOpX33/uBTugt/Dw2tlKbrrlh1eJOObWRh4/vnuh2xT5fJGB/DCWI6K+1E1i8psr6btJ0klEIra2skvkVVlyBksbcsJ3tVBu5Etvp4cirvBu9NnLWgwzkeQkfmUaYgWWlnJj9wHfPQBBrLsATGBDvW9eWhVTya7MWt1XePrjklxaV21dDAXuNW5Ih0WYha9NdOgWwDdYwBVAGKKg2WBoqsTa3Gl0nzlNpKLgjKPaeHTmkSAPRPNqqlYJ3r/27Wm15Adct5W8KYndOabEeav96Ihwsf8wXEd7c/fIglsG2a2YJdZAuaM1FXo7idBzwq7mPYpCtxjgtjnF1zPicmJ/zn5krQuEJln9RTRNlltxmJwz/m1KdyRJWdZSeWNOXeor3ZzpYomDGduzqv38XCZA2r4deZJEhXLftk+CxPWqTpS+w== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(186003)(86362001)(2906002)(2616005)(54906003)(6506007)(6916009)(1076003)(66946007)(26005)(36756003)(6666004)(66556008)(6512007)(52116002)(38100700002)(4744005)(83380400001)(38350700002)(8936002)(8676002)(5660300002)(508600001)(4326008)(6486002)(316002)(956004)(66476007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?T+ilbDWhnttXG0gHjR85Lkiu9/BjDDYeF6SBfP0hq0G3fBAfxujn+hc2tgKW?= =?us-ascii?Q?i7TZyo/tWV9ksw7sljKChuKy8rMoW3dBkrXT3c0ti6iFGKv2qrqBTRftMqy3?= =?us-ascii?Q?I4c/s9u/xLbhLUhrDGwIW7ROfYkmgGz9t8fdNfXpmDpX8Z8SF+8A97CuHMs4?= =?us-ascii?Q?rb7NJvlvR1/cn2CZAFbhQkhYcYvxlgTzD5Lkvd3KkGkg4nLUiOOXQNoqcoNk?= =?us-ascii?Q?wNSai1Ly4y0vVmRXp6oqTwnI9FJtm8lTrR6myjE+5l1Oq+WNiOb8pqdcRdau?= =?us-ascii?Q?NjwNvUTxJ/3xn4dfdE1nMf0bWw5IqlMcUBVKqPQnh75/E0ws0U4baPrOx+kU?= =?us-ascii?Q?f0wEfRKf2fzv+JMV75g3tBcNiNoSJndwGWRYEqNGcNTOztIGfqR2pAVITft9?= =?us-ascii?Q?a8w83UyFBC6CBGRoJrIy/JQU9fhrulCO84wlFFpW/JVxiXHvh67PXrg4wEEP?= =?us-ascii?Q?94aKWjkkuccjDEtxO/Xi7EnVtFaP2H3SSx8ZFhmsjXkbghs4x57bbmv5iaNr?= =?us-ascii?Q?+pl5n+/1axA+Pj81xv75/MZt/lId9rJn5nW1iRJMsmSQXOygykc0+hMIjILt?= =?us-ascii?Q?uPmLlFYwEPwJiryNshdaHJ2HsKVBD2nHveaBG69LOCcZFPiqmXTQlB8KMgVl?= =?us-ascii?Q?IieTHX/ldgHUkrrdwVZ1NpSV5A1fH5flBT69TxQwxwOaW4eD29rbhA57Zkt2?= =?us-ascii?Q?DetSOlDKgm2ODeIkYao6S+Qo7+5T3V6tTim8933M6r7wbQPiIv9nUTevqAUp?= =?us-ascii?Q?YNaQkQz8IfVQQPRQFwXBuL2caO7tw5HjksnaCByKjsVXTom+EUyVrCo1utZB?= =?us-ascii?Q?QBS+77sPYZIpj5meIrs1W50FL9uohxMoR+q+NrHraDS5ev7vbFEdYsnbAWzV?= =?us-ascii?Q?gn2h0RC0HsvZatHMtDnYv9SRnhx352TDSyHy9MlfzrE4FFTM3AFKFOKzdMZD?= =?us-ascii?Q?4QcN+ikyCiml2lci/EZ9QhHFOkIjSBnc1NRaud0htNeb9NssixrvSRA0J4Bb?= =?us-ascii?Q?hMR2l5OjzXB1YOUZ3CWiUnyNGpQtmuH6JQfisFq9oBvGh7DgVQaCAguvT3uM?= =?us-ascii?Q?U9LHTe71PYBJxWq8Yjq6ZzQfR+FnH/SduOgqJE4IABMrkjbkf0pAeqwXKl04?= =?us-ascii?Q?j+Xin0rS4t+VnLbrv3IkP7CFFiLX5cjlWKZMRqRXOuy7zmWP/oxLyMunfmCB?= =?us-ascii?Q?vEwrPG8HsXsKs306Rids51K23Gli8F2HhzC/H8MhPDybwYmw4l0WkrlEtAbi?= =?us-ascii?Q?IA3rnB4FoBOcLujUEZLvyEYPY1MYjHMSjtyFlQwpxZl2/iurGjzUo0hXLUjQ?= =?us-ascii?Q?z/KGxHcntXSfWQcL+Fdndrz3QllxspaGFISq4QgQC7SWVYYp51TLo+vxNIqP?= =?us-ascii?Q?WK/r7uMIaanvJVvMH+8PSPuOR5r5V0XhFPM4s7wAVnF0NoAi0LCIcJUOXsLX?= =?us-ascii?Q?//DqprjH8iYJusN7I5d6jYa5varPJvDQiQbWXp30DvxgOTcqObvygpXhOONA?= =?us-ascii?Q?2eGEy3aEz2xHCFllaetsxWroIJMwLNYx3tQSx6v1DPXNXWh0lmThqiekePg/?= =?us-ascii?Q?dB53MvALwkHbfPbnzD9BM+TxyN0q/rVMX9uM/IjzkyD94OOXEBu5O6MNyeCa?= =?us-ascii?Q?OpSiQWlujk/uxNoHVEiHFp/5RoiZmYhphhPR0LUNaKvb3UhjSPfaPD+zsbs/?= =?us-ascii?Q?f9u7vA=3D=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: b32a485b-b890-4691-f298-08d9b69b2a7f X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2021 20:26:20.3599 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: RimJuYDp4JIy+dW+loG6EW/q+1ibDgRT58a/LEQFhPyo4yEk9e5eGE3OR1mb9a34J2JA7MErYUW6mTCYBC5ByWkKdJD9cxbG/ChxX5NPxW8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3841 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=40.107.15.132; envelope-from=vsementsov@virtuozzo.com; helo=EUR01-DB5-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1638563378173100001 Content-Type: text/plain; charset="utf-8" We do add COW child to the node. In future we are going to forbid adding COW child to the node that doesn't support backing. So, fix it here now. Don't worry about setting bs->backing itself: it further commit we'll update the block-layer to automatically set/unset this field in generic code. Signed-off-by: Vladimir Sementsov-Ogievskiy --- tests/unit/test-bdrv-drain.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/unit/test-bdrv-drain.c b/tests/unit/test-bdrv-drain.c index 2d3c17e566..45edbd867f 100644 --- a/tests/unit/test-bdrv-drain.c +++ b/tests/unit/test-bdrv-drain.c @@ -1944,6 +1944,7 @@ static void coroutine_fn bdrv_replace_test_co_drain_e= nd(BlockDriverState *bs) static BlockDriver bdrv_replace_test =3D { .format_name =3D "replace_test", .instance_size =3D sizeof(BDRVReplaceTestState), + .supports_backing =3D true, =20 .bdrv_close =3D bdrv_replace_test_close, .bdrv_co_preadv =3D bdrv_replace_test_co_preadv, --=20 2.31.1 From nobody Thu May 16 17:05:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1638563938; cv=pass; d=zohomail.com; s=zohoarc; b=MvICp96Q00Vr3/hyfDCF7GDtPvBHGIN60gpr/iBqseVU+QCxa8CyWKvPgAxllhYAhat0e9zuZFqFlTczE8XDvsLmW5tiiDu3BenEE9CUx2rB5X0zySp6Qsf18IvFtZJ00bgR06ZQuX68JjWZm2XitbDrNXTkvwjATw2brSVCuzI= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638563938; h=Content-Type: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; bh=+9Nc4I/1HmU7AlQC1CAHYouh9KxjNx1KeO5ILNaq/nM=; b=js6wIqKoJwH+N92T8wXWG1e32rghwIrxzLjrpM/4MlePrSnFzVFqWssfQOPpdZ+qioOuTLnCIM5UM0XKIBivcd3vyK7RkEsnm5n/HbQWlprIbsXZ33SZ1nd11Udoo4eUXm+kGRplRloH0EPG4xTqMmVeOkFNVg6kZ/qmBbcRlfY= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1638563938280594.065397831777; Fri, 3 Dec 2021 12:38:58 -0800 (PST) Received: from localhost ([::1]:35732 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mtFKb-0001FP-6G for importer@patchew.org; Fri, 03 Dec 2021 15:38:57 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57780) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mtF8u-00015W-Rf; Fri, 03 Dec 2021 15:26:53 -0500 Received: from mail-eopbgr150139.outbound.protection.outlook.com ([40.107.15.139]:14661 helo=EUR01-DB5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mtF8s-0001cv-Qa; Fri, 03 Dec 2021 15:26:52 -0500 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by AM0PR08MB3841.eurprd08.prod.outlook.com (2603:10a6:208:106::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.22; Fri, 3 Dec 2021 20:26:21 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::2078:5a2:1898:d83a]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::2078:5a2:1898:d83a%7]) with mapi id 15.20.4669.024; Fri, 3 Dec 2021 20:26:20 +0000 Received: from kvm.ch-qa.sw.ru (130.117.225.5) by AM6PR10CA0086.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:8c::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.16 via Frontend Transport; Fri, 3 Dec 2021 20:26:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BuzUXjTFZCy3Qt9OesAYQojxCLbZXv+FO4duUEkvMBCLT3IfHAZdrW6wanZyYLluPXRTJicTim0LBav2+k344WD6iI0sW9uEGT4rM6CzFrbSu5DRVG4hrYPtyDM5KLd5zmFURzmYreomPGW+YBquuBbFPeFbBHSRtEPNIxcCwfagnSksNV3zfX7kZeaxM0Cu0E+4DuunvL2spWozTxc5+QQs8tkcWLOpqWT8l+Tc9a+sMZwe7mH4uTWPXsZUPnzkb7cZVWw6X3VUbKaTsYOURdv9u0zkW8BzWjcE9f4RwV4ZWnHNen2A4ZIFDzuY7mT9zgSdhFJsxfxotaDuIXPtBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=+9Nc4I/1HmU7AlQC1CAHYouh9KxjNx1KeO5ILNaq/nM=; b=fmppWEKs8rNVwEQm7cHIF0h+VMd5xnIiYYJxYJHiAMbSOj11kWLfreA7gQ42UO9hISMJ6zRGR78WcVogyhVhnPDlXVQPeJ2iZdfhIkJ+f0oQmCIucGfg9MSzKPpB4IC6S2rqE6YNZA4xfp86SCyLEwi5txVg+Ym5LgizRKTYua8yXVDewwmOC0tPwNICDFv60CDsV9F2bkwbmc/KRBzF0L9mjGkbzm+whM/b0XFwwDEmn31pqDeeDBgLg0hA9m7c/q2xKymBCEnOSLA5EEHgNHJ2ePz2ZQ0NYquNkfHOB4JuEL+NebwLIopPLLuaFYFIdVydxGklJ+3fl70Z9eb10g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+9Nc4I/1HmU7AlQC1CAHYouh9KxjNx1KeO5ILNaq/nM=; b=Ap/HC7KvJsAKr+NeqoiaBQZ2BOidciHw9S+f+TssrW//62a/wFzPyGzaA+T7kKHpJvClbADWUrPf6dvnFvek4ZbbEPBzE0VctP4QSCI/+4l8yTdG+WRYPFc0VQ/xm8gmzQwmxQ8z9LKwonc7r1aVcSne51Lhj1cvdRlNWmcbN3Y= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, kwolf@redhat.com, hreitz@redhat.com, vsementsov@virtuozzo.com Subject: [PATCH 06/14] test-bdrv-graph-mod: fix filters to be filters Date: Fri, 3 Dec 2021 21:25:45 +0100 Message-Id: <20211203202553.3231580-7-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211203202553.3231580-1-vsementsov@virtuozzo.com> References: <20211203202553.3231580-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM6PR10CA0086.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:8c::27) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 29675257-08b5-4cbe-c6db-08d9b69b2b00 X-MS-TrafficTypeDiagnostic: AM0PR08MB3841: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:400; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dof1M5ep2mF7ANUSDn1ZRytmhcCYEyJdw4cGVFs7OzlqjQTRQU0jazxkLmkdR7heORTCcW36c1q136cIZ3o9GXPjSaE8JBF8JdjIxUc0GTv0eVvqsHaO/0pWuNdiRuAg5WlbzwsG+ULmPZJcZUy0eFdG9g5pQ6u/HNJARGkBPHxhntdBEBN6fYCAMXK2sJFJiARvJIvY8hkWftMeMqGxgZB1yiip8bLjmv/uNXiXMTFKcy1WeqJW+l+BftoEiBj0KGQH01bcygrkzwh4zFr3l+NtyJMQvV3hd2R6DXOfAoJQIv1qfAYWPgcEHGmprAOSL3w9KqLgshepMrZmldUYRdJWE9EQrNPfjRqkNbrL6rrEvmoWjoLi795B6PhamCxssbjTjl+RNNeu+vVJJ7lurMo7HZ8YnutnkkTg4VCl/42jLjE9z8ABuDun7ByctWIlgbu9HGrmzYFxjP2iuXyFK6H7B2z74axxQDzcDNdTkcJVu6fjRNyfqzNXt7VXyt1O5wRxFbHkj8BplDFOG1uFuTtZcMz7H2QZydaXw3AHcoZUVY19fV0eB4wemFRRVc4uM/L2oRpD/D7pwvwqy5aeCLzqiBZzdpQcODZs6ImcyAzb33w/ScnhMJS5HTmqbTIOQ663PsF8hT04eIKVOchEmgy8uEdSY00k/8eLIckpCoq5LDVfl+8uZDonZVIitVDWWI91MwZ/iOkVNahUaKOTJQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(186003)(86362001)(2906002)(2616005)(6506007)(6916009)(1076003)(66946007)(26005)(36756003)(6666004)(66556008)(6512007)(52116002)(38100700002)(107886003)(83380400001)(38350700002)(8936002)(8676002)(5660300002)(508600001)(4326008)(6486002)(316002)(956004)(66476007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?X7kC+HdzBx9atKBrEJDdPpOD7vaAQ+9F4fPuZj2otW7axs2CQJ2BZCRllGA0?= =?us-ascii?Q?NXLLGLGmngUGCwbFY+FJIT7mm32IkiwmOPDSRjpEYbUS6CVD56vdWUruOtgZ?= =?us-ascii?Q?H/kOiqHFKCNSq/8ivFuxMDrQwjlHUXKIfCOEt2R51+ikBvpYTS+qtP3u/zOT?= =?us-ascii?Q?bnvwSdbQGv9qt9+O8RiBZiPxa8bifFp5p1JCvAb+kYyncoww4BapUsq+XnvP?= =?us-ascii?Q?lUbo34FYNd9DHiFD9CW7tb/k35s9QaE+qzCyHBdXfiPqP4sQpMhhqUgJqWk3?= =?us-ascii?Q?jOwv7tiWXcUhRhJ7Kiyu57pI7ZSHN2OkIVgdsHSpW20CvXrvRRSRE4OBmvpC?= =?us-ascii?Q?hr5QBl47MeLHkAa+a6bBaKCaoPdDnC9K/ahkZvc+vRtJRZAWVekHuWhAh0lX?= =?us-ascii?Q?84PDkwD9s08/3TfIddmGjMVxRXivyfULvoGHOnw4spO2VUuM4ojDuco48y7w?= =?us-ascii?Q?RM8hER1LG7khzdBnGbUf87UzaFld5WFB4gALWus9+n96DjKU9y4BWabJ1Nkw?= =?us-ascii?Q?4a1YYQnQHzh5VafN1XFhNwNwvJmKXt4LQPecVSXCab3rAhSr7Egf/oZPTDI3?= =?us-ascii?Q?PA2Oh4OqrlGwk7X1CTJ9Mr9RKq51WkOlqxVFBGVz4Yydbmh/1SzXk614nq2C?= =?us-ascii?Q?fWBh2Kn/YsxIZq1oomtGVUxN9hqXlcV77f1Mf3rq02YX1d0X31mYhXA/igus?= =?us-ascii?Q?k6KHA7+KaRV1Pe5LvViB+gulQrlYd6RbMVXlhpGdrC2bxTUNPdh+SsoJ1UJx?= =?us-ascii?Q?DIdSiPMOVPXvvt59lq5mIFop3bTE5199F9HKIKVM+ZuzZVJktarIp+SweSZu?= =?us-ascii?Q?QkTdviGl2xtcn6N/4e4OfoamEglXKBug3cwh+oy7XSJ0f/h6QzMNMe8YHNi6?= =?us-ascii?Q?EjmgZG3dalR9BDw3zM5SFpGbJan1ZgU7Mh9NxmhvB6nDmpZ+3XPsryCeDafP?= =?us-ascii?Q?hL8TfJNdgE0hXZuGkJXOND3nJgGSnhNcCmUW7kxv/X2RU1Dklu+0LDMt8DJ3?= =?us-ascii?Q?YCDzVBahoR/M5Wb0XkSOIaMM/0ZMq7qGivPCj1NCCwM/0Fu242vOp/8owCwV?= =?us-ascii?Q?3EbqjjwJGzg2xyE7IzBx9S+qTzlc86TVspbQ71RsAB0fHwW3+rSv2HXafHoq?= =?us-ascii?Q?hROLQB4YP1rYD9JCu3wjiV5+asWF2wPhgqcEQJv7iO9HrQacDpYCybPw/DAj?= =?us-ascii?Q?Ou/fjXz/Yp6O/geBXxuws/OFlgTXjqQkRLD+R1j0YSL7W1C2osIy2XhdyABH?= =?us-ascii?Q?DewVn9HuY46cFO3CkHe7ncin8XSn4hUZLmSW9twvlFQKrAWFH48Zat2B/sFt?= =?us-ascii?Q?igTbp8ktwF62LxOVYLvKFRrlC9RClI7JhnLdZ4WSbCgyJ67AtR9v3YTVw/T3?= =?us-ascii?Q?ShowDPG5Zl0LmMI28OgzBA4JWupQZ7SfwDIYMv7EqWO2w8GHt2twuak6YJjZ?= =?us-ascii?Q?lCHEvRNGRKu5zoEJGmolp3hccIY0FxCAGibzzvJrY7IjEJjszEvsmfz2FSMP?= =?us-ascii?Q?p7hYafJrNS2nS0eeqSONLY+y/zHmKutEMPG0gYWI2ffJza4Ppuyj+zkP+jaB?= =?us-ascii?Q?9tP6OF2UvRfuaZg0YO42Eojya6TylPZLf8SyJvEcC7IDKdYOcUtRrKHFTOoM?= =?us-ascii?Q?xiUnG12YZJmTcNaninuu2/Una5ltj/+3tVc4oICXw+fwL96s4ducmrfLlOmc?= =?us-ascii?Q?oFXbuw=3D=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 29675257-08b5-4cbe-c6db-08d9b69b2b00 X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2021 20:26:20.8189 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: RY9FoYKHCSJ3aIoX/iqdeDlllLVKvWF7g0g7RIG8bCvRRi9K1s1IPC5/IZ6/Spam7Cdrnd3SAOBywfEEgZRpUXuqtMwgWPxDiYQhZ6Zs4qc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3841 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=40.107.15.139; envelope-from=vsementsov@virtuozzo.com; helo=EUR01-DB5-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1638563940458100001 Content-Type: text/plain; charset="utf-8" bdrv_pass_through is used as filter, even all node variables has corresponding names. We want to append it, so it should be backing-child-based filter like mirror_top. So, in test_update_perm_tree, first child should be DATA, as we don't want filters with two filtered children. bdrv_exclusive_writer is used as a filter once. So it should be filter anyway. We want to append it, so it should be backing-child-based fitler too. Make all FILTERED children to be PRIMARY as well. We are going to force this rule by assertion soon. Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/block/block_int.h | 5 +++-- tests/unit/test-bdrv-graph-mod.c | 24 +++++++++++++++++------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/include/block/block_int.h b/include/block/block_int.h index 9c06f8816e..919e33de5f 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -121,8 +121,9 @@ struct BlockDriver { /* * Only make sense for filter drivers, for others must be false. * If true, filtered child is bs->backing. Otherwise it's bs->file. - * Only two internal filters use bs->backing as filtered child and has= this - * field set to true: mirror_top and commit_top. + * Two internal filters use bs->backing as filtered child and has this + * field set to true: mirror_top and commit_top. There also two such t= est + * filters in tests/unit/test-bdrv-graph-mod.c. * * Never create any more such filters! * diff --git a/tests/unit/test-bdrv-graph-mod.c b/tests/unit/test-bdrv-graph-= mod.c index 40795d3c04..7265971013 100644 --- a/tests/unit/test-bdrv-graph-mod.c +++ b/tests/unit/test-bdrv-graph-mod.c @@ -26,6 +26,8 @@ =20 static BlockDriver bdrv_pass_through =3D { .format_name =3D "pass-through", + .is_filter =3D true, + .filtered_child_is_backing =3D true, .bdrv_child_perm =3D bdrv_default_perms, }; =20 @@ -57,6 +59,8 @@ static void exclusive_write_perms(BlockDriverState *bs, B= drvChild *c, =20 static BlockDriver bdrv_exclusive_writer =3D { .format_name =3D "exclusive-writer", + .is_filter =3D true, + .filtered_child_is_backing =3D true, .bdrv_child_perm =3D exclusive_write_perms, }; =20 @@ -134,7 +138,7 @@ static void test_update_perm_tree(void) blk_insert_bs(root, bs, &error_abort); =20 bdrv_attach_child(filter, bs, "child", &child_of_bds, - BDRV_CHILD_FILTERED | BDRV_CHILD_PRIMARY, &error_abo= rt); + BDRV_CHILD_DATA, &error_abort); =20 ret =3D bdrv_append(filter, bs, NULL); g_assert_cmpint(ret, <, 0); @@ -228,11 +232,14 @@ static void test_parallel_exclusive_write(void) */ bdrv_ref(base); =20 - bdrv_attach_child(top, fl1, "backing", &child_of_bds, BDRV_CHILD_DATA, + bdrv_attach_child(top, fl1, "backing", &child_of_bds, + BDRV_CHILD_FILTERED | BDRV_CHILD_PRIMARY, &error_abort); - bdrv_attach_child(fl1, base, "backing", &child_of_bds, BDRV_CHILD_FILT= ERED, + bdrv_attach_child(fl1, base, "backing", &child_of_bds, + BDRV_CHILD_FILTERED | BDRV_CHILD_PRIMARY, &error_abort); - bdrv_attach_child(fl2, base, "backing", &child_of_bds, BDRV_CHILD_FILT= ERED, + bdrv_attach_child(fl2, base, "backing", &child_of_bds, + BDRV_CHILD_FILTERED | BDRV_CHILD_PRIMARY, &error_abort); =20 bdrv_replace_node(fl1, fl2, &error_abort); @@ -344,9 +351,11 @@ static void test_parallel_perm_update(void) BDRV_CHILD_DATA, &error_abort); c_fl2 =3D bdrv_attach_child(ws, fl2, "second", &child_of_bds, BDRV_CHILD_DATA, &error_abort); - bdrv_attach_child(fl1, base, "backing", &child_of_bds, BDRV_CHILD_FILT= ERED, + bdrv_attach_child(fl1, base, "backing", &child_of_bds, + BDRV_CHILD_FILTERED | BDRV_CHILD_PRIMARY, &error_abort); - bdrv_attach_child(fl2, base, "backing", &child_of_bds, BDRV_CHILD_FILT= ERED, + bdrv_attach_child(fl2, base, "backing", &child_of_bds, + BDRV_CHILD_FILTERED | BDRV_CHILD_PRIMARY, &error_abort); =20 /* Select fl1 as first child to be active */ @@ -397,7 +406,8 @@ static void test_append_greedy_filter(void) BlockDriverState *base =3D no_perm_node("base"); BlockDriverState *fl =3D exclusive_writer_node("fl1"); =20 - bdrv_attach_child(top, base, "backing", &child_of_bds, BDRV_CHILD_COW, + bdrv_attach_child(top, base, "backing", &child_of_bds, + BDRV_CHILD_FILTERED | BDRV_CHILD_PRIMARY, &error_abort); =20 bdrv_append(fl, base, &error_abort); --=20 2.31.1 From nobody Thu May 16 17:05:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1638563714; cv=pass; d=zohomail.com; s=zohoarc; b=U5HBebflfZoqtAr7ZrdjYJlzcj1/Pr2gdzCiyXC0IVXyJj8bD4WCHrEgdQ5VH9CPL4hFTvJqNZC6yWppDg33IZxNb7qD3430JtszvG3r9oOx84aTu09jK3bdaVfaPAHfQk6fbXznvgz5w+CT4VF9Xv0TbkNbnUfTKyir50cXU4c= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638563714; h=Content-Type: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; bh=YhoxgGe3Ea0Tt6RFHkgMQQ5XGu0P2U3WzRhaJRV7OeI=; b=kZZ5Eo9KdzIzhxl5Qm8k4hIJNX/SlFiJa1JwOJSo1GTk+YY4wGz+cmV2Mri+A2xOFEVdwbH/m3uIhQs7536XJCqJ6jTtZvXmzXSzRJqBv2izpUGpYVrjw+m0WeFeuqLPvMTSfAH7H9sFquCLTnIYxKDBeWPwURN2YnsTTrnUa3E= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1638563714476873.9693465894385; Fri, 3 Dec 2021 12:35:14 -0800 (PST) Received: from localhost ([::1]:50204 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mtFGz-0000Ys-AZ for importer@patchew.org; Fri, 03 Dec 2021 15:35:13 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57782) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mtF8v-00016h-Ct; Fri, 03 Dec 2021 15:26:53 -0500 Received: from mail-eopbgr150132.outbound.protection.outlook.com ([40.107.15.132]:11453 helo=EUR01-DB5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mtF8t-0001bp-2G; Fri, 03 Dec 2021 15:26:53 -0500 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by AM0PR08MB3841.eurprd08.prod.outlook.com (2603:10a6:208:106::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.22; Fri, 3 Dec 2021 20:26:21 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::2078:5a2:1898:d83a]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::2078:5a2:1898:d83a%7]) with mapi id 15.20.4669.024; Fri, 3 Dec 2021 20:26:21 +0000 Received: from kvm.ch-qa.sw.ru (130.117.225.5) by AM6PR10CA0086.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:8c::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.16 via Frontend Transport; Fri, 3 Dec 2021 20:26:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TIHYYHz3876aPcqjfmxh6rW8aj995FuEAlh2z4uOxDDykHtef8hExctHCzba8qfpp9YNT+N4lMqOjuWcoO7dq3dnZe04ScvRWg6dfWXMX0xuqOSfllTPzQhjNmsCOBm82qIlbBCq3HJrHFoVSNHGB/7PKNrPZdTSzSw4KCJK0q2smnBF+ga9C+JM2GHeIEslQTKVYXcACy3OJbrStDlQgtTjE6/uYkuHi+rQQQW/SwQDPmRj3/GwjU5WBbe4gBgEYfXtXVj7BO9XS8ITzue1Yk4U3FAG/nVrxj5rxW3dmA6rnsg1VNbK1J8oP12codTczZlnVoYpfRzUyGM+3lB0OQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=YhoxgGe3Ea0Tt6RFHkgMQQ5XGu0P2U3WzRhaJRV7OeI=; b=gJZYRS6JuqbVQ+0HRRNnxJ3Fp6bGfywGDsj+h7zhn30y3N8gw6mEosgXZWrLPWinC9KMKQa5Mh6cninlnyMKCQhmTiZAuoCNsXz6RcwNzQx2AFFVoBfi3PDU+G7oePRoUKH0Q5dbF1Mq+gYggulaNSezJ41P1wi1vEfZ8Sdx1fLl4FB+DMYtQI5HnGW4GjdoE+QuN2c4Mqase+IfqsFDmP2h0Hkjvgt66C0JmRhg2IH+J4purIkcDQ+2Gd/QyC1TeSv2OHrAoA5JUsFVM7PO/6iQE71qWzbxg0RAeZMgn7FmAUG9KWXm7oaQ8W+DOCgVa9HbkSClyZuAdS1L5eYfdg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YhoxgGe3Ea0Tt6RFHkgMQQ5XGu0P2U3WzRhaJRV7OeI=; b=X5EPESk3lVSQ9N7MHMm3cJPDquZWbYz9vdlAeEdHrp77td1KSDewvCB4Jxy2VeixjRlLQ5Zc5jiibOK5QLTGReagBwIkCCnArvCevc8apKPNs9OkgyjgBPhx70NHPDRy70m0fWBebh7Lez7pWJ8BRhWeFVnJXUoJ6oyIM5/w6WQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, kwolf@redhat.com, hreitz@redhat.com, vsementsov@virtuozzo.com Subject: [PATCH 07/14] block: document connection between child roles and bs->backing/bs->file Date: Fri, 3 Dec 2021 21:25:46 +0100 Message-Id: <20211203202553.3231580-8-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211203202553.3231580-1-vsementsov@virtuozzo.com> References: <20211203202553.3231580-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM6PR10CA0086.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:8c::27) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e5f6ab20-8082-4344-13e1-08d9b69b2b44 X-MS-TrafficTypeDiagnostic: AM0PR08MB3841: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1107; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2+d+Uwh6viZ/9yOQLrXtUjYJBGJ5oPUJjCq1eCV8K3tzZy07DObjNx9Ang1pN/J6rfb2HLORza/2dZ/ZskZoBb0noQfrOwvPAiL61FSVpdlHIIO2HCV20Vcc0eKNmcu8OQUmxaNIviymroUO+6FMzcmpeUQgmOluEb9HpiR23wHahCqpc/RFwyNIQGFyAYN5I4AVAePAkl7x5A+WyuREEcRoPB3nf+Jq8u4VsALXv1gbEfWAo9FFL3Zg6bPHAU4D1xvVeNbsi8U7dqsAXhj0IkF/+n7imDG/TiLYX+wQTMUZSNU7sn3cJUk07oF4Wyq9frCS8zjUzwZnkuNaKIPLcqibQDnx24fHZousaDzGiRDsxCHvePYTT1635dgiPhszBGCJR+OI1oDaai9xXebOQqXTCLea2B+6tM5JGFYBT7CAALbwPZnaqe5UDL1LctzjlUEmRnWwZtTNRcr4gVxzrwN5K4cdYrJ2o5eLS2kyEdeK2/xqSV1mZBiXONO0hjGcMT59BhCm8t+0fWM+gT62fLWw0Fn1C9DEE7nRqW/BIx+v9yJh3++9yyNeTfDhDRrI2PmgGY1fBrzaFeCTrC4uVn8P4uU0WCRkNYItmfT2XjsR4ju1x9HhETFEBL9UX466PIWbt/8HDLFRkHgSsLaYHGfwd8G+LSumbsiPDfbvENPhnqbfU8mmfcVYOx1yJYqnofEXXMbjX/F1CXUmGJ5Oow== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(186003)(86362001)(2906002)(2616005)(6506007)(6916009)(1076003)(66946007)(26005)(36756003)(6666004)(66556008)(6512007)(52116002)(38100700002)(107886003)(83380400001)(38350700002)(8936002)(8676002)(5660300002)(508600001)(4326008)(6486002)(45080400002)(316002)(956004)(66476007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?SbN7VIVw6j7TcxkE01wZ2gYGs/U32M5+cMT5o5eHUhLJcQYsVrZjCGnulwtF?= =?us-ascii?Q?3keDSbhibxUHcXdzZULupWVoOYTAJg00ra7JLkZsbDK4IMsgVCK+MkC363sJ?= =?us-ascii?Q?yBo6Lr78Hqh/EDV+4PjDVpO9a8sBG5IDUPgqONY5bk+wjE1B0yOMERl2HF+p?= =?us-ascii?Q?QfxJUEI4HJCVGMMcQ8/F39l3BB2LYqy9Yhrq8KO5Y7IFzsMvItVB1aFx6tnc?= =?us-ascii?Q?4o07kHcvzM+r4hLrXY/hT/E2pqyRWGBXqc2XXWtO73AuG9PthAfnvSa0CGZK?= =?us-ascii?Q?TkwdPeeknf+gVufZvlQlFh7wK6lMI1f7y7I4vC+oJrZJvS74SduG2WYhaQ9I?= =?us-ascii?Q?AElbHdvK0WJ/65TO74fVn4guqpTP9v87Mi+XQzIfIowpl//5DhDujAhliEet?= =?us-ascii?Q?LlyPTmmd0oBuUmx3jnQm2/KZ8Qi5r12VJXbd+v8bpJOUxSTQVTgDYqGNEj1Z?= =?us-ascii?Q?GhP5TU2zadUz6rFKhBuVoiT8TUqOx+EPPGIFc9XEmfEp15sopBd7FTbjuzld?= =?us-ascii?Q?lkudpA4r165kzM7bY7zxFpK6LpBuWa9rpXWomGoruyUwwdw22qx5k8oEQFsf?= =?us-ascii?Q?47DoxgfK5FP0I8ZtV68tyXshVGsyqSdsDC76aB3j5sTC540xWxhxUSHiTYXS?= =?us-ascii?Q?/9TsKHhNpJgZqA75RMt46rCf1z0ffkX5PKdrd2KhDtSAO7STTReHUjlX+Qx8?= =?us-ascii?Q?/iPJOS3bNrRftcPEA+V3lL85IRhfxVGneBCNidISNb292qFiH1Qx2p8z3HXX?= =?us-ascii?Q?UaQuUqrGP1OxwgBX00/dpfS96F9HnGHNbPUAwg4HyAwTAOA27FlFQKtunV8k?= =?us-ascii?Q?f1oKr5YS9mVGFpwVXg+JALjZEVfdNNVgUmsqyfUO9sLyPKVhkAqRXq4AFPr+?= =?us-ascii?Q?hib2aAKt2YfasunSket8Bor5QxXtSdCOizOOwNhZIbj9//1xFi8vKpfGzJ9M?= =?us-ascii?Q?tZQMby4iAkw1czzjh6KmksocOjhhaKPGIpunlWIjgqtErswHC137YNyjGaGo?= =?us-ascii?Q?xEg9tnKNc6PvvquxRPP1Tix+LPcieMlka82nLdBNs9NbNAXQlrQhbjE4+zgo?= =?us-ascii?Q?Wh1UXsyiyLz6STLA9FiBpSgrDsdEHUpYwFINgpIj1uCr3F/lsK9ohCrJsL2m?= =?us-ascii?Q?IRPvKSbSyite+Vyd0G0VbRM+3E0L4rmLmcNdZ7ALyfXhpNc2NbQa10SY8Jab?= =?us-ascii?Q?In9aWYbiQ5KG1ODPBWwSWtbGY5k9AH/mgdZ0y/u4k72mlGHU2k7Yq0nJVANu?= =?us-ascii?Q?Q7STnZkuFxFgEBo7SSgFWnZXSqKRRB9gWUjeyPaViAV+9ekie66UEPlPFCug?= =?us-ascii?Q?cXNPylmJNXeaQiqhZRM8E5luNGF33BBeZNCbK7qWCIa18Sh0VqkGUnwCzv3j?= =?us-ascii?Q?7ZLk49YmoquRj+lh4OX4Lt5Dose9qIyRfyX1MDzJoTNjZlvZd6Q3GmwRlLBv?= =?us-ascii?Q?OZnAJqGo7+0ew46QdlLf1qBSUXhrcRT/KT3XnIkUjrj/xWEsVJ/h5AYWKyKo?= =?us-ascii?Q?K8uVWCpHMMB+perfpVPIHKAB7wt3tALpykjJqLbJq3PITL0l03pH51rfRM+9?= =?us-ascii?Q?vx44Qki7NTRnWdV90it4DmZgUNWTB8knG305n+8lKBO8XyS49cRWixDccaE2?= =?us-ascii?Q?3Rd8WjeNpdXHGnjEYtM0smH341OASzHmFEK6T+2dpxrUa8UIQzrTxjB/qSxv?= =?us-ascii?Q?l+It0Q=3D=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: e5f6ab20-8082-4344-13e1-08d9b69b2b44 X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2021 20:26:21.3167 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: z8IUMcWSQ46CzzEKAWU9avPgINPWC0sMVVigqVvsetdSg3kYmjHv17Gk6XNVpvVVacHlI1CBY1iW7CuG5WEFmSLHiCQb1ImqX3zaNZ6VXks= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3841 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=40.107.15.132; envelope-from=vsementsov@virtuozzo.com; helo=EUR01-DB5-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1638563714770100001 Content-Type: text/plain; charset="utf-8" Make the informal rules formal. In further commit we'll add corresponding assertions. Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/block/block.h | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/include/block/block.h b/include/block/block.h index f885f113ef..8a3278d4b6 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -290,6 +290,48 @@ enum { * * At least one of DATA, METADATA, FILTERED, or COW must be set for * every child. + * + * + * =3D Connection with bs->children, bs->file and bs->backing fields =3D + * + * 1. Filters + * + * Filter drivers has drv->is_filter =3D true. + * + * Filter driver has exactly one FILTERED|PRIMARY child, any may have other + * children which must not have these bits (the example is copy-before-wri= te + * filter that also has target DATA child). + * + * Filter driver never has COW children. + * + * For all filters except for mirror_top and commit_top, the filtered chil= d is + * linked in bs->file, bs->backing is NULL. + * + * For mirror_top and commit_top filtered child is linked in bs->backing a= nd + * their bs->file is NULL. These two filters has drv->filtered_child_is_ba= cking + * =3D true. + * + * 2. "raw" driver (block/raw-format.c) + * + * Formally it's not a filter (drv->is_filter =3D false) + * + * bs->backing is always NULL + * + * Only has one child, linked in bs->file. It's role is either FILTERED|PR= IMARY + * (like filter) either DATA|PRIMARY depending on options. + * + * 3. Other drivers + * + * Doesn't have any FILTERED children. + * + * May have at most one COW child. In this case it's linked in bs->backing. + * Otherwise bs->backing is NULL. COW child is never PRIMARY. + * + * May have at most one PRIMARY child. In this case it's linked in bs->fil= e. + * Otherwise bs->file is NULL. + * + * May also have some other children that don't have neither PRIMARY nor C= OW + * bits set. */ enum BdrvChildRoleBits { /* --=20 2.31.1 From nobody Thu May 16 17:05:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1638563853; cv=pass; d=zohomail.com; s=zohoarc; b=iSeM/Dnf66Qghcd4yzZpPsJ+IRKD17PShR652URhohVDvsftzk2VCPLUHJ6Z9uUio6qWwJ6dieAhoexIxqT4oTWD1/LpcQApnKduS8dfmRSBgkARjmmS3pkEEss4+IT/mZzyD+Lj80oTMvghrTn63N1o4EaK1Ijc0Q9CFl4i9i4= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638563853; h=Content-Type: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; bh=VcS5iw+7biQUKidhckmjzMK5OKupplkEZZwW4G9n3oE=; b=Wt1j0TWFLxvIJo0Xiu5cA/2/0Q/nR1+00sIPXZxTRs1zGSDx2ZcfgFupYsGEkT14IUFoKtgpXodeMJ9288AVMagGxR9aGeb4Tf4HzgOMv4rBgPqaVyr3xlhOwOZqYYKAcv09vCDE95LFTOJRbLcnJrmSvqbDUYES4CNX462RqpE= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1638563853748326.1299893867165; Fri, 3 Dec 2021 12:37:33 -0800 (PST) Received: from localhost ([::1]:58048 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mtFJE-0005v8-Jt for importer@patchew.org; Fri, 03 Dec 2021 15:37:32 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57814) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mtF8x-0001Fa-C6; Fri, 03 Dec 2021 15:26:55 -0500 Received: from mail-eopbgr150139.outbound.protection.outlook.com ([40.107.15.139]:14661 helo=EUR01-DB5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mtF8v-0001cv-Db; Fri, 03 Dec 2021 15:26:55 -0500 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by AM0PR08MB3841.eurprd08.prod.outlook.com (2603:10a6:208:106::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.22; Fri, 3 Dec 2021 20:26:22 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::2078:5a2:1898:d83a]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::2078:5a2:1898:d83a%7]) with mapi id 15.20.4669.024; Fri, 3 Dec 2021 20:26:22 +0000 Received: from kvm.ch-qa.sw.ru (130.117.225.5) by AM6PR10CA0086.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:8c::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.16 via Frontend Transport; Fri, 3 Dec 2021 20:26:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WHIDL22ykN2Hn9f7DN+ELunGr9bArU21SXvvbiODPw1fftuNxoKP9ma64XNdH/S/je3icbAUnq1oh4Zdt5muDgtNYoxL7q7AMQSCyxbj8noYOwww8ziI9m9Lbl5IXn23Y4GroFBCjIyodOfyr2VyDhMGD8t8HS6WSRZtf24nk8uOgaYMz+sXCntwEdekkvfyldtnTD9XAIkevYFRW+lmPM6p0SWb76huaAgo44rBlgWXmrO75bm9GZN287tpcNbieZnMycWxQAdKj+If8gW0sH+ODG4LgYceoJYpaNvSV3Fn/4IJSzB06O4Ba5nRLmXFZWvpcWz0l5lO1UFqnlZfng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=VcS5iw+7biQUKidhckmjzMK5OKupplkEZZwW4G9n3oE=; b=dpPgye+MPwLcUaGRb46USErG5AP/tAdybqvmU9JagG/WUtBGa2GA7UDnfWQSMmzDUp0hLCB2FQp4UTSemLbpfPEh1JP3aVnCSL43dZjq8UwAnIJCHm9biFpna+8SdeCu3PHW+4wHzYSv68Py0BLLO3jih6/Jqpa4+IB62VFQdrFoxYW9OpmIAo/BwwHQd48UTf09nWZT56icuq5LV+krXKS7f9MIodY7+6YmY3vvMAqXkQRGkTEWf4ccWgNhn/3EqSFzEtjNrGDneaXE4+ev4KlXv4986IxrxF2xiE+3JhWTz3XSEHTGXEAvEOnCPLCSAyE05A2JeZLu97LqPN9kDA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VcS5iw+7biQUKidhckmjzMK5OKupplkEZZwW4G9n3oE=; b=HRZXrCZoGa37XfF4tg4/UZY7qRafdhVoqF18I/iqJCw8TB3VqyEu4OqJxQEq+1dj8nMYryQHGuGhAnS5+zkEZb0e7bsZerwKemCVe1puY+xlkbiEKjnmorDPhGYgtlasbCDdEdNW4E3QmkFQHo5ui6fY2+gkN/Ia+MY45bZrnuw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, kwolf@redhat.com, hreitz@redhat.com, vsementsov@virtuozzo.com Subject: [PATCH 08/14] block/snapshot: stress that we fallback to primary child Date: Fri, 3 Dec 2021 21:25:47 +0100 Message-Id: <20211203202553.3231580-9-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211203202553.3231580-1-vsementsov@virtuozzo.com> References: <20211203202553.3231580-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM6PR10CA0086.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:8c::27) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c89d31eb-cfee-4daf-80fd-08d9b69b2b7d X-MS-TrafficTypeDiagnostic: AM0PR08MB3841: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rKxMwgbIz+OwlJIDpFY18PXBuCg4xxiDNQEx0KcHNylBwzxUyF6m/9JihbaUxNMsCfb+/mPq7Llws09Nyl2wATvMCh13Krtf55eD9saYTvvlOH9NTiKaVlyacPciT9A88RGigqKog19k4zar5DEBMOwjI/3AFmLaDQ4aYEmudhQ/zW+WCYNvhZhGSDFammJSDhZpVz3yBy4isxTzJpbZ2cGCaKvH1EexNkyZxKeHqjXg1TieRVKJlK+nXVNgUhNmAtDPO9MrkOkXxxHoJAyzeHRB5n0Ns1M0cI+2vRT7B6z2z8CkagNHcQYrVzoiNgy11iYYyJCzMvyKiog1K0Ej/axBp94I1LrqhvcE6SLWoWgSFTA93vBsPv1NDxzHNdCPsvWWTQpXB+T0yi2vBa4jXIj6j7+rpF1lOqkUSEInivduZurcNA7TC1LvldKqSbD1wCeJP3w4Q27dQ5kHz2pEnRvm2c/O4vYwdY+7J5FBVp1+05uQpRLj0+kmr1oqSXpiFAr8cnoffMVfetLNoFUe1wdXaUIWdsxEKWcrzMYta2PQszEJUuepTKcAuFpDwNWWz24D1uzwPr/ZE9OkkOgAE7z6oMvimylhkqYTBcTBDw8ugEmtNr5cFxKFjSYPFggVccB09cMCRbLGXDATxDVhEnQEQ8AkHilLZ/Phx7pwieQZq8g9UTtt63550/Myy/AiNzggeLoJOgwZ+sCjkvOu5w== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(186003)(86362001)(2906002)(2616005)(6506007)(6916009)(1076003)(66946007)(26005)(36756003)(6666004)(66556008)(6512007)(52116002)(38100700002)(107886003)(83380400001)(38350700002)(8936002)(8676002)(5660300002)(508600001)(4326008)(6486002)(316002)(956004)(66476007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?hg/w8n2a2DtgbbO0g1IP9zpDI5unrm3AuUDpHvww4X39JrbPIyHbJikFkM7v?= =?us-ascii?Q?PPwe8N52UrtUQ4i2/CNAiuCc2b639zK9eFX1CNI+T4t5r29GMccCX14zFVg+?= =?us-ascii?Q?a0S1QNCn0NWIzcqeJk3MKbWI5RfQcz3QyOfX1LzG9zs9KXTXStJOim2UTefB?= =?us-ascii?Q?EEviycScj9hRBhkXRFfbnZesLNRfLhZ4faEwBa1p0G9hbU/VudLpa47ceMFa?= =?us-ascii?Q?8HcNOEFUuxhceVJdIM0S9OHmO5/7QEgYuO89MopGZrTsYeEYKpjotHg7bLQt?= =?us-ascii?Q?NeBGwmoxFAV3QYhBTqB5d6Jof4hww5r2llmB/7jx7+b/LH7I6ExQ5ctAYyE7?= =?us-ascii?Q?UYap8Dt4A6Af7Gc1wfdG+oBDDXvsjpjFL+0qEjlpMoGdWwu8PBuo2JJ0zd1S?= =?us-ascii?Q?2EP8XSvR4anWcvxhsj6ueXhTGIfRURsyTZDF7tIG17bx8jjHJGdUa/EeH/2f?= =?us-ascii?Q?in8CbZUr+aBF6p9r+iSVNBTENdkCtpNpEpfZ9VdjFhfjkWTqbU5FQaHrgUOS?= =?us-ascii?Q?xKStRvI1+0HeDYJyORTjH/QZemax9NnAq/Djr9KcC3onWWX5ZpNZSG+Jn5qo?= =?us-ascii?Q?eB5MvVJ5ywX1AohZl7H21XIYzqCxyMMs9o4JFYr408QrswPH7URCaXGiRE7d?= =?us-ascii?Q?CvzZCzFm95Toao4WpVTTBGUmpoCTwkroXbIK8JR39g1AuY7NQqIubpLLWSux?= =?us-ascii?Q?5mCX4cMbmtoBwsAWAL8bkNwL3xSmAZY0ySMhPlqshcdLAQ2cdaQDsYpH0dlK?= =?us-ascii?Q?E2Bcom1H8hL8RU6MLy7peadTo2B96BoHftiP5u5FOx9SbfCLXxyCerrXNfZ1?= =?us-ascii?Q?JvbsvsjyCfj+1A/SWARwtabCG07G0YqJTIYV1LZEbcMY1jtC118wqPQGg++7?= =?us-ascii?Q?ZPXvrpOQYDGWrjg+/PW4O742yiDzq5X1pbRsOlLtG8J0D5ZIti84MWZ7AV7H?= =?us-ascii?Q?ZSp5YWm+cuRWeMdwTc3DFpAyUoXrrK4dc+gIPhJZmXdPVuHd0JmJ6raQBIb1?= =?us-ascii?Q?KTXrW4esf1Dnvy6NNk7bXEajHmK4B6JHYA5WghPEwjyiv/qLmcP/VWBKWuM1?= =?us-ascii?Q?iF0h+/DcQ6XYybD3BFfFuDtp08JGSIpatbHH9MeQRMo0d49g++TPVsVyu0gA?= =?us-ascii?Q?dxiNEOep6pfG1ea3G2eVVCwgutsUH/rI0n4GiLqkBexW7ENGiBgj9LVR2OI2?= =?us-ascii?Q?W7TY/JCHSLoTe540cnJ09XRgdz2h1pAwdl/9OIXrb5Sw1wUyoIrX8nR9MW45?= =?us-ascii?Q?E07fH5G2zQRmdSuKRZbbm5bdOudmRtpc3mufzk4cw1Iui4pklFtK2rD2XfcT?= =?us-ascii?Q?RR6xn6kXmZoDJmLsnRnsu2+kS4/bepQ4FY6YEyoaU/tvAaN/3PbrwPggGnCd?= =?us-ascii?Q?lEfFsKhIpaSflvSWK5gHY8hNdMrUdxv1mLpqrovAVjCc2swDJ7gaBQq/8g+g?= =?us-ascii?Q?NYEbtEfI7JF+dXgQsgX94e5QzBpWxiJSUJCgyyVGixNV3obfu1+Pl5d/wLBH?= =?us-ascii?Q?mEzotlyo/Jm6Mkusm4EBem1+ZfKGnX37HJhvYQuK8r4swkwByn5zPvFJeJnX?= =?us-ascii?Q?+gtJ6vEEUHuT10NkvdJedcgO7Sag4uRiMMTqIGhG9DYjdiBa2i9CG2J/uES7?= =?us-ascii?Q?Q5tWLM90OV1vQBInbeEhuQogFRYE/n7oDsBXVtsVniO4HO+SGbd8blquN3Cg?= =?us-ascii?Q?77c2sg=3D=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: c89d31eb-cfee-4daf-80fd-08d9b69b2b7d X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2021 20:26:22.0963 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: d/N1vQ0hws/UKyFqp5esL/Lt+meijwItE0Idnc5zDrkVEk/CGJ5sIdJgIL8TVolb8x3qnpQd0D9UfdBGXP1eAeCQ+dY4NpgL+UO6hMPAEOA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3841 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=40.107.15.139; envelope-from=vsementsov@virtuozzo.com; helo=EUR01-DB5-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1638563855176100001 Content-Type: text/plain; charset="utf-8" Actually what we chose is a primary child. Let's stress it in the code. We are going to drop indirect pointer logic here in future. Actually this commit simplifies the future work: we drop use of indirection in the assertion now. Signed-off-by: Vladimir Sementsov-Ogievskiy --- block/snapshot.c | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/block/snapshot.c b/block/snapshot.c index ccacda8bd5..12fa0e3904 100644 --- a/block/snapshot.c +++ b/block/snapshot.c @@ -158,21 +158,14 @@ bool bdrv_snapshot_find_by_id_and_name(BlockDriverSta= te *bs, static BdrvChild **bdrv_snapshot_fallback_ptr(BlockDriverState *bs) { BdrvChild **fallback; - BdrvChild *child; + BdrvChild *child =3D bdrv_primary_child(bs); =20 - /* - * The only BdrvChild pointers that are safe to modify (and which - * we can thus return a reference to) are bs->file and - * bs->backing. - */ - fallback =3D &bs->file; - if (!*fallback && bs->drv && bs->drv->is_filter) { - fallback =3D &bs->backing; - } - - if (!*fallback) { + /* We allow fallback only to primary child */ + if (!child) { return NULL; } + fallback =3D (child =3D=3D bs->file ? &bs->file : &bs->backing); + assert(*fallback =3D=3D child); =20 /* * Check that there are no other children that would need to be @@ -300,15 +293,12 @@ int bdrv_snapshot_goto(BlockDriverState *bs, } =20 /* - * fallback_ptr is &bs->file or &bs->backing. *fallback_ptr - * was closed above and set to NULL, but the .bdrv_open() call - * has opened it again, because we set the respective option - * (with the qdict_put_str() call above). - * Assert that .bdrv_open() has attached some child on - * *fallback_ptr, and that it has attached the one we wanted - * it to (i.e., fallback_bs). + * fallback was a primary child. It was closed above and set to NU= LL, + * but the .bdrv_open() call has opened it again, because we set t= he + * respective option (with the qdict_put_str() call above). + * Assert that .bdrv_open() has attached some BDS as primary child. */ - assert(*fallback_ptr && fallback_bs =3D=3D (*fallback_ptr)->bs); + assert(bdrv_primary_bs(bs) =3D=3D fallback_bs); bdrv_unref(fallback_bs); return ret; } --=20 2.31.1 From nobody Thu May 16 17:05:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1638563518; cv=pass; d=zohomail.com; s=zohoarc; b=E+op8tRrg0geiuKz4XEC5+ssnz549e4oR3wNff8EUgJ7aai7G1mp3P7BzrAWdWYaiSQZB+dYt1kZXrLq54VDcSEiaBHY48+bsNKiFUX7hkp63ms6PQJogDSlDBqdS91tm4tNW7sT10xOWSHWf9Ko7JI37aVLOu7UjxP+96DnRUU= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638563518; h=Content-Type: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; bh=uZvGX4zovZ9qw9xr/gKSNZRrvZVtKBZCYKmmnfizP34=; b=G0c9Fd36pm7iciBW+6wjJkq3qN9xdt7xJPL3crAclHgvaIsktBQafPkJjY0qFyTSYOYoTkcnPD4sBG91+i5e5b0IQ2ZdIdRJ9oIxKPlJbqcfGKSXqEvIHM1nwRlbdaSsYMBqva7P57CSsuXc6L1kufRm0TiX9rFmKuyx77jJckE= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1638563518396401.37712682477047; Fri, 3 Dec 2021 12:31:58 -0800 (PST) Received: from localhost ([::1]:41988 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mtFDp-0003Tx-9v for importer@patchew.org; Fri, 03 Dec 2021 15:31:57 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57562) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mtF8j-0000mR-Fp; Fri, 03 Dec 2021 15:26:42 -0500 Received: from mail-eopbgr70109.outbound.protection.outlook.com ([40.107.7.109]:27177 helo=EUR04-HE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mtF8X-0001ct-1e; Fri, 03 Dec 2021 15:26:35 -0500 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by AM0PR08MB4068.eurprd08.prod.outlook.com (2603:10a6:208:12b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.16; Fri, 3 Dec 2021 20:26:23 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::2078:5a2:1898:d83a]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::2078:5a2:1898:d83a%7]) with mapi id 15.20.4669.024; Fri, 3 Dec 2021 20:26:23 +0000 Received: from kvm.ch-qa.sw.ru (130.117.225.5) by AM6PR10CA0086.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:8c::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.16 via Frontend Transport; Fri, 3 Dec 2021 20:26:22 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lGvjHj0JasZP3XhpvujiChPMjY++GlVWL6oxE/3NCfUu7+izvjXdvCV+jkEiI6i+A583LYuV3D0vqGFpFV+g+anpbVjbRVtxYoCDRcTbPWg4UllJfyZOfbU3XmVUgIPkZfs6AZIkjuGDfVQ88f4O0G8C2pUv4XCwCZ/xd/xBTWX/1RXPyBH3BRV9w9A/K/NlPmdbCgaqalwgkWCHT4VJex90FsjiOmpSJCqzPIKyjYUp4yMcaWY+agIwoPAz2iRlDxh9eVX2BhtkstQ0GqWqVRPxkJm08tPcnAn+5ckOj6NDMmNHTg4wELAQ6ckBe+WdMerD/6dHSz0moODslerM2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=uZvGX4zovZ9qw9xr/gKSNZRrvZVtKBZCYKmmnfizP34=; b=SO14lw1fwnzbGT9PTr3+HMW18V+RtwsKJSlMOlFYAoKjPvkGy8OBDUMCnPnvqJN6h34DNnCsfyoKNv9xvJSlxfDkdIy/jNupYl1v4DKkGwcbLhakJ/wBgGMxyQn1T0o3rleZsjU1curYuL/CV/y9YjHHryUkw+RNB6oHBRhvc4HzQjwyhOsgL20qgaZwpQfr0f1Vc3JvCbuX4Pj7ynQGc2qEi/PvYlUrkYKOYRKKvY/MWSNx5T8+iHjD2cViHe2bKiTxPNhbAuVpbuZFuG2FIURSAMagC89m9mQBQJxCFEFk/xADICMNHfFZEixjkAes9FTKL9bY54VZePIU4SxMCg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uZvGX4zovZ9qw9xr/gKSNZRrvZVtKBZCYKmmnfizP34=; b=DJKryJ0BE1e7V3SBVsJcbNM+YR8fjCXI58k+W0Vy7x/+RYGYVK/1E0rMj03b8JpjakYYTBCfq4MALe3/gZwV3gHyo8l9IUqrG87BE7Ir1ts2RMRp0Gm/zDqdx+GwsI7n03SZLjqfBWVCzVpLUCAYlXlQkF5tdwSN/jv8O2N7IAo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, kwolf@redhat.com, hreitz@redhat.com, vsementsov@virtuozzo.com Subject: [PATCH 09/14] Revert "block: Let replace_child_noperm free children" Date: Fri, 3 Dec 2021 21:25:48 +0100 Message-Id: <20211203202553.3231580-10-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211203202553.3231580-1-vsementsov@virtuozzo.com> References: <20211203202553.3231580-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM6PR10CA0086.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:8c::27) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8b6ba73a-c7da-45ce-2e07-08d9b69b2c4d X-MS-TrafficTypeDiagnostic: AM0PR08MB4068: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:989; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BspJ1PfxvMlm+5S48VzN3O6EKUiZsj7L4954Wh3sKAY/nBQoZV5NwsQf6GxbJiV8oncKX4z+S5s/dn56U5W+nAWnjiQ5GR+BzupwsOZOrNa+5vOquS74jJ+ThaEDiLrSRk04gIlnHnpLMHYEz6/8y1NHPJGFGHP+RkUVPTT4+5aIJ9qYjjNXD+nJQbomZd8kQa6AC+pD5iWMClVdFCe4UetHmxfQdwdEuhJ9C4UUfgOTBGtyUzfMz50ulQAQBUiSlIiYjbbImmoQqAa3w2CAMvU8kLpw5xYUq789VoXC3hFOh3l0Ge49xZv93A+tW+dWsLB+ABhamg5jpRvTOT0WRFp2EjB7xaPQ5H7I8zztoHfLE5+pBdYruvoshG8FjdvmG3T7jQ4n1vAmVqczLKtsDQnTCEwEw+hdid5ubpmVpsTwZuPsIhsh1k+kr9yOdnCvZ2EMnle4TqWve7txZRW9thvPgfsupJZ/7tq2RqXx9Dy1S5YKDJ1Jykr90lLJwob6aqpDoSpQccIf8B9ODqqF2zF6vlbn221RX9c7vM9Hsfrvg3rvjPhPtP3Y74VQ7zVLmfKJWTH0ZEMf/+AY2miqUIMlSDRaSmwK6iN8IV8hlg1Oul8ZFwizf9ws72DAB3R3+KLNX08BLL6Q757KKrbN0kVekDJGeNgx3+LrvoDRr4DWR5nXKdZ8ng8QhyYe12qat12WztORwPe8KHqcwnOkjQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(1076003)(107886003)(83380400001)(26005)(6916009)(8936002)(2616005)(66556008)(2906002)(508600001)(6506007)(6666004)(38350700002)(66946007)(66476007)(38100700002)(52116002)(186003)(316002)(4326008)(6512007)(36756003)(6486002)(956004)(8676002)(5660300002)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?fih13V7O4bbO1rAtHnSRoru82shgk/0+Pj/1e2aaA+HNRSWAVHyDrKDxjZDQ?= =?us-ascii?Q?atA2LqXPBxtBfW4hKvI9tmDI3GdQT8HEb86VOrtYEJmdaKqoiBKpTQNoGzOU?= =?us-ascii?Q?YdiNYygjzyJt+/tDQ+iIH36+y3sv010OAZ30l3GhaXsjOFwGdhbQvHfGXzRx?= =?us-ascii?Q?u0TMeL4ImcAtnThbGiwyInNXlOIR04O3aegUgh7rVDClOBH/CpUTNwXWIBCI?= =?us-ascii?Q?auaTj+nAqEh7MCmto5ZgO0IRKu+LfGQQdgH9niFTSDXbjG0xVSU7r+O8lcfr?= =?us-ascii?Q?poQ2Fivlmj83lehOPlXQKFAhN6Ri/zA8/udNMXFHT1wet2mHJ2VsnFxvOi8w?= =?us-ascii?Q?kdeZnilFQAQ1ECmekqFE2EIK1BmxOjYVAWa4Z04Hfo8CDim8brwTUXLXHf0M?= =?us-ascii?Q?NqOUsqDlbOyVpFdsP6cE9xrIyhLvlSbTYaMHzJSOM2m6duIi/tt8nkYRqXk7?= =?us-ascii?Q?63+v5a0H7VnLTEYeh1r543fbZiH3U39hFO6nlVjJUv6TywcynyZUnzG5Sap/?= =?us-ascii?Q?DPc/Q26qWHAxFCVnpq21pfIfpqtyBJ6GqvzGiv56k9SIkz2ydI8XKHIiBX/Y?= =?us-ascii?Q?gChO+NE/XH3z9pfD3TXXB95hk6IlMDp1ErAXrvFYScileHZfXN7ZFMDdAtqL?= =?us-ascii?Q?YhrNWHXcLOdYhd/+W2q47reLIfZX00Gl6OpFW2hw4x81erYVoW3OxOElRQHi?= =?us-ascii?Q?x0bN4AIreG9FTVj0rvuWMoAhGQbpXW1kwgBRsoH7W/kH8QPlk3Xkm0iVTG2k?= =?us-ascii?Q?dbnG3YNGmwI0EVkxwFgceYT0sOLsW3KxmTLcQy84CvxOqfpHqEGEr0uvCDN/?= =?us-ascii?Q?XLNkTnYUjzuI62dvhPDcCWn+J1PNFEmfolNuGOLfGj4dmMcdUeI4ngPn/41O?= =?us-ascii?Q?ipQvalTvTwiZH8zjPMQnOoi76KkoVomOn8wg5sA3bTiVeV40X4df8FurzQIQ?= =?us-ascii?Q?ic1K/VoYq4XB4H49Rb08sRep5uc1QyVe6O4nnf5tH0aCYQJ1HigrL6Jc+hMS?= =?us-ascii?Q?dFIjWMSDNy0+LezF6aOPoOXP+nwGi0chQ0M4XB/K47q6U1CFxnXnmy6PCczN?= =?us-ascii?Q?7CCSiJHcf7ArPVFkngQJ6eVhc+uUP1ymQSbTV6Ud47g/c7UPBVnFx1bbGFg+?= =?us-ascii?Q?+pKlV5y5EaHLD7slxm5Tz++9Jx1Mpgf6cQsWp0G7kWZzFjP985c5yj7FXMSb?= =?us-ascii?Q?vYMO4IXQPmMisrNGv1NxqDi8tB9OVkePKcA1OEXcVuEaIvzbxbfg5fw6iytq?= =?us-ascii?Q?nszz8s/OW6ZRn8htNPptcwNIm0iOUL4X1eUAqNMmJm30YcFmvsoA93NzWyif?= =?us-ascii?Q?ag0mji2LUGpSP3BPRKz4GidmIZnCTi/OFoGoHBUu8L4XhXO7s6qxp5iD4wM8?= =?us-ascii?Q?+HVLHUXJnpwIpvE6TYNByfSXqSsSPzFuU2bxURTwr1GLztibZs9AeKOzk9GY?= =?us-ascii?Q?uRaqdD9POr2EHOfM248TGhIyJOuMNrOFwCD/NU7s5V5AdfOJ8tqd4gRd+v8w?= =?us-ascii?Q?5cu5WS5Z7L0sOCZRXrK42fh2eBDQQAKYwSxFlx1uKlyFip7q1pW8MsGV5Ip6?= =?us-ascii?Q?P6RM2QdvSLTkUKmRwaVyFYvc+cR5SNVyl5N3M0Vk1cgeKsftRWNJngVS+oOc?= =?us-ascii?Q?2MtNT+13IEYAkb+OUnRV5iXU+e+J1pgI4Z79a2Uj0BxQCS5yqvUxID5DbE6v?= =?us-ascii?Q?k/mjmA=3D=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8b6ba73a-c7da-45ce-2e07-08d9b69b2c4d X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2021 20:26:22.9824 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: OPhQGGwOo8H4KCVnbkBWC3tzn8Lm7AIh29hF8aSGtR6xsq5K6yFMza+TMvkwaHGiILHquh7DPoLbToq6BSHgbT6g1W6YLPEOB7TdaaKF/1s= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4068 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=40.107.7.109; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-HE1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1638563519190100001 Content-Type: text/plain; charset="utf-8" We are going to reimplement this behavior (clear bs->file / bs->backing pointers automatically when child->bs is cleared) in a nicer way. This reverts commit b0a9f6fed3d80de610dcd04a7e66f9f30a04174f. Signed-off-by: Vladimir Sementsov-Ogievskiy --- block.c | 102 +++++++++++++------------------------------------------- 1 file changed, 23 insertions(+), 79 deletions(-) diff --git a/block.c b/block.c index a97720c5eb..69c20c729a 100644 --- a/block.c +++ b/block.c @@ -87,10 +87,8 @@ static BlockDriverState *bdrv_open_inherit(const char *f= ilename, static bool bdrv_recurse_has_child(BlockDriverState *bs, BlockDriverState *child); =20 -static void bdrv_child_free(BdrvChild *child); static void bdrv_replace_child_noperm(BdrvChild **child, - BlockDriverState *new_bs, - bool free_empty_child); + BlockDriverState *new_bs); static void bdrv_remove_file_or_backing_child(BlockDriverState *bs, BdrvChild *child, Transaction *tran); @@ -2258,16 +2256,12 @@ typedef struct BdrvReplaceChildState { BdrvChild *child; BdrvChild **childp; BlockDriverState *old_bs; - bool free_empty_child; } BdrvReplaceChildState; =20 static void bdrv_replace_child_commit(void *opaque) { BdrvReplaceChildState *s =3D opaque; =20 - if (s->free_empty_child && !s->child->bs) { - bdrv_child_free(s->child); - } bdrv_unref(s->old_bs); } =20 @@ -2284,26 +2278,22 @@ static void bdrv_replace_child_abort(void *opaque) * modify the BdrvChild * pointer we indirectly pass to it, i.e. it * will not modify s->child. From that perspective, it does not m= atter * whether we pass s->childp or &s->child. + * (TODO: Right now, bdrv_replace_child_noperm() never modifies th= at + * pointer anyway (though it will in the future), so at this point= it + * absolutely does not matter whether we pass s->childp or &s->chi= ld.) * (2) If new_bs is not NULL, s->childp will be NULL. We then cannot = use * it here. * (3) If new_bs is NULL, *s->childp will have been NULLed by * bdrv_replace_child_tran()'s bdrv_replace_child_noperm() call, a= nd we * must not pass a NULL *s->childp here. + * (TODO: In its current state, bdrv_replace_child_noperm() will n= ot + * have NULLed *s->childp, so this does not apply yet. It will in= the + * future.) * * So whether new_bs was NULL or not, we cannot pass s->childp here; a= nd in * any case, there is no reason to pass it anyway. */ - bdrv_replace_child_noperm(&s->child, s->old_bs, true); - /* - * The child was pre-existing, so s->old_bs must be non-NULL, and - * s->child thus must not have been freed - */ - assert(s->child !=3D NULL); - if (!new_bs) { - /* As described above, *s->childp was cleared, so restore it */ - assert(s->childp !=3D NULL); - *s->childp =3D s->child; - } + bdrv_replace_child_noperm(&s->child, s->old_bs); bdrv_unref(new_bs); } =20 @@ -2320,44 +2310,30 @@ static TransactionActionDrv bdrv_replace_child_drv = =3D { * * The function doesn't update permissions, caller is responsible for this. * - * (*childp)->bs must not be NULL. - * * Note that if new_bs =3D=3D NULL, @childp is stored in a state object at= tached * to @tran, so that the old child can be reinstated in the abort handler. * Therefore, if @new_bs can be NULL, @childp must stay valid until the * transaction is committed or aborted. * - * If @free_empty_child is true and @new_bs is NULL, the BdrvChild is - * freed (on commit). @free_empty_child should only be false if the - * caller will free the BDrvChild themselves (which may be important - * if this is in turn called in another transactional context). + * (TODO: The reinstating does not happen yet, but it will once + * bdrv_replace_child_noperm() NULLs *childp when new_bs is NULL.) */ static void bdrv_replace_child_tran(BdrvChild **childp, BlockDriverState *new_bs, - Transaction *tran, - bool free_empty_child) + Transaction *tran) { BdrvReplaceChildState *s =3D g_new(BdrvReplaceChildState, 1); *s =3D (BdrvReplaceChildState) { .child =3D *childp, .childp =3D new_bs =3D=3D NULL ? childp : NULL, .old_bs =3D (*childp)->bs, - .free_empty_child =3D free_empty_child, }; tran_add(tran, &bdrv_replace_child_drv, s); =20 - /* The abort handler relies on this */ - assert(s->old_bs !=3D NULL); - if (new_bs) { bdrv_ref(new_bs); } - /* - * Pass free_empty_child=3Dfalse, we will free the child (if - * necessary) in bdrv_replace_child_commit() (if our - * @free_empty_child parameter was true). - */ - bdrv_replace_child_noperm(childp, new_bs, false); + bdrv_replace_child_noperm(childp, new_bs); /* old_bs reference is transparently moved from *childp to @s */ } =20 @@ -2729,22 +2705,8 @@ uint64_t bdrv_qapi_perm_to_blk_perm(BlockPermission = qapi_perm) return permissions[qapi_perm]; } =20 -/** - * Replace (*childp)->bs by @new_bs. - * - * If @new_bs is NULL, *childp will be set to NULL, too: BDS parents - * generally cannot handle a BdrvChild with .bs =3D=3D NULL, so clearing - * BdrvChild.bs should generally immediately be followed by the - * BdrvChild pointer being cleared as well. - * - * If @free_empty_child is true and @new_bs is NULL, the BdrvChild is - * freed. @free_empty_child should only be false if the caller will - * free the BdrvChild themselves (this may be important in a - * transactional context, where it may only be freed on commit). - */ static void bdrv_replace_child_noperm(BdrvChild **childp, - BlockDriverState *new_bs, - bool free_empty_child) + BlockDriverState *new_bs) { BdrvChild *child =3D *childp; BlockDriverState *old_bs =3D child->bs; @@ -2781,9 +2743,6 @@ static void bdrv_replace_child_noperm(BdrvChild **chi= ldp, } =20 child->bs =3D new_bs; - if (!new_bs) { - *childp =3D NULL; - } =20 if (new_bs) { QLIST_INSERT_HEAD(&new_bs->parents, child, next_parent); @@ -2813,10 +2772,6 @@ static void bdrv_replace_child_noperm(BdrvChild **ch= ildp, bdrv_parent_drained_end_single(child); drain_saldo++; } - - if (free_empty_child && !child->bs) { - bdrv_child_free(child); - } } =20 /** @@ -2846,14 +2801,7 @@ static void bdrv_attach_child_common_abort(void *opa= que) BdrvChild *child =3D *s->child; BlockDriverState *bs =3D child->bs; =20 - /* - * Pass free_empty_child=3Dfalse, because we still need the child - * for the AioContext operations on the parent below; those - * BdrvChildClass methods all work on a BdrvChild object, so we - * need to keep it as an empty shell (after this function, it will - * not be attached to any parent, and it will not have a .bs). - */ - bdrv_replace_child_noperm(s->child, NULL, false); + bdrv_replace_child_noperm(s->child, NULL); =20 if (bdrv_get_aio_context(bs) !=3D s->old_child_ctx) { bdrv_try_set_aio_context(bs, s->old_child_ctx, &error_abort); @@ -2875,6 +2823,7 @@ static void bdrv_attach_child_common_abort(void *opaq= ue) =20 bdrv_unref(bs); bdrv_child_free(child); + *s->child =3D NULL; } =20 static TransactionActionDrv bdrv_attach_child_common_drv =3D { @@ -2952,9 +2901,7 @@ static int bdrv_attach_child_common(BlockDriverState = *child_bs, } =20 bdrv_ref(child_bs); - bdrv_replace_child_noperm(&new_child, child_bs, true); - /* child_bs was non-NULL, so new_child must not have been freed */ - assert(new_child !=3D NULL); + bdrv_replace_child_noperm(&new_child, child_bs); =20 *child =3D new_child; =20 @@ -3013,7 +2960,8 @@ static void bdrv_detach_child(BdrvChild **childp) { BlockDriverState *old_bs =3D (*childp)->bs; =20 - bdrv_replace_child_noperm(childp, NULL, true); + bdrv_replace_child_noperm(childp, NULL); + bdrv_child_free(*childp); =20 if (old_bs) { /* @@ -5024,11 +4972,7 @@ static void bdrv_remove_file_or_backing_child(BlockD= riverState *bs, } =20 if (child->bs) { - /* - * Pass free_empty_child=3Dfalse, we will free the child in - * bdrv_remove_filter_or_cow_child_commit() - */ - bdrv_replace_child_tran(childp, NULL, tran, false); + bdrv_replace_child_tran(childp, NULL, tran); } =20 s =3D g_new(BdrvRemoveFilterOrCowChild, 1); @@ -5038,6 +4982,8 @@ static void bdrv_remove_file_or_backing_child(BlockDr= iverState *bs, .is_backing =3D (childp =3D=3D &bs->backing), }; tran_add(tran, &bdrv_remove_filter_or_cow_child_drv, s); + + *childp =3D NULL; } =20 /* @@ -5080,7 +5026,7 @@ static int bdrv_replace_node_noperm(BlockDriverState = *from, * Passing a pointer to the local variable @c is fine here, because * @to is not NULL, and so &c will not be attached to the transact= ion. */ - bdrv_replace_child_tran(&c, to, tran, true); + bdrv_replace_child_tran(&c, to, tran); } =20 return 0; @@ -5236,9 +5182,7 @@ int bdrv_replace_child_bs(BdrvChild *child, BlockDriv= erState *new_bs, bdrv_drained_begin(old_bs); bdrv_drained_begin(new_bs); =20 - bdrv_replace_child_tran(&child, new_bs, tran, true); - /* @new_bs must have been non-NULL, so @child must not have been freed= */ - assert(child !=3D NULL); + bdrv_replace_child_tran(&child, new_bs, tran); =20 found =3D g_hash_table_new(NULL, NULL); refresh_list =3D bdrv_topological_dfs(refresh_list, found, old_bs); --=20 2.31.1 From nobody Thu May 16 17:05:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1638563479; cv=pass; d=zohomail.com; s=zohoarc; b=Ac3pp7NYtn7LvF7oUW0+UszJKzT9wMLfLzk+uX8Lg6cp4ujfnGklFQydvj6tDOKTHJYypYTnGrsueuwUeLpCnqFai5GGRBShs/QQXvN503iNpGR5skFa2EgzIqbixxbsRyzqiP4nYCMpfm4A2Chl2dRHdKXVWn4cT1+wAsAEEVs= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638563479; h=Content-Type: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; bh=YoUKZY5FKOIdIUZUJQktFcRHljwq+//pgf/6H6t8gh0=; b=Y6d8Q3UvnJGagOIKkBftFZdAhESbBTg3c1aKqcEN2pgPJXdtq+HeOp3diFoyevNHrrPAhkElhGxOOuPc86eVrSo6sWBTJ08fKGTz/YAPuJ6U7EERUX6YCqzYf8rsc3NzKLlHVQBBUsl6sOZHUFbbnUYoKi4lJLhw+vMa6YYTwZw= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1638563479598800.7143971815022; Fri, 3 Dec 2021 12:31:19 -0800 (PST) Received: from localhost ([::1]:38868 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mtFDC-0001Jn-Az for importer@patchew.org; Fri, 03 Dec 2021 15:31:18 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57590) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mtF8m-0000nA-6I; Fri, 03 Dec 2021 15:26:44 -0500 Received: from mail-db8eur05on2098.outbound.protection.outlook.com ([40.107.20.98]:1792 helo=EUR05-DB8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mtF8c-0001dZ-4n; Fri, 03 Dec 2021 15:26:43 -0500 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by AM0PR08MB4068.eurprd08.prod.outlook.com (2603:10a6:208:12b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.16; Fri, 3 Dec 2021 20:26:23 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::2078:5a2:1898:d83a]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::2078:5a2:1898:d83a%7]) with mapi id 15.20.4669.024; Fri, 3 Dec 2021 20:26:23 +0000 Received: from kvm.ch-qa.sw.ru (130.117.225.5) by AM6PR10CA0086.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:8c::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.16 via Frontend Transport; Fri, 3 Dec 2021 20:26:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iCYJ9KZdy3AjbZmSZdTmqJMRQ9cETZL22ulHHfbCtdF2wWUtR35tFUqBEz43/9It0gH5o9Iw+5iOzEoAu1iEJLLckGsw6BTMwlROEzxdPHalqbjQj3efWKv8TU1E/ayzf/AsgVFrIcWClyqYvTGW1hOHF09Q8EK3VZxD7WBLaYTyRLA7P38KngXrP/xdv5wpMYVk5iLfDVww4iOLXQeBu7vVeAMYw/ro7voPeEyvKl3FqzCM2DVjL3Sc5nyTdlQnPvgHPgh7ZNegbQkIzmLfpdZoD8cNpPNUQvaocB0DgNuJ/epJgTkktdLzihK5T3YV8F/O2mZW9ZvZl15JOebpSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=YoUKZY5FKOIdIUZUJQktFcRHljwq+//pgf/6H6t8gh0=; b=WDUNJMKU0gz246BKDceqRoep/wcEk6zBO0lSlL+u1T0BRKwwUVjHxD0+7fcZjJuRyoY4VaqCiWxQ6Bn4ffXJ3DwcT+SwvOTMH/eVS3+a3NxcazKERhsPdg7+VgSGtuV9GEgIhWCSuM1jtVCrC2XVsPwlBx589l0KRkP8i4aPgFGMZFPNpdoe0t7UOYUZwS3e7kE5IrGtwHr+DsPxXPl0U9wYkZz27Hg9bWWG+lBKgkfC909mTpOm9n5ZA/sJksMO7RDyJIVcQMJMgu2XlLJp30OfEcsqAaTNMpNfssAi5SwlE2bgZ6BH8SAp3OgxgCyFJEkVyeVzQMFVHhbCzxP2gA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YoUKZY5FKOIdIUZUJQktFcRHljwq+//pgf/6H6t8gh0=; b=g/W55+TO1fdoKZJujuajnqBsQEVyBg/HYmPatYWl8JCupqgRuDDwVqmJs59Q0kpuNHMQdWccyC06Gd2AsIfzUKmZWwuIexaBcIypsEVtx1q6Rgi+bjxwRGOy2z8TB0WkWtTsiy6kECKh/CnCQlXMUacDN2IZbjBoAlT0nlvWpy0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, kwolf@redhat.com, hreitz@redhat.com, vsementsov@virtuozzo.com Subject: [PATCH 10/14] Revert "block: Let replace_child_tran keep indirect pointer" Date: Fri, 3 Dec 2021 21:25:49 +0100 Message-Id: <20211203202553.3231580-11-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211203202553.3231580-1-vsementsov@virtuozzo.com> References: <20211203202553.3231580-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM6PR10CA0086.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:8c::27) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 85dc4410-e055-4633-4105-08d9b69b2c96 X-MS-TrafficTypeDiagnostic: AM0PR08MB4068: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:901; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zPdUrSEHPfbOPb4O9Lg6G6ygvU3OZD1lKsEtZavtJGEpuy3r1WedHS49wraCHPnNXU3SI16w40zK5YU76yEJtmUj69tdvsUu1gocdpW+c4qju9eibHj4D1PfUzLf2kcaObOyhqaWB6mZSOZCG0igIv/Ymr0I8RFjwYW5wmn0HlIeAnGvIazqGWKixqsVtqvedkfbbGoKz984uhRc1lTgMoWo822bjlndJY2GjyLxkohcL8GErV0B0mQQSLGCk5CVwA5RViHd/BjCY1MBN3Kd0gCOovRJ935Vs+nyfcb2E42r4MPMR5c0FFCloAS1KQHVjJomkaBxb3ub+zfVU3jQSjfm8Vj7hMzT+37OmGW0vhsIryT2OObXCwFJBua3oh1sIkVLkFK1vI2EJ/Y7x9rcu0GlCJcMKN+YVbrhiFwoTQPcJMrqyh7wSJ+NiGBtHT0DANRKDtWzoNRKuIc0JcA5kVVmcUrUv6tgVliOKI31G5I2cgAbg7LaPyz1ZwIABeFtPLXzH4sOHhix2qV6C3KBrNWiGZJv/uXnnnpwE8JMzjUWY6krRsssEjKdtEnXhJAJWU9H+aM5BiLoQpLcNTm3aOVzcUdt7fCaSDLZPTBqVbOUEh/LZ1HmuhzwKipKMD9d2oqh/TmbXZ82IxCVB8s94yOFXuWa580CFIya9/I7qJ9mMSq61aMVsL+BglBBOgwa X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(1076003)(107886003)(83380400001)(26005)(6916009)(8936002)(2616005)(66556008)(2906002)(508600001)(6506007)(6666004)(38350700002)(66946007)(66476007)(38100700002)(52116002)(186003)(316002)(4326008)(6512007)(36756003)(6486002)(956004)(8676002)(5660300002)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?1GC2dVttmgnlqBbPnpMqMVv8n1jrlWHSqb5JRFkunbwrtieT+dQtivyGeQ/d?= =?us-ascii?Q?amkh2VsN/aAwB2GFIx0xJmN/DXevCWIjQwh+QWb4eYM+D3Wz+T500XYnlXv9?= =?us-ascii?Q?mlErQj1p1Rr2eZ6YGnnu1s0QO3XAv3U5agb4KCX6PKiko0DnnaQCSC52zRf3?= =?us-ascii?Q?m3YfoxRDg4PaKv18GeryDoZ6ObzsnOJmPOy9SxhInMiTSU8m8wcsNsFaU+//?= =?us-ascii?Q?itFBwS+y91HDo9t7KZxQYijLlTr5s+NnHN0tzs6+X/97lRyAmU5ADPZQa7Uy?= =?us-ascii?Q?0IVPRU4eP8c3WFKDv34m6VWAwu59kZQthewjMTMglQ1eXRiBad2o7jbC5oxJ?= =?us-ascii?Q?NkPPLfEb0lBhmcOu6UTKskKNIiEOrjmfx4l6wgdQPOC/Wl8ti3Y69mXONj7u?= =?us-ascii?Q?bxz45SPVJAtTJvqVq7a7c8O9abehpewBS16fAUFFhli3jByedoLSpgFBS9G+?= =?us-ascii?Q?7HtVd7Xegdg9MPhtZ3kOG2MJixHzsBgJG6M7RAurUWoNAZEeFkjvBdz9LOR4?= =?us-ascii?Q?w0UjXDVR+kPwRUgHXA+VM8XMpMITCDO6acdXx/tEoa8y4pAwx++gFvaNKUNW?= =?us-ascii?Q?8o5jeOCVFtUK8CQrgPjtBkgZh85lnGPn7K3HpOO+s2lHvNuYvkUUBPGIiTth?= =?us-ascii?Q?PCFKvJlXLyRQgxOxvM2DkS79UtGzYiaXoli+J0nqzkE19fhtlfWjnqHksAdp?= =?us-ascii?Q?Lz/jD8UZnR4d07hBhEYzi415NqctsitbFxiudJMeo942tHyIvxzo/fWx+HpH?= =?us-ascii?Q?EfNIBFHrhP0oETHJNr3ZYmeGRHv+czxCqihWPK4iHTtFQSjfBCS4rsD+3CvW?= =?us-ascii?Q?00t5HxN692NVeDd9l2JYn0+HX/FyTCT4mMjtnFnE+7kwC2NjWx8mXm/xBXaW?= =?us-ascii?Q?lwpG3xGbkmYyGhpSWgj6MC9/ndleRO6j5aTqXGgnxMCzKHdoj2k+O+IZSeTV?= =?us-ascii?Q?a8osC15FnAmx6BlgogCd4Mk5EeyXVgGbbLMm8lDnbMmp5jAtWd/Zw0rKCTZS?= =?us-ascii?Q?7lK6gCEMaNDqW8FXOSFKNMtxRNUiNqaiT6oWaLI6qdA+YSmdCj5R6Ap83eFC?= =?us-ascii?Q?haZYF7kWfjn+xsnVJBX15R8bEOl1MEmjFUliW52M6BhKm5tinE84iiv4odR8?= =?us-ascii?Q?dihXXeIq44i65tzlFEoIp6saWUIw0e0E2Gy8LhEEt3hLANOyrOc1Su636ElT?= =?us-ascii?Q?EZMD5Juw/A1O8vMV7jNRs9i/kjXVkd2kyQF4ExCnFs/V3Ei8+4n2/coRZuS7?= =?us-ascii?Q?yQH0M45SYy1P0eszbuFTRjGfA2QFsrXxCUz8NLNhbmj6gHZNPKaL1SR8JORi?= =?us-ascii?Q?J6bZ5AcZ5CfVDKm+5Dxm0uBOLzttC394agcxregTU9JyQidRi8bgfixfDBzr?= =?us-ascii?Q?cEWTGgpIzpndI9LOAEgtJZzyovlUHyZ6/+x1zDgo3qss5nz3XhowGrYay7sO?= =?us-ascii?Q?mmNPRsHY4f/GVbznRSDt+hqAd6urA8MKWHg9GUp3hLYPpiMYLJZhj4FrNJNX?= =?us-ascii?Q?+RXL/tr5ovVEQJXj6clBpIb5cHbRo7PlIjysjWDzFrlh81d8Jr642NZFmQDJ?= =?us-ascii?Q?BTSRuHRpjIrLo8AMBFEcIUnve/3/bHw6p7cytxqxgU0i2bDe0UtcbyC5LpIL?= =?us-ascii?Q?7Gyk3lBYSOqNTJrYcf4ZgwGKxeuxCk/p1QNNNzSZEJtRcwqh+/cv4roXOUJV?= =?us-ascii?Q?CVI9ow=3D=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 85dc4410-e055-4633-4105-08d9b69b2c96 X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2021 20:26:23.6226 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: U2MutPTBoHE77D2fvqFiSroTglmtwAQpAW3dFN8Er8asdkENK8Eit2Iae+ToZooT8TNaiy+sMqaWOBkNML3gu8s+kD4v55fBdwKgGAHpLtc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4068 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=40.107.20.98; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-DB8-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1638563480708100001 Content-Type: text/plain; charset="utf-8" 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 82b54cf51656bf3cd5ed1ac549e8a1085a0e3290. Signed-off-by: Vladimir Sementsov-Ogievskiy --- block.c | 83 +++++++-------------------------------------------------- 1 file changed, 10 insertions(+), 73 deletions(-) diff --git a/block.c b/block.c index 69c20c729a..3eec53796b 100644 --- a/block.c +++ b/block.c @@ -2254,7 +2254,6 @@ static int bdrv_drv_set_perm(BlockDriverState *bs, ui= nt64_t perm, =20 typedef struct BdrvReplaceChildState { BdrvChild *child; - BdrvChild **childp; BlockDriverState *old_bs; } BdrvReplaceChildState; =20 @@ -2270,29 +2269,7 @@ static void bdrv_replace_child_abort(void *opaque) BdrvReplaceChildState *s =3D opaque; BlockDriverState *new_bs =3D s->child->bs; =20 - /* - * old_bs reference is transparently moved from @s to s->child. - * - * Pass &s->child here instead of s->childp, because: - * (1) s->old_bs must be non-NULL, so bdrv_replace_child_noperm() will= not - * modify the BdrvChild * pointer we indirectly pass to it, i.e. it - * will not modify s->child. From that perspective, it does not m= atter - * whether we pass s->childp or &s->child. - * (TODO: Right now, bdrv_replace_child_noperm() never modifies th= at - * pointer anyway (though it will in the future), so at this point= it - * absolutely does not matter whether we pass s->childp or &s->chi= ld.) - * (2) If new_bs is not NULL, s->childp will be NULL. We then cannot = use - * it here. - * (3) If new_bs is NULL, *s->childp will have been NULLed by - * bdrv_replace_child_tran()'s bdrv_replace_child_noperm() call, a= nd we - * must not pass a NULL *s->childp here. - * (TODO: In its current state, bdrv_replace_child_noperm() will n= ot - * have NULLed *s->childp, so this does not apply yet. It will in= the - * future.) - * - * So whether new_bs was NULL or not, we cannot pass s->childp here; a= nd in - * any case, there is no reason to pass it anyway. - */ + /* old_bs reference is transparently moved from @s to @s->child */ bdrv_replace_child_noperm(&s->child, s->old_bs); bdrv_unref(new_bs); } @@ -2309,32 +2286,22 @@ static TransactionActionDrv bdrv_replace_child_drv = =3D { * Note: real unref of old_bs is done only on commit. * * The function doesn't update permissions, caller is responsible for this. - * - * Note that if new_bs =3D=3D NULL, @childp is stored in a state object at= tached - * to @tran, so that the old child can be reinstated in the abort handler. - * Therefore, if @new_bs can be NULL, @childp must stay valid until the - * transaction is committed or aborted. - * - * (TODO: The reinstating does not happen yet, but it will once - * bdrv_replace_child_noperm() NULLs *childp when new_bs is NULL.) */ -static void bdrv_replace_child_tran(BdrvChild **childp, - BlockDriverState *new_bs, +static void bdrv_replace_child_tran(BdrvChild *child, BlockDriverState *ne= w_bs, Transaction *tran) { BdrvReplaceChildState *s =3D g_new(BdrvReplaceChildState, 1); *s =3D (BdrvReplaceChildState) { - .child =3D *childp, - .childp =3D new_bs =3D=3D NULL ? childp : NULL, - .old_bs =3D (*childp)->bs, + .child =3D child, + .old_bs =3D child->bs, }; tran_add(tran, &bdrv_replace_child_drv, s); =20 if (new_bs) { bdrv_ref(new_bs); } - bdrv_replace_child_noperm(childp, new_bs); - /* old_bs reference is transparently moved from *childp to @s */ + bdrv_replace_child_noperm(&child, new_bs); + /* old_bs reference is transparently moved from @child to @s */ } =20 /* @@ -4898,7 +4865,6 @@ static bool should_update_child(BdrvChild *c, BlockDr= iverState *to) =20 typedef struct BdrvRemoveFilterOrCowChild { BdrvChild *child; - BlockDriverState *bs; bool is_backing; } BdrvRemoveFilterOrCowChild; =20 @@ -4928,19 +4894,10 @@ static void bdrv_remove_filter_or_cow_child_commit(= void *opaque) bdrv_child_free(s->child); } =20 -static void bdrv_remove_filter_or_cow_child_clean(void *opaque) -{ - BdrvRemoveFilterOrCowChild *s =3D opaque; - - /* Drop the bs reference after the transaction is done */ - bdrv_unref(s->bs); - g_free(s); -} - static TransactionActionDrv bdrv_remove_filter_or_cow_child_drv =3D { .abort =3D bdrv_remove_filter_or_cow_child_abort, .commit =3D bdrv_remove_filter_or_cow_child_commit, - .clean =3D bdrv_remove_filter_or_cow_child_clean, + .clean =3D g_free, }; =20 /* @@ -4958,11 +4915,6 @@ static void bdrv_remove_file_or_backing_child(BlockD= riverState *bs, return; } =20 - /* - * Keep a reference to @bs so @childp will stay valid throughout the - * transaction (required by bdrv_replace_child_tran()) - */ - bdrv_ref(bs); if (child =3D=3D bs->backing) { childp =3D &bs->backing; } else if (child =3D=3D bs->file) { @@ -4972,13 +4924,12 @@ static void bdrv_remove_file_or_backing_child(Block= DriverState *bs, } =20 if (child->bs) { - bdrv_replace_child_tran(childp, NULL, tran); + bdrv_replace_child_tran(*childp, NULL, tran); } =20 s =3D g_new(BdrvRemoveFilterOrCowChild, 1); *s =3D (BdrvRemoveFilterOrCowChild) { .child =3D child, - .bs =3D bs, .is_backing =3D (childp =3D=3D &bs->backing), }; tran_add(tran, &bdrv_remove_filter_or_cow_child_drv, s); @@ -5004,8 +4955,6 @@ static int bdrv_replace_node_noperm(BlockDriverState = *from, { BdrvChild *c, *next; =20 - assert(to !=3D NULL); - QLIST_FOREACH_SAFE(c, &from->parents, next_parent, next) { assert(c->bs =3D=3D from); if (!should_update_child(c, to)) { @@ -5021,12 +4970,7 @@ static int bdrv_replace_node_noperm(BlockDriverState= *from, c->name, from->node_name); return -EPERM; } - - /* - * Passing a pointer to the local variable @c is fine here, because - * @to is not NULL, and so &c will not be attached to the transact= ion. - */ - bdrv_replace_child_tran(&c, to, tran); + bdrv_replace_child_tran(c, to, tran); } =20 return 0; @@ -5041,8 +4985,6 @@ static int bdrv_replace_node_noperm(BlockDriverState = *from, * * With @detach_subchain=3Dtrue @to must be in a backing chain of @from. I= n this * case backing link of the cow-parent of @to is removed. - * - * @to must not be NULL. */ static int bdrv_replace_node_common(BlockDriverState *from, BlockDriverState *to, @@ -5055,8 +4997,6 @@ static int bdrv_replace_node_common(BlockDriverState = *from, BlockDriverState *to_cow_parent =3D NULL; int ret; =20 - assert(to !=3D NULL); - if (detach_subchain) { assert(bdrv_chain_contains(from, to)); assert(from !=3D to); @@ -5112,9 +5052,6 @@ out: return ret; } =20 -/** - * Replace node @from by @to (where neither may be NULL). - */ int bdrv_replace_node(BlockDriverState *from, BlockDriverState *to, Error **errp) { @@ -5182,7 +5119,7 @@ int bdrv_replace_child_bs(BdrvChild *child, BlockDriv= erState *new_bs, bdrv_drained_begin(old_bs); bdrv_drained_begin(new_bs); =20 - bdrv_replace_child_tran(&child, new_bs, tran); + bdrv_replace_child_tran(child, new_bs, tran); =20 found =3D g_hash_table_new(NULL, NULL); refresh_list =3D bdrv_topological_dfs(refresh_list, found, old_bs); --=20 2.31.1 From nobody Thu May 16 17:05:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1638563395; cv=pass; d=zohomail.com; s=zohoarc; b=gmp84+UqEro6gGT+m5PulXxXkTSHU+W24BccI7S5OYzISOXInETsTgKQO0GwO8uVKMCzjOgk2kgOcHgPbx2iO4qYD7oJ1OPngM03zGpqwL+dgHrRCI8JvNuJ2EbEbFeDLTlFGflaCTDFZDa1GsVKFvx4GbyZfovNBUFZ6BGMTd8= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638563395; h=Content-Type: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; bh=OJoqopGf5qGIUuiqezCBrSKaFk9Ff2/5/1VjSep6xyA=; b=A54gBX4T+DIZT8AnP4I0w3I53LaVMecx8C6in2zVQwHVBV85xldwak8dLTWJh5nq+fUh9JT8Q0On/q+1e5YUaPxkhau068An8kKgpCKLsz/3T93NmIOA8Eo5W+/o5JCVD/gQUp5YVNSxbbUAd6YxzZ0N+n1UFd+VbQPPrgjYdrE= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1638563395730185.77447487650295; Fri, 3 Dec 2021 12:29:55 -0800 (PST) Received: from localhost ([::1]:33494 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mtFBq-0006Bo-LG for importer@patchew.org; Fri, 03 Dec 2021 15:29:54 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57678) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mtF8p-0000qc-Ep; Fri, 03 Dec 2021 15:26:48 -0500 Received: from mail-eopbgr70109.outbound.protection.outlook.com ([40.107.7.109]:27177 helo=EUR04-HE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mtF8m-0001ct-Af; Fri, 03 Dec 2021 15:26:47 -0500 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by AM0PR08MB4068.eurprd08.prod.outlook.com (2603:10a6:208:12b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.16; Fri, 3 Dec 2021 20:26:24 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::2078:5a2:1898:d83a]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::2078:5a2:1898:d83a%7]) with mapi id 15.20.4669.024; Fri, 3 Dec 2021 20:26:24 +0000 Received: from kvm.ch-qa.sw.ru (130.117.225.5) by AM6PR10CA0086.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:8c::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.16 via Frontend Transport; Fri, 3 Dec 2021 20:26:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QLa7iLdRcbdIVek6WAxkWvIsbVOlMR37agdBbQIKrnTOCpKX5sK46zA2yL2466TaKtJjJ1ns5SYWCnOO0wFKND6iBcvewYsHQsLcF/rkAFSWK0HBUgucdaCWb+tBoMUgJb2pHRPUFEZwxrbcG2iS2PrkWEu83eEoZ407XDDquG63JVcMqJLS/RgcoZMLnPiQIALXraDcTqKVWRlmrw/8R/xumOAHebqlKYG/ymyAm8ZbO3cmnjC/jlAm8pKmHPqg/W/uhRgRB7sp0K/HZwiE9OO18ruOyyuQCaAcaBbnY7D6rhJ2nKsxFfJ+qrIfFe+U+lPyrVoZz1T5OUCn1lAkMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OJoqopGf5qGIUuiqezCBrSKaFk9Ff2/5/1VjSep6xyA=; b=PQsfIPEkbu5UaOFYg5hR3/7NDLeEz1Cy3/WzzHqcqMobFF2BE1FM4r2hmIHduCr5F1ynSWauZ67CJdmp1ABroMIh4D99Sf3PKpZVgVi+4JdGwhoDfRlYKaPzYSsg7DhMiMLaliGJFi0gt///pgitxdYvx8CGkRYNAWZr+zIQiYURcootvTpxuQpgG5j9NV3HmuK/YLC7sMZCl1M9tRrM11aebzQY7ZPy1/9yG0z6EpwEcL0jItIrPa2S3YJf7c3rUMCdZ1cqXQTShCB5QHDKOSTaeZ9Xc75Tq4sT0PxnWOnHl5lX5wH2LdC56z0l6JrEhWRCoJGKKuhPucFitf8hMQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OJoqopGf5qGIUuiqezCBrSKaFk9Ff2/5/1VjSep6xyA=; b=enHTp8YwLzxtTalkrDBmSGJ2ugC41eRqy2Q7gHkIB32+fBIyAYlJSLu76h8utJuhf/zEK4fP+nN6bSS6qpm7WoFlH45qS0NA1UYR03TXd+4adKw9uuDXiqVvsKLrCEU+EXK1SrROtCzRMPZH6XJP+JplYRaFux70tzu8gJ78ShU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, kwolf@redhat.com, hreitz@redhat.com, vsementsov@virtuozzo.com Subject: [PATCH 11/14] Revert "block: Restructure remove_file_or_backing_child()" Date: Fri, 3 Dec 2021 21:25:50 +0100 Message-Id: <20211203202553.3231580-12-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211203202553.3231580-1-vsementsov@virtuozzo.com> References: <20211203202553.3231580-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM6PR10CA0086.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:8c::27) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ed72f4eb-b148-4be8-03af-08d9b69b2cf2 X-MS-TrafficTypeDiagnostic: AM0PR08MB4068: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:41; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dyjzl9Xj/C9J+LcDYh/AIaY8lQVlVfGUgtiG4pw/f5woUklAyZTlZwULW9LXm80HnPkC7BSvcD2u938sXJJbVTRT4w0h/uc3ytSqKFD6KyqRePSuuqbKKw9c6RoBPd1/iOzF6WIqELjixEJjHFZMlziEtkP5BhqJJVBxgGa3r57px13HnfQRaBeIMgcNuukKTWJmrTnEBtSDkuMl0HCKPVoHo2AgkouS5CL8FRUUGRJM2/LZwUOKn5nhONdn/+Ypeaupg+ez9WRZvM7+aEqVTTbjhTGgV4gEpVj3bmNLZuOYiBHPcD7Ti3Yq8OFUitNBjnGlUwHSfIzij+G6vU4HJO/7i1yem7jTDHJ66LJxxW8EaF/ZtSbdzelEXCW/NRIUqe7YBfAmY17V3j6HDdpMBEnj9IYupqaavUg+yj2mtzrim8EZ3Dk+ExICb5EO8yyESeTF31INL8KS6sC0DRvPGnHJS2CHUNAFOUgbN6HoGstPyNK4j+ic4LeDQrplGPi0ovKy45yvZYUoaZ70rGox9GaHdbHiO2VIzogrF4hkSrziLOXVoLrnu/cTybYWYSMlUBpqOwdIAfNeN95c6VqCSrHhZeY7u80tivsmODCF0wWVya+kmK29H2smGBqDGDKlHwo6GNUUSLCUZ/S9gz2g4YStFKz4FG7bCRbGaBvT+OaKkQuVyiWm+gsFuwoBCIcOLjadzj9GA8p0SDyoryzTwQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(1076003)(107886003)(83380400001)(26005)(6916009)(8936002)(2616005)(66556008)(2906002)(508600001)(6506007)(6666004)(38350700002)(66946007)(66476007)(38100700002)(52116002)(186003)(316002)(4326008)(6512007)(36756003)(6486002)(956004)(8676002)(5660300002)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?CMFoazRZ4ttC2HHDyCHeNSlAeqVJtOx8mUIdRwtHxw16AEp65nE5hCDx8w9G?= =?us-ascii?Q?ClJssg90IWQUoV0aTmTUZGt/l9lVU9z/h2UN+8EUvdNQNLVPGhn1yq5LxMaA?= =?us-ascii?Q?BZboRbT/qfk29Jq18QnxaPh1/cANvmoIJMUAjFF6SBXAOR1zUtEhb6V533hQ?= =?us-ascii?Q?JYUaPwX37ovrsyqRcSZ519CtfMgSkm2pm2uJJaThtK0Zt7ElCKRzcuGj4OVg?= =?us-ascii?Q?Ls65idPvTKlhjui+Yb6QIgLOGV7StW41sFoQVom98ZbfNNT0AHbqeK297QCN?= =?us-ascii?Q?My+II8CjAvCNoHb/+t9XQg4sxVsfSZNSHINOgv7GCi7EPgyCtM/dtUTLzltu?= =?us-ascii?Q?407HnYh/ncAsy4CvXZuTo6UVpVU4KqyuyEukfnNTW0H/jfas7eUGyXO7giJI?= =?us-ascii?Q?E4nkJpVFnZT5y9hJp1JCz3eoq93cSosWfe7WoiouHvaH2sJKicVOAtSU1kOK?= =?us-ascii?Q?jdnDbt5QpW6HX9Wv/urhhRc/Nmyd4Utxt1gfhJrrNFFxjToskPTATMtT6ZH8?= =?us-ascii?Q?kc/IfjBpkJwWJjUxs5nKWdH97E2sWGGXriO3M4X4uEOOJbrOZzaIp2uZVyGL?= =?us-ascii?Q?FA+emPd8+uFOlTsBobkwdWduM6HN8a4C5kA/ogTYt3fpnxCC11ao2uMQQAM/?= =?us-ascii?Q?Bv368dLGQIBThQsNdGKQDgrpD5bawGvwE15VrkZ9Du5Nh5FnUNKUY8gSANWa?= =?us-ascii?Q?fhXFa+7oY2HkxkEp6Qp8GzCyaLt4DqKt2Si/NCx5u0YbOYmUr3L74iCIYm1c?= =?us-ascii?Q?nDlsfFVSOtDm5QFAJj6uQtayzekgShKUC12Mzztq3HMEkF3FBy7GAeLAj8yW?= =?us-ascii?Q?XqVp20TRG48b0TQt57GxLpI3qXekfgdTrc859BJL5/JeeiQ1JdD95DrzxIOA?= =?us-ascii?Q?xw7J3PVHxDPkUWye/ZPNxQyi0b2PINQdYTipCL6tsxZthuLCJeZfGhAkdWWx?= =?us-ascii?Q?a1W1t2i0adA2oOqJvpedxNs+figU0CX7UiYCPpYhwNT0zYWMjJox4Iz453wf?= =?us-ascii?Q?bbtJ0ACL1XCUB4UIG6K7MQrhdKN5ClY6hwBlhwW+OJVh1dwgdF09DFmzgCeX?= =?us-ascii?Q?htrjwyyInS1LwQxEOiA70un5c9Oke7I1heGBMnxgpPE9MrLEhuQBqr32G7Nc?= =?us-ascii?Q?UkDAF+jW7VTPTXHyYc+OhuoMMHNA6yL0jzgq/gkoKCs3j8JpI5dMQYw3Lxuh?= =?us-ascii?Q?psJKLeaLpmqxKd62fxOzTYvIPARRgcEuOEAlUykyhHAwoYVT2MvILpt2mzwz?= =?us-ascii?Q?b6YjXEyjD4bWaEhgchwIaSjXbekJftNnMF3S6Y26WMtk8918+grUUf6briqG?= =?us-ascii?Q?h6RcwGNsDrcMAiXO6KY8Jwnh6jtPs8truyZVfLDkSZuiHsdPuVzRiqR8lXB3?= =?us-ascii?Q?QzDZSwOaKU1EcjSpZoELjz5lbZtKT8KxTdL8xL8uDblPox11O2tlGVTE1i1I?= =?us-ascii?Q?UmWAXhiCBsM3iasElH5uive3YgQdjy7sTDG1y+NVOA+RAhieUw7idcWLl27I?= =?us-ascii?Q?0cOK+YdyFmawfhQ3XWG1IClGX/ODdXNgx8pENp0RMa8SxLh+D57ByY43hNlL?= =?us-ascii?Q?+Nbxr5kRkzM2QeFPmLcB85sXuDg02//mbwatO1Ey104JIvZMbIctM7Va8+Wk?= =?us-ascii?Q?VjerkBEMTlJD0NARcxMsFoDD8gp1qQx+JWbtpg6FOQkE22lqROgn53gYyCQ2?= =?us-ascii?Q?qiABMA=3D=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: ed72f4eb-b148-4be8-03af-08d9b69b2cf2 X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2021 20:26:24.1044 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: guxqf16rVDahMBtZsljIlT6NWOLIIf7kr3rbZhcLT9fKqSgfF2L8qUYPQ2F1K8nvoMvJz36KF4H4KT1kBFFFUkhfwFA5WGaw87lGk1YQTuY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4068 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=40.107.7.109; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-HE1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1638563397459100001 Content-Type: text/plain; charset="utf-8" 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 562bda8bb41879eeda0bd484dd3d55134579b28e. Signed-off-by: Vladimir Sementsov-Ogievskiy --- block.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/block.c b/block.c index 3eec53796b..2ba95f71b9 100644 --- a/block.c +++ b/block.c @@ -4908,33 +4908,30 @@ static void bdrv_remove_file_or_backing_child(Block= DriverState *bs, BdrvChild *child, Transaction *tran) { - BdrvChild **childp; BdrvRemoveFilterOrCowChild *s; =20 + assert(child =3D=3D bs->backing || child =3D=3D bs->file); + if (!child) { return; } =20 - if (child =3D=3D bs->backing) { - childp =3D &bs->backing; - } else if (child =3D=3D bs->file) { - childp =3D &bs->file; - } else { - g_assert_not_reached(); - } - if (child->bs) { - bdrv_replace_child_tran(*childp, NULL, tran); + bdrv_replace_child_tran(child, NULL, tran); } =20 s =3D g_new(BdrvRemoveFilterOrCowChild, 1); *s =3D (BdrvRemoveFilterOrCowChild) { .child =3D child, - .is_backing =3D (childp =3D=3D &bs->backing), + .is_backing =3D (child =3D=3D bs->backing), }; tran_add(tran, &bdrv_remove_filter_or_cow_child_drv, s); =20 - *childp =3D NULL; + if (s->is_backing) { + bs->backing =3D NULL; + } else { + bs->file =3D NULL; + } } =20 /* --=20 2.31.1 From nobody Thu May 16 17:05:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1638563487; cv=pass; d=zohomail.com; s=zohoarc; b=TYvzg01oxr0j8A8cSk5HflIKrkDZ2uG19WcB8wzvjUpXMBksPy6f+5tA3E8mUTzcfaDhT5DhZCofXwTunZ+JwlYL2JA8x7eYYWJ5onhDccJ3mEVOJ0KQhqgcui/OHfJbDOHrK3GqZot8ocSca1Bn3sgEszPsN1KQQWuUS/+FeFg= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638563487; h=Content-Type: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; bh=yxZ2vevgJOjfF5pRJ8pzbUZw0NDFtRQXzFlllmoJbgY=; b=HSp1C26NIGyQCMdrZ81grEAaDOcu9gHd4Ad5r38eEh6OlACB9a6JECwlthrwkUG1qpkHWs9zi+TTEj5Qr63ljD4R5ccGYoog/J7uQfojAAuPZbz8DrAeG71l1IcwNowXj75aLcfbeye7P7dGUSKEp2SxfeCvzMuBZElPnATTML8= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1638563487831172.5107910096416; Fri, 3 Dec 2021 12:31:27 -0800 (PST) Received: from localhost ([::1]:39562 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mtFDK-0001o9-KU for importer@patchew.org; Fri, 03 Dec 2021 15:31:26 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57684) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mtF8p-0000qf-Pb; Fri, 03 Dec 2021 15:26:48 -0500 Received: from mail-db8eur05on2098.outbound.protection.outlook.com ([40.107.20.98]:1792 helo=EUR05-DB8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mtF8m-0001dZ-PA; Fri, 03 Dec 2021 15:26:47 -0500 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by AM0PR08MB4068.eurprd08.prod.outlook.com (2603:10a6:208:12b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.16; Fri, 3 Dec 2021 20:26:24 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::2078:5a2:1898:d83a]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::2078:5a2:1898:d83a%7]) with mapi id 15.20.4669.024; Fri, 3 Dec 2021 20:26:24 +0000 Received: from kvm.ch-qa.sw.ru (130.117.225.5) by AM6PR10CA0086.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:8c::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.16 via Frontend Transport; Fri, 3 Dec 2021 20:26:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Kos3GJs1LGk2FzWYupP3RwMt+DKGSiUnAUvcai7XyrvEluNeB/Po2APKLce8y4goYfmIHtRbY5MF1FaUQDprcL8+vm7uNYjDnBS1dRxNW1HS41VBVN8qCLCbWVGCzssIBTktRzvJ4hTgl3Oos8aCZ6erZlwhBTZObzrZvC5un5xgY/qOIkJbSbHzveYhBQYUJjJiz6/Npl7vAbmjDyzO0MEnca1thZjGzY74WJi7w0q+6KJx5fl6wsPySE3GbvlJrpvq50jifjiyV2HwR2WOvN5PmHE0T7uIRtQbvEe7KiptVYkmbJrc/pGy9nMn4Nm6VXCBRbYTkCA/qoPNvGrK/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=yxZ2vevgJOjfF5pRJ8pzbUZw0NDFtRQXzFlllmoJbgY=; b=eJdhgFAER6Y+Hi2aZxBYpha3lem9SGrmF4jYKCcWWiolr5toM9kOUSzAtLo7owBguqmPYNuCaiPzc8cw8DcCWk8yAP0gVU07xXElVMAJq23zQG240WovM22lUCE0LqfOvJPPt1j/fmODl8XANrYZ7bO2qAG4AC8MGEsjUOxEKlHy0r7DNUIAtLs3PK1LvPW9ZXY0ki4dIT2OGx4eXv9J445FpWCDMn7Pa74qEU2ee87CVnP219piQoo4XaFRIx+TXsS4J/hdU+v2ZqXKeSD3R8rAyBBuKsOr8bA8nZSFl3Xas6hrZW/2k+OT8cDaNIbpbFZ6/TcJRG9tsoJsormvjQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yxZ2vevgJOjfF5pRJ8pzbUZw0NDFtRQXzFlllmoJbgY=; b=dh8qLUc5TnrLBKg41OlhbfdbKgRkYUtDUFUbZQd5Vwh45MwHPwDBRpJmKIFinlfEtoj8hcgi69tHapR0S9VpSWL7bBX4sx0BJUc+/zQclYZFUukvmF7SvY4dzqIk1UU27JDxEYVtk3QcIw5tZ/FSZo1xWvw4ZZLBXZlVJhqhdTk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, kwolf@redhat.com, hreitz@redhat.com, vsementsov@virtuozzo.com Subject: [PATCH 12/14] Revert "block: Pass BdrvChild ** to replace_child_noperm" Date: Fri, 3 Dec 2021 21:25:51 +0100 Message-Id: <20211203202553.3231580-13-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211203202553.3231580-1-vsementsov@virtuozzo.com> References: <20211203202553.3231580-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM6PR10CA0086.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:8c::27) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e68d5a4a-52ed-4773-bb91-08d9b69b2d32 X-MS-TrafficTypeDiagnostic: AM0PR08MB4068: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:36; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LvI49ss2KDWVRsxHKQw5Td7q8wj3eaICr+/DNbugTsrLizDrxrSb/9EPeCMhXIb/z7u2f2XxdyatxUsfwsjhxtnQ5P+9nwjoMtsSN383vfQ/qeXiS04QkA/sgPO9mGgjwBHDcQrYMx9vamfq+Fo7BWY3HvfTxmVO3Sq8kJKAix9aGEXoa0NIklTrl+tVkSfCVhcpWooKqFu07oCNogDimGBGtADCOCI0rVkLihP1EafZB95eOsJ2PR/YcgH/6fYtcppKXQmhv34HJ1tuit3rMUkKJKQLPAHKzu0M/SYZk0jpwzkGWDKVdDUQ3x7rvXUDZVZFv8AQ6gtRiuZLSBotO0HNQIFRIHB8gf6DqruX4Heg2+AewRDHAXd/g9FXXoaQTCKv51Yr0VQ2K8umMNRWTzDzg4SdFyuz5CAc88hoe9OcqcsXGy7crRQazae1S7uETFjnXLqxDvTK90L6Y9OxOjnjlU8Erd40zHlrDoVxe2sI1KD6UkFExolnu1kwaPbShYrZ9XhfXhi3NCmXJXEFFtPA1XT12tDTNxt8b4yJAFBLXZ8yxkRwwi7D7vjWtm5Px3sE1LH2taacjqMN7Vqu0n6u9cW/Piup3r+8qaL654m94O0lV2+xFkJAhsIwZNBe9pdLZgmL0Y0J8UQBTqch+z0e/exTXfcZEuUoPTF8SjKBBDVFtjYzL0AkVYXfG48kQAgImEA0ll2ojfBmdj11DQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(1076003)(107886003)(83380400001)(26005)(6916009)(8936002)(2616005)(66556008)(2906002)(508600001)(6506007)(6666004)(38350700002)(66946007)(66476007)(38100700002)(52116002)(186003)(316002)(4326008)(6512007)(36756003)(6486002)(956004)(8676002)(5660300002)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?KXSb8JOtK7evCky7c25duAFl9gOIZ5qQJPisyp85/8dMwPLH8nAalhBSltTP?= =?us-ascii?Q?eDPiqiIZOXGVqdl4J4Y7YY/p453fiZFOsAEWJ8ZSbmYt47jjqUINLSvL2gFe?= =?us-ascii?Q?M6T08eGODwC2VPBZ0pLKEBAsMsj4ZVfiGQ1Z9+mLmyTnrd7p8dTChFDF1sVJ?= =?us-ascii?Q?Zpr/Lh5yk4ZueO+W6Wh+vkPlac+YMdxVPx6VaEkIUwBcSifcWLpELZEpeIri?= =?us-ascii?Q?mglHArgBUQqrfcpoPZvoecLw0AynXSjbQABYbmCBxE6Wz5WOg9SBmyYxoyPy?= =?us-ascii?Q?69RWp5pcdpZ55Vf19VMWimGXL2MoZCOlGI2su75KikqGx+RmJhvzOQfvni9r?= =?us-ascii?Q?K0HZ74d8k3OnMI8b9Fruj8I3t9c1DoT+e1jW8bOH3IWk9e+u+QA4ZhnzOdjU?= =?us-ascii?Q?r1znOYweOS3a+u0ptsK6p6OlkVUAw23qPx/v6KZpQV32pgdU53FX+IXR1M/t?= =?us-ascii?Q?sDy6rC0kVnwx9pw5oKgcjpcFcsKEAI3ijpQPuv2YmHfM+w++ocE8hnP+XYHI?= =?us-ascii?Q?/hXBcC/k8IdiVTrZu1i/HD0VyjEnt7LJrnQsO9YqMPdRMtVgJWPiTZrd2Prg?= =?us-ascii?Q?k6YlD4xoIHV4+f8FU8uhSLZGCR6EkavF4awN+dvuJv+J9uH5B8QoR3OUjRrW?= =?us-ascii?Q?R6ZGZ+1vYDEI2Sgx2AzXH48RsRfk9XPgkKlDk25NK5JRKhDfzNNQpDMUDWtf?= =?us-ascii?Q?K14V841Dod0LeUqleGZcK5EofVgEuW2xUT/6ZzacSPDh0mvf9HHP2Op9kkWz?= =?us-ascii?Q?cndN2D4hrYLPH3d7tfUr68Zqvc7oXzSi2fDIZTwFCNWUa+ZTA9u28/mTDn4V?= =?us-ascii?Q?y9rP+QkHvQSR22Pa8TduePJl367xGceBaJ49YpZYoiQ4zFiaNk7lM5ifx8bR?= =?us-ascii?Q?ka+4iaYRPCGW+zGaQxfvQlOsMF1PLo72b9Ee5l2zpxJyiaH+PGo/7QygmET9?= =?us-ascii?Q?JCqe7ET0FipuWsrMyE/wFm9rPnYanJgwsPD833i3UCU4AKHT46z5HA/o4KKw?= =?us-ascii?Q?KwEpVmMnngF2wauFvCb2HWpePwtSo7b8SI/TSf8GKKPRrzNKVd2wQ1mFDdAQ?= =?us-ascii?Q?f1EnOZv9bPfQJyU3OKnkuJlj5ysbDnUSvSlMfxAT/sC4fYMElj/Pi2Jypt6S?= =?us-ascii?Q?cWKxMB/XRGaSbhM/IRpxUdmLkdvTmIkg4RL+iNusdBOXMsXsLoj47wwZ2eU6?= =?us-ascii?Q?S7U01BXy/g51TwH72S05vbiPu9MKJcBzs25t2O/8GshUY6Riac3A/S6uLoYL?= =?us-ascii?Q?TPwCfbxchtpYhR+6CmppmuT5JYvz3/ZNGgzbkqAp0pVWEs9oS+Dsg59FlTgh?= =?us-ascii?Q?KZ8gMXCpDUpf7dQPzdq2jScXKnPGV21tarGa09BDt5kRmJ8k+a7UwDHCaJKJ?= =?us-ascii?Q?phQzJs+is1MkD3bILdkIg8H5ehV+IWlbAIx0C1i4/4eVmwevrZFTfkwfSmRR?= =?us-ascii?Q?ZCCG49V2YEBll/37NI04r9hhKBbX6wACVITWI4YSVbynQVAg9wGZpwcxQNNK?= =?us-ascii?Q?8T6QT/tI0rhMPbhMSR59gc2wHPIFQvzxWGK+bBXdg7OWaP5G0V8rMVqKuMrM?= =?us-ascii?Q?a5IhdIK4Dy+bAjs83NwqQWN2eYFO88oyZrzHKNChCm/gPOWGminC23LsL/9h?= =?us-ascii?Q?7aeScZcowYL8Y7axsYpp08qC8XWGmCmNDgMt7Disx9Tg0B+j2/4HpV8hmlPb?= =?us-ascii?Q?4t8x1w=3D=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: e68d5a4a-52ed-4773-bb91-08d9b69b2d32 X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2021 20:26:24.7566 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: y+zz/6bqAXRZcfCn2156/yh3oOMaueyClZhz7OjdbWVi7Er0NLGHXci+77kRqexq71Bj9vqmzgBo8RxBVOOrniYc0/oohSbTH2hPJfNvVck= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4068 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=40.107.20.98; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-DB8-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1638563488682100001 Content-Type: text/plain; charset="utf-8" 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 2ba95f71b9..d57d7a80ab 100644 --- a/block.c +++ b/block.c @@ -87,7 +87,7 @@ static BlockDriverState *bdrv_open_inherit(const char *fi= lename, static bool bdrv_recurse_has_child(BlockDriverState *bs, BlockDriverState *child); =20 -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, @@ -2270,7 +2270,7 @@ static void bdrv_replace_child_abort(void *opaque) BlockDriverState *new_bs =3D s->child->bs; =20 /* 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); } =20 @@ -2300,7 +2300,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 */ } =20 @@ -2672,10 +2672,9 @@ uint64_t bdrv_qapi_perm_to_blk_perm(BlockPermission = qapi_perm) return permissions[qapi_perm]; } =20 -static void bdrv_replace_child_noperm(BdrvChild **childp, +static void bdrv_replace_child_noperm(BdrvChild *child, BlockDriverState *new_bs) { - BdrvChild *child =3D *childp; BlockDriverState *old_bs =3D child->bs; int new_bs_quiesce_counter; int drain_saldo; @@ -2768,7 +2767,7 @@ static void bdrv_attach_child_common_abort(void *opaq= ue) BdrvChild *child =3D *s->child; BlockDriverState *bs =3D child->bs; =20 - bdrv_replace_child_noperm(s->child, NULL); + bdrv_replace_child_noperm(child, NULL); =20 if (bdrv_get_aio_context(bs) !=3D s->old_child_ctx) { bdrv_try_set_aio_context(bs, s->old_child_ctx, &error_abort); @@ -2868,7 +2867,7 @@ static int bdrv_attach_child_common(BlockDriverState = *child_bs, } =20 bdrv_ref(child_bs); - bdrv_replace_child_noperm(&new_child, child_bs); + bdrv_replace_child_noperm(new_child, child_bs); =20 *child =3D new_child; =20 @@ -2923,12 +2922,12 @@ static int bdrv_attach_child_noperm(BlockDriverStat= e *parent_bs, return 0; } =20 -static void bdrv_detach_child(BdrvChild **childp) +static void bdrv_detach_child(BdrvChild *child) { - BlockDriverState *old_bs =3D (*childp)->bs; + BlockDriverState *old_bs =3D child->bs; =20 - bdrv_replace_child_noperm(childp, NULL); - bdrv_child_free(*childp); + bdrv_replace_child_noperm(child, NULL); + bdrv_child_free(child); =20 if (old_bs) { /* @@ -3034,7 +3033,7 @@ void bdrv_root_unref_child(BdrvChild *child) BlockDriverState *child_bs; =20 child_bs =3D child->bs; - bdrv_detach_child(&child); + bdrv_detach_child(child); bdrv_unref(child_bs); } =20 --=20 2.31.1 From nobody Thu May 16 17:05:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1638563848; cv=pass; d=zohomail.com; s=zohoarc; b=N8NJE5JUEXVRup5be5xzlAPKJ/kSvnNwXZQlRnZ1WAI5JNZz4WclgyzwM+5kV2OSNcuiaOYN3OQQgQRjO2eMejEv8sL/ZCM9fNIuhKuA4Dlv/rP0hP+ichSoO1oJ6yvh5d+T93i7IqaR22dBk/V5KXeIefQF3flk+BPKqNKtO/M= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638563848; h=Content-Type: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; bh=kc7qBEWxtgA6+M8pXOOBJg1yZJz9VgtKzv5IQWLbO34=; b=hLH4DNcBmjEZSD+fvempNX5OhE9kqh1dEAK3RuDGb6Ajpssr4d0jlodkPfULncSYkAh1E+nXkJly6MW3+zqyvGtaDDzgD7bTWk5I65cJ8qiWbXze4J4J8koJFYAuEVHq4zX//6841UZy7ahjMbBJa6l6iDNh4KDrwAnoLizE4Z4= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1638563848788212.6432837117934; Fri, 3 Dec 2021 12:37:28 -0800 (PST) Received: from localhost ([::1]:57572 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mtFJ9-0005cB-KQ for importer@patchew.org; Fri, 03 Dec 2021 15:37:27 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57746) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mtF8t-0000zi-GQ; Fri, 03 Dec 2021 15:26:51 -0500 Received: from mail-eopbgr70109.outbound.protection.outlook.com ([40.107.7.109]:27177 helo=EUR04-HE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mtF8q-0001ct-3n; Fri, 03 Dec 2021 15:26:51 -0500 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by AM0PR08MB4068.eurprd08.prod.outlook.com (2603:10a6:208:12b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.16; Fri, 3 Dec 2021 20:26:25 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::2078:5a2:1898:d83a]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::2078:5a2:1898:d83a%7]) with mapi id 15.20.4669.024; Fri, 3 Dec 2021 20:26:25 +0000 Received: from kvm.ch-qa.sw.ru (130.117.225.5) by AM6PR10CA0086.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:8c::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.16 via Frontend Transport; Fri, 3 Dec 2021 20:26:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Wc7dklqTpAKYdJJOQHKrEX6xztI05XmdMURD1zTpvZF8iKs603Pi3SqR686cXTFJQVQt13H3PU0+RmrVLZBIEnK/+7UlJxD3gwWO1Dyhqv+2FO0l+tdd3tDtbuook3t7nh9FLyP1A7q/SIiQylUDx4PmLVkSVCGXD52squbIyfKjGNgrL1wPvscu42ItPU5nd443QifyH5Z4rUYjpZF+t2c3zB7OfSBCaZ2FaIWc3OqHEbKhAULjt5wm1txpMTlVsqQWmYJZfeU5k0wwmZQHAiSEkngTa91JsJ9SmXDijLf4R9tRB6KJcKnhTI2b6lEK10rL1ukJ1l6Suf3j+dVZLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kc7qBEWxtgA6+M8pXOOBJg1yZJz9VgtKzv5IQWLbO34=; b=J6Lq9+bh788DVjCLfzcZUKIBCMVNNmEcJCxBAEUCuHr5KyDDWoHoLOSffUrUJ4pMQOAQXOUHGtrxMzd7FlV5ehe9gINhWRCGpjMGv0bcH3tChy4etGP0QpOTbhvAWIPU/oOxTYrkMMc2syWDHIp3uPXnt+NhPokSPeDjYpEc0BUBt093xkRscnQ2cGJMtKWmVRyxGvGa1mYy2ZueCEHyZoT+c2K5LpenAjkivtTN8uMUxYDbC6N9nBHavBiu792ur5HeOqJ+XOg8p6sSQV5YsIma71XSHuHZbU7RSQ3HmU1ZT+uSW8gIU1fE1PBoA0YYYsH3BI1wPbiz1WLDAEXxxw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kc7qBEWxtgA6+M8pXOOBJg1yZJz9VgtKzv5IQWLbO34=; b=LdIK7XJDIJT9U+vmuTBcCM2U9zyyOdBXUjpk5Lp8fbiaNeiFuFs5iJIag52BwNEbT4URyRyyyGZfwjzYu1NFt3QeA9UGKWmc0lN06BsJA+JuWdS6xnVP+XExMgubBCHEUAeGQjEqAajNTmyCiQXLl8olLAnkfBisqxJaVfe7PDI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, kwolf@redhat.com, hreitz@redhat.com, vsementsov@virtuozzo.com Subject: [PATCH 13/14] block: Manipulate bs->file / bs->backing pointers in .attach/.detach Date: Fri, 3 Dec 2021 21:25:52 +0100 Message-Id: <20211203202553.3231580-14-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211203202553.3231580-1-vsementsov@virtuozzo.com> References: <20211203202553.3231580-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM6PR10CA0086.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:8c::27) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f3546909-7aeb-4be7-7bac-08d9b69b2da1 X-MS-TrafficTypeDiagnostic: AM0PR08MB4068: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:551; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: y4Ag5WAMDPojNlLP4QJjqtt8We+mMYAezUxA+QcCZ3ruLGU+LOxUDzzoq86fniUQOmMbC25FMYhQq0Oygv31vaV5NqJ1d1Y7DtLpbBunYPL9Whuprh5scdBkJWncrArhTm9XaAcVPJpGHvoSYNYl2HRnmlSfNAe66drNH6nq5NHJ/oWFohzZFoclsj4LZik9k0HvZ6475tMzN0/22E9gSxb0QFED651vyFSY5S3p22sRuTW8yAtVOKVXO8n8TqtAHQyRhZqUGD14XMaYUbWKLO10prK4B2Pr03LVUeGpriMr0J6NwbVrv4SErql+oMP8olDUfEQwLnavOGBiKK9YR/eD/53KGwZXaiGXWPDKVLY7L0FvOsuEiG1AvJ+Y+n1cdL8Ng17FGzzo4WqEqPInuD3OXyOsbedT52WKkBxKxwqeeYsyx5iqB14u2nKblbMXOdwt9vfpiiU+Vm5Cp/rzBHDdF6KkGSWPuNIqtNXRpNeEZ3fLUJduan46C2K14sz2CeLxuwsffGlpYwvLW+hK/yIRuhFveMDXokZqtZI63DH6DG2DkDw1sop9CMFKY/k+kaDhU4awC3c94TQjIpbVDMDjTIB1atRDoESf97nFQ7NHrS3TSh5h8SXlpq9A2E0XeJBGfYtH4HySE9FZsXk2pY1lhUuNYXpdT8IRC+U9ljjhoufsq9gK3mGpdNFq+uPOn7H49lRiic5bFEApp7QzJDFVgnkXgO6YTndLUUzYTPE= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(1076003)(107886003)(83380400001)(26005)(6916009)(8936002)(2616005)(66556008)(2906002)(508600001)(6506007)(6666004)(38350700002)(66946007)(66476007)(38100700002)(52116002)(186003)(316002)(4326008)(6512007)(36756003)(6486002)(30864003)(956004)(8676002)(5660300002)(86362001)(142923001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?3AuG9QcvW1t97dGn3eavJNFPw7u75jVnCB//EjJR/IQJ+kNGoliUNfck8hM1?= =?us-ascii?Q?BbWgK2HYLxhbvk567m1ro5UuIgSxjjQ3HVJnf19y7rV4PAQCSnP2N1R/rRNm?= =?us-ascii?Q?tVB9aZ8epYtCZ3VMbUI4GXPrKmrsW6U6W7ffaqer4CfRp2hqx5Y2TrNGnwIp?= =?us-ascii?Q?A27W7914NmhTXdsBqPOeQeGMjNNWSvmGRDvYXd0+wnaPlo3BN8kc+/b79ido?= =?us-ascii?Q?UO24A3+NhqDIJ4pzkiMhvXrp8BG/V+kIvJYfXGvLI6pZiXYfawUzPaDg29i2?= =?us-ascii?Q?dL0z2LVscst3OsmdcFA0ORNLQxHSAzW6IX32fUs7QD1dTPsU3xnuO4owjaBo?= =?us-ascii?Q?3gzA+yjP+H6Ciy31guPXHRaq1c/X/O8U4Vtg/qRMNwFF6Iw6IfVck23w6B4V?= =?us-ascii?Q?yiUyvFZV7Ww4S4yE7nLzJgBDBPfUgaRLBbBLRZDXJpfhMQpY5JguaTojYeIh?= =?us-ascii?Q?CUgfK5y3eSoneFwAP9Nvf7XN30TQVTRUsWb90gJqYT4TMeA1D8LgbTw8w4m2?= =?us-ascii?Q?XQoJ9F2PIJY2aWN7bkyJFOZXmZ4IOFHzBVqd0vSHDdd8y2PCmkGQMKKVCZnc?= =?us-ascii?Q?ADdmj2A5ktmKzk6WqD+HB5mkxOqXi09Qa5mS/wo+0pO9KP/Sj6xWhqfM7bfR?= =?us-ascii?Q?jQ/Uiuqv65m6/f5Kpfv4w+rUiTmDPh5M4AdkLFTaVKLvE4B9dLwD+uUisNG1?= =?us-ascii?Q?cO/RWEebvZGIOer2yS2SDWIydQhLGk6p+LPBZElK7qBrZU6gFRhvWI4Srhrz?= =?us-ascii?Q?MggFAj70yOqQTsD3V7CkWBJKpdAxUIQMQr6Lso1UfioqpzCmWR5nHkWqxZ+t?= =?us-ascii?Q?UurORmzHsTVmviMf/z4tTPFG0cmwG+xyzve7IN0k9KIzCB+fRLl3t74wDBqv?= =?us-ascii?Q?/e181j7fcq2qspRokMvbAfBlBsAjn6acaTaNQ4U52XqSdu+yN9wzul4cNQ2L?= =?us-ascii?Q?Y2wPOQFoWj3fsMs/DK8oh/zaPuq/Aqw9aLVvasl5SIL8aZyV5fxtTCWD6icJ?= =?us-ascii?Q?0PIAyoJAUWPiLeUpc/qxycrXh4nEZ1r5PHj43qtAioAYidILGs+RJSDBenri?= =?us-ascii?Q?K0hBY6unWLTzCx+4Xj5kAFewltDHV6x/ZKcKB0Jhijgq0hk+0ANddO8rCWeY?= =?us-ascii?Q?HiOjlAPvgh4PLo1fwvIjPKi00HceISdZXY6Rjjp/rh288PT43MKAyHF+nFlx?= =?us-ascii?Q?7711cRUdqzB9AxmA/TbRfr3rH/23Y0qHA8ZreGVGmv/kpL2uU3dMUleADrKT?= =?us-ascii?Q?Qy0FA932OSEy5qoJyl7GdkFbq/q5tZeZXfenZXaZbGe55/AVLyUI7mG+/EcE?= =?us-ascii?Q?kk2np6AUJL2KvwimAG0lMZwlvC0FhOQGT8tjwBv5d1XFUPVJbWC6yeYVNs4l?= =?us-ascii?Q?Sr/+j9yeTrxZHVbjX316f01q0P84Mp+yf9hZmbrEAmYoIEUOcuFgpCDXxknn?= =?us-ascii?Q?yesHHfKqmygU1/tpUCQMJZAP4zbVzv9H0LnIRESKAXqDHsEXBmBfRqFhD7Qn?= =?us-ascii?Q?mxFpnlbS8s8oGhqFtBy9F2aWEZGxE5+bEv4WEmcqDvbXkjCOtcowU94jVaYF?= =?us-ascii?Q?MD6B6gettWAoT+0mbjw+5PXuEAybWItzn1IXuxoLNVSrVnEAfOZ0N8zDoHyh?= =?us-ascii?Q?bDgHLXlp/yav6idLy2zF/BwDwPpTLOHGyew9UKYpMx5JIewrGIaLS2QRKtUD?= =?us-ascii?Q?OAvt8Q=3D=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: f3546909-7aeb-4be7-7bac-08d9b69b2da1 X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2021 20:26:25.2634 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Ycq5yf41xCEShn38KlQag+sTlGdIj5UeMwP0INc3LGyubXlFq1tSO9ZC2SAcDZBwNDfuZ+vd1G6naq5us2n2vAYF38WubgDKBVKQBSEs00Y= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4068 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=40.107.7.109; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-HE1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1638563850853100001 Content-Type: text/plain; charset="utf-8" bs->file and bs->backing are a kind of duplication of part of bs->children. But very useful diplication, so let's not drop them at all:) We should manage bs->file and bs->backing in same place, where we manage bs->children, to keep them in sync. Moreover, generic io paths are unprepared to BdrvChild without a bs, so it's double good to clear bs->file / bs->backing when we detach the child. Detach is simple: if we detach bs->file or bs->backing child, just set corresponding field to NULL. Attach is a bit more complicated. But we still can precisely detect should we set one of bs->file / bs->backing or not: - if role is BDRV_CHILD_COW, we definitely deal with bs->backing - else, if role is BDRV_CHILD_FILTERED (it must be also BDRV_CHILD_PRIMARY), it's a filtered child. Use bs->drv->filtered_child_is_backing to chose the pointer field to modify. - else, if role is BDRV_CHILD_PRIMARY, we deal with bs->file - in all other cases, it's neither bs->backing nor bs->file. It's some other child and we shouldn't care OK. This change brings one more good thing: we can (and should) get rid of all indirect pointers in the block-graph-change transactions: bdrv_attach_child_common() stores BdrvChild** into transaction to clear it on abort. bdrv_attach_child_common() has two callers: bdrv_attach_child_noperm() just pass-through this feature, bdrv_root_attach_child() doesn't need the feature. Look at bdrv_attach_child_noperm() callers: - bdrv_attach_child() doesn't need the feature - bdrv_set_file_or_backing_noperm() uses the feature to manage bs->file and bs->backing, we don't want it anymore - bdrv_append() uses the feature to manage bs->backing, again we don't want it anymore So, we should drop this stuff! Great! We still keep BdrvChild** argument to return the child and int return value, and not move to simply returning BdrvChild*, as we don't want to lose int return values. However we don't require *@child to be NULL anymore, and even allow @child to be NULL, if caller don't need the new child pointer. Finally, we now set .file / .backing automatically in generic code and want to restring setting them by hand outside of .attach/.detach. So, this patch cleanups all remaining places where they were set. To find such places I use: git grep '\->file =3D' git grep '\->backing =3D' git grep '&.*\' git grep '&.*\' Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/block/block_int.h | 15 +++- block.c | 155 ++++++++++++++++------------------- block/raw-format.c | 4 +- block/snapshot.c | 1 - tests/unit/test-bdrv-drain.c | 10 +-- 5 files changed, 88 insertions(+), 97 deletions(-) diff --git a/include/block/block_int.h b/include/block/block_int.h index 919e33de5f..4ea800e589 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -937,9 +937,6 @@ struct BlockDriverState { QDict *full_open_options; char exact_filename[PATH_MAX]; =20 - BdrvChild *backing; - BdrvChild *file; - /* I/O Limits */ BlockLimits bl; =20 @@ -992,7 +989,19 @@ struct BlockDriverState { * which can affect this node by changing these defaults). This is alw= ays a * parent node of this node. */ BlockDriverState *inherits_from; + + /* + * @backing and @file are some of @children or NULL. All these three f= ields + * (@file, @backing and @children) are modified only in + * bdrv_child_cb_attach() and bdrv_child_cb_detach(). + * + * See also comment in include/block/block.h, to learn how backing and= file + * are connected with BdrvChildRole. + */ QLIST_HEAD(, BdrvChild) children; + BdrvChild *backing; + BdrvChild *file; + QLIST_HEAD(, BdrvChild) parents; =20 QDict *options; diff --git a/block.c b/block.c index d57d7a80ab..0c6bbc9b0b 100644 --- a/block.c +++ b/block.c @@ -1388,9 +1388,33 @@ static void bdrv_child_cb_attach(BdrvChild *child) BlockDriverState *bs =3D child->opaque; =20 QLIST_INSERT_HEAD(&bs->children, child, next); + if (bs->drv->is_filter | (child->role & BDRV_CHILD_FILTERED)) { + /* + * Here we handle filters and block/raw-format.c when it behave li= ke + * filter. + */ + assert(!(child->role & BDRV_CHILD_COW)); + if (child->role & (BDRV_CHILD_PRIMARY | BDRV_CHILD_FILTERED)) { + assert(child->role & BDRV_CHILD_PRIMARY); + assert(child->role & BDRV_CHILD_FILTERED); + assert(!bs->backing); + assert(!bs->file); =20 - if (child->role & BDRV_CHILD_COW) { + if (bs->drv->filtered_child_is_backing) { + bs->backing =3D child; + } else { + bs->file =3D child; + } + } + } else if (child->role & BDRV_CHILD_COW) { + assert(bs->drv->supports_backing); + assert(!(child->role & BDRV_CHILD_PRIMARY)); + assert(!bs->backing); + bs->backing =3D child; bdrv_backing_attach(child); + } else if (child->role & BDRV_CHILD_PRIMARY) { + assert(!bs->file); + bs->file =3D child; } =20 bdrv_apply_subtree_drain(child, bs); @@ -1407,6 +1431,12 @@ static void bdrv_child_cb_detach(BdrvChild *child) bdrv_unapply_subtree_drain(child, bs); =20 QLIST_REMOVE(child, next); + if (child =3D=3D bs->backing) { + assert(child !=3D bs->file); + bs->backing =3D NULL; + } else if (child =3D=3D bs->file) { + bs->file =3D NULL; + } } =20 static int bdrv_child_cb_update_filename(BdrvChild *c, BlockDriverState *b= ase, @@ -1604,7 +1634,7 @@ open_failed: bs->drv =3D NULL; if (bs->file !=3D NULL) { bdrv_unref_child(bs, bs->file); - bs->file =3D NULL; + assert(!bs->file); } g_free(bs->opaque); bs->opaque =3D NULL; @@ -2756,7 +2786,7 @@ static void bdrv_child_free(BdrvChild *child) } =20 typedef struct BdrvAttachChildCommonState { - BdrvChild **child; + BdrvChild *child; AioContext *old_parent_ctx; AioContext *old_child_ctx; } BdrvAttachChildCommonState; @@ -2764,32 +2794,30 @@ typedef struct BdrvAttachChildCommonState { static void bdrv_attach_child_common_abort(void *opaque) { BdrvAttachChildCommonState *s =3D opaque; - BdrvChild *child =3D *s->child; - BlockDriverState *bs =3D child->bs; + BlockDriverState *bs =3D s->child->bs; =20 - bdrv_replace_child_noperm(child, NULL); + bdrv_replace_child_noperm(s->child, NULL); =20 if (bdrv_get_aio_context(bs) !=3D s->old_child_ctx) { bdrv_try_set_aio_context(bs, s->old_child_ctx, &error_abort); } =20 - if (bdrv_child_get_parent_aio_context(child) !=3D s->old_parent_ctx) { + if (bdrv_child_get_parent_aio_context(s->child) !=3D s->old_parent_ctx= ) { GSList *ignore; =20 /* No need to ignore `child`, because it has been detached already= */ ignore =3D NULL; - child->klass->can_set_aio_ctx(child, s->old_parent_ctx, &ignore, - &error_abort); + s->child->klass->can_set_aio_ctx(s->child, s->old_parent_ctx, &ign= ore, + &error_abort); g_slist_free(ignore); =20 ignore =3D NULL; - child->klass->set_aio_ctx(child, s->old_parent_ctx, &ignore); + s->child->klass->set_aio_ctx(s->child, s->old_parent_ctx, &ignore); g_slist_free(ignore); } =20 bdrv_unref(bs); - bdrv_child_free(child); - *s->child =3D NULL; + bdrv_child_free(s->child); } =20 static TransactionActionDrv bdrv_attach_child_common_drv =3D { @@ -2800,11 +2828,11 @@ static TransactionActionDrv bdrv_attach_child_commo= n_drv =3D { /* * Common part of attaching bdrv child to bs or to blk or to job * - * Resulting new child is returned through @child. - * At start *@child must be NULL. - * @child is saved to a new entry of @tran, so that *@child could be rever= ted to - * NULL on abort(). So referenced variable must live at least until transa= ction - * end. + * If @child is not NULL, it's set to new created child. Note, that @child + * pointer is stored in the transaction and therefore not cleared on abort. + * Consider @child as part of return value: we may change the return value= of + * the function to BdrvChild* and return child directly, but this way we l= ose + * different return codes. * * Function doesn't update permissions, caller is responsible for this. */ @@ -2820,8 +2848,6 @@ static int bdrv_attach_child_common(BlockDriverState = *child_bs, AioContext *parent_ctx; AioContext *child_ctx =3D bdrv_get_aio_context(child_bs); =20 - assert(child); - assert(*child =3D=3D NULL); assert(child_class->get_parent_desc); =20 new_child =3D g_new(BdrvChild, 1); @@ -2869,22 +2895,25 @@ static int bdrv_attach_child_common(BlockDriverStat= e *child_bs, bdrv_ref(child_bs); bdrv_replace_child_noperm(new_child, child_bs); =20 - *child =3D new_child; - BdrvAttachChildCommonState *s =3D g_new(BdrvAttachChildCommonState, 1); *s =3D (BdrvAttachChildCommonState) { - .child =3D child, + .child =3D new_child, .old_parent_ctx =3D parent_ctx, .old_child_ctx =3D child_ctx, }; tran_add(tran, &bdrv_attach_child_common_drv, s); =20 + if (child) { + *child =3D new_child; + } + return 0; } =20 /* - * Variable referenced by @child must live at least until transaction end. - * (see bdrv_attach_child_common() doc for details) + * If @child is not NULL, it's set to new created child. @child is a part = of + * return value, not a part of transaction (see bdrv_attach_child_common()= doc + * for details). * * Function doesn't update permissions, caller is responsible for this. */ @@ -2963,7 +2992,7 @@ BdrvChild *bdrv_root_attach_child(BlockDriverState *c= hild_bs, void *opaque, Error **errp) { int ret; - BdrvChild *child =3D NULL; + BdrvChild *child; Transaction *tran =3D tran_new(); =20 ret =3D bdrv_attach_child_common(child_bs, child_name, child_class, @@ -2977,11 +3006,10 @@ BdrvChild *bdrv_root_attach_child(BlockDriverState = *child_bs, =20 out: tran_finalize(tran, ret); - /* child is unset on failure by bdrv_attach_child_common_abort() */ - assert((ret < 0) =3D=3D !child); =20 bdrv_unref(child_bs); - return child; + + return ret < 0 ? NULL : child; } =20 /* @@ -3003,7 +3031,7 @@ BdrvChild *bdrv_attach_child(BlockDriverState *parent= _bs, Error **errp) { int ret; - BdrvChild *child =3D NULL; + BdrvChild *child; Transaction *tran =3D tran_new(); =20 ret =3D bdrv_attach_child_noperm(parent_bs, child_bs, child_name, chil= d_class, @@ -3019,12 +3047,10 @@ BdrvChild *bdrv_attach_child(BlockDriverState *pare= nt_bs, =20 out: tran_finalize(tran, ret); - /* child is unset on failure by bdrv_attach_child_common_abort() */ - assert((ret < 0) =3D=3D !child); =20 bdrv_unref(child_bs); =20 - return child; + return ret < 0 ? NULL : child; } =20 /* Callers must ensure that child->frozen is false. */ @@ -3221,9 +3247,7 @@ static int bdrv_set_file_or_backing_noperm(BlockDrive= rState *parent_bs, ret =3D bdrv_attach_child_noperm(parent_bs, child_bs, is_backing ? "backing" : "file", &child_of_bds, role, - is_backing ? &parent_bs->backing : - &parent_bs->file, - tran, errp); + NULL, tran, errp); if (ret < 0) { return ret; } @@ -3471,14 +3495,16 @@ int bdrv_open_file_child(const char *filename, =20 /* commit_top and mirror_top don't use this function */ assert(!parent->drv->filtered_child_is_backing); - role =3D parent->drv->is_filter ? (BDRV_CHILD_FILTERED | BDRV_CHILD_PRIMARY) : BDRV_CHILD_IMAGE; =20 - parent->file =3D bdrv_open_child(filename, options, bdref_key, parent, - &child_of_bds, role, false, errp); + if (!bdrv_open_child(filename, options, bdref_key, parent, + &child_of_bds, role, false, errp)) + { + return -EINVAL; + } =20 - return parent->file ? 0 : -EINVAL; + return 0; } =20 /* @@ -4731,8 +4757,8 @@ static void bdrv_close(BlockDriverState *bs) bdrv_unref_child(bs, child); } =20 - bs->backing =3D NULL; - bs->file =3D NULL; + assert(!bs->backing); + assert(!bs->file); g_free(bs->opaque); bs->opaque =3D NULL; qatomic_set(&bs->copy_on_read, 0); @@ -4862,41 +4888,13 @@ static bool should_update_child(BdrvChild *c, Block= DriverState *to) return ret; } =20 -typedef struct BdrvRemoveFilterOrCowChild { - BdrvChild *child; - bool is_backing; -} BdrvRemoveFilterOrCowChild; - -static void bdrv_remove_filter_or_cow_child_abort(void *opaque) -{ - BdrvRemoveFilterOrCowChild *s =3D opaque; - BlockDriverState *parent_bs =3D s->child->opaque; - - if (s->is_backing) { - parent_bs->backing =3D s->child; - } else { - parent_bs->file =3D s->child; - } - - /* - * We don't have to restore child->bs here to undo bdrv_replace_child_= tran() - * because that function is transactionable and it registered own comp= letion - * entries in @tran, so .abort() for bdrv_replace_child_safe() will be - * called automatically. - */ -} - static void bdrv_remove_filter_or_cow_child_commit(void *opaque) { - BdrvRemoveFilterOrCowChild *s =3D opaque; - - bdrv_child_free(s->child); + bdrv_child_free(opaque); } =20 static TransactionActionDrv bdrv_remove_filter_or_cow_child_drv =3D { - .abort =3D bdrv_remove_filter_or_cow_child_abort, .commit =3D bdrv_remove_filter_or_cow_child_commit, - .clean =3D g_free, }; =20 /* @@ -4907,8 +4905,6 @@ static void bdrv_remove_file_or_backing_child(BlockDr= iverState *bs, BdrvChild *child, Transaction *tran) { - BdrvRemoveFilterOrCowChild *s; - assert(child =3D=3D bs->backing || child =3D=3D bs->file); =20 if (!child) { @@ -4919,18 +4915,7 @@ static void bdrv_remove_file_or_backing_child(BlockD= riverState *bs, bdrv_replace_child_tran(child, NULL, tran); } =20 - s =3D g_new(BdrvRemoveFilterOrCowChild, 1); - *s =3D (BdrvRemoveFilterOrCowChild) { - .child =3D child, - .is_backing =3D (child =3D=3D bs->backing), - }; - tran_add(tran, &bdrv_remove_filter_or_cow_child_drv, s); - - if (s->is_backing) { - bs->backing =3D NULL; - } else { - bs->file =3D NULL; - } + tran_add(tran, &bdrv_remove_filter_or_cow_child_drv, child); } =20 /* @@ -5082,7 +5067,7 @@ int bdrv_append(BlockDriverState *bs_new, BlockDriver= State *bs_top, =20 ret =3D bdrv_attach_child_noperm(bs_new, bs_top, "backing", &child_of_bds, bdrv_backing_role(bs_new= ), - &bs_new->backing, tran, errp); + NULL, tran, errp); if (ret < 0) { goto out; } diff --git a/block/raw-format.c b/block/raw-format.c index bda757fd19..29435d3ac4 100644 --- a/block/raw-format.c +++ b/block/raw-format.c @@ -456,8 +456,8 @@ static int raw_open(BlockDriverState *bs, QDict *option= s, int flags, file_role =3D BDRV_CHILD_FILTERED | BDRV_CHILD_PRIMARY; } =20 - bs->file =3D bdrv_open_child(NULL, options, "file", bs, &child_of_bds, - file_role, false, errp); + bdrv_open_child(NULL, options, "file", bs, &child_of_bds, + file_role, false, errp); if (!bs->file) { return -EINVAL; } diff --git a/block/snapshot.c b/block/snapshot.c index 12fa0e3904..cb184d70b4 100644 --- a/block/snapshot.c +++ b/block/snapshot.c @@ -279,7 +279,6 @@ int bdrv_snapshot_goto(BlockDriverState *bs, =20 /* .bdrv_open() will re-attach it */ bdrv_unref_child(bs, *fallback_ptr); - *fallback_ptr =3D NULL; =20 ret =3D bdrv_snapshot_goto(fallback_bs, snapshot_id, errp); open_ret =3D drv->bdrv_open(bs, options, bs->open_flags, &local_er= r); diff --git a/tests/unit/test-bdrv-drain.c b/tests/unit/test-bdrv-drain.c index 45edbd867f..cb0eac5a1e 100644 --- a/tests/unit/test-bdrv-drain.c +++ b/tests/unit/test-bdrv-drain.c @@ -1804,9 +1804,8 @@ static void test_drop_intermediate_poll(void) for (i =3D 0; i < 3; i++) { if (i) { /* Takes the reference to chain[i - 1] */ - chain[i]->backing =3D bdrv_attach_child(chain[i], chain[i - 1], - "chain", &chain_child_cl= ass, - BDRV_CHILD_COW, &error_a= bort); + bdrv_attach_child(chain[i], chain[i - 1], "chain", + &chain_child_class, BDRV_CHILD_COW, &error_a= bort); } } =20 @@ -2024,9 +2023,8 @@ static void do_test_replace_child_mid_drain(int old_d= rain_count, new_child_bs->total_sectors =3D 1; =20 bdrv_ref(old_child_bs); - parent_bs->backing =3D bdrv_attach_child(parent_bs, old_child_bs, "chi= ld", - &child_of_bds, BDRV_CHILD_COW, - &error_abort); + bdrv_attach_child(parent_bs, old_child_bs, "child", &child_of_bds, + BDRV_CHILD_COW, &error_abort); =20 for (i =3D 0; i < old_drain_count; i++) { bdrv_drained_begin(old_child_bs); --=20 2.31.1 From nobody Thu May 16 17:05:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1638563516; cv=pass; d=zohomail.com; s=zohoarc; b=k0bHjhYCJvL/CnUzxtjRuHt0n97jLqSmniI8LicS1ls0twK9nPhR7Uozj6ONKkmdfjh/JtH0jTw8aBv3sRHCgHGpNBS51s26GLt/BYHwN62MIzzgpTuEUnpDAmUvZrUY+zs8J01CUZIyo1vsV3a9uDqsI1hZbLVZrMUGGO0JAPM= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638563516; h=Content-Type: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; bh=UJmj01KFgYGt01mpFsopt3xuBF4uLFTukUjGF7gO8z8=; b=E6Kogcy9OQgv4YWRQw19zuNsi70aowKV1u798SV7s+dG1olvHtn1BdIILJUBPotsLQuvTHkpntNDMW4FRgCCwAbKX0e2m+eWK4TH2b6H4SNLYadCvSo0alC2J8QZ+Wu9Bodc1bMRCJtmoQjGnY2NwvpWFSn1T5kTAqI6tHHuhJ4= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1638563515878219.92872045472382; Fri, 3 Dec 2021 12:31:55 -0800 (PST) Received: from localhost ([::1]:41788 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mtFDm-0003M2-EZ for importer@patchew.org; Fri, 03 Dec 2021 15:31:54 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57766) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mtF8u-00011i-6R; Fri, 03 Dec 2021 15:26:52 -0500 Received: from mail-db8eur05on2098.outbound.protection.outlook.com ([40.107.20.98]:1792 helo=EUR05-DB8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mtF8r-0001dZ-4i; Fri, 03 Dec 2021 15:26:51 -0500 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by AM0PR08MB4068.eurprd08.prod.outlook.com (2603:10a6:208:12b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.16; Fri, 3 Dec 2021 20:26:25 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::2078:5a2:1898:d83a]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::2078:5a2:1898:d83a%7]) with mapi id 15.20.4669.024; Fri, 3 Dec 2021 20:26:25 +0000 Received: from kvm.ch-qa.sw.ru (130.117.225.5) by AM6PR10CA0086.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:8c::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.16 via Frontend Transport; Fri, 3 Dec 2021 20:26:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iefV9s7CI9raWykNscSPkrbx0i3bT1UJTenT9K9So+GuRVQRn/2XEIlwHPPjjmLKbqBNOAUKO09FWhLx2BDEDfTdYQppwwpqHfKsCsfxM7mdEYphL7ZkU0+dcziOSgZy+8AEOtBcIsqXrkKvZdkSHreXGhwjs4AlfItuSk2j//oJ9wnpfiJAksHCBR1po4BFBxpdOW7WQBmCeWCYVG2xNQKBCWYOvriSW3Oo/n2ajG6Xuckh5V2MbJd1vcbmm2tlMM3YPZLfDmmNsb0lKGacyonjdz6zlYIvBRWD4eSZ99cEi0SrboXSdl/u5onynYorYi2h1avKvN2g4WficG8joQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=UJmj01KFgYGt01mpFsopt3xuBF4uLFTukUjGF7gO8z8=; b=mXHnzOAkC+pM7o19yhFNEr+AauakJhgVI+M/epOiiSZj74N28tHD1+LM4JqiVV7yO7aDrXxBzl9OfM4Nc3lUAIFblY9OahfplG0EUpZle9eIk+LA7P27q1JQtgdnjeC9Hfje7uyZSGSYDu+UOe42KvHPhn/BjW89yUhdfAdQE+YHmFzxYi6MhkgTgq1inQ+Cu5XYSuJYgd/QjDcUa/wmkd0cqU0461jHGrpzSbnZ8ig+JuQD/Yc2ZNlvWgSB6Vtq2Gj6GcS4OfcGabiQZtmUwSWTIRMmFnpU7ng9lKD5Nls/i0NAf+SrFh4W7GP0zkXPETRabo77BkJywHfdBBW42Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UJmj01KFgYGt01mpFsopt3xuBF4uLFTukUjGF7gO8z8=; b=FoB66ZvsGEgRl/4GfYTHC4v4LJKE+omSQBsjkloGGo8ClKPcvgP09NCxtWrXRBpF064t/FUxX7hbqRjI0VbHiTP8xhEEw0DHL++hHweEjEV/FBna2tDOL5yHsys1wQMG5XyP/VVN7tYvNdRtcmOrbdldagVrrC2rjvP3y+1tN34= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, kwolf@redhat.com, hreitz@redhat.com, vsementsov@virtuozzo.com Subject: [PATCH 14/14] block/snapshot: drop indirection around bdrv_snapshot_fallback_ptr Date: Fri, 3 Dec 2021 21:25:53 +0100 Message-Id: <20211203202553.3231580-15-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211203202553.3231580-1-vsementsov@virtuozzo.com> References: <20211203202553.3231580-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM6PR10CA0086.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:8c::27) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1fb5f9b5-dfce-4598-74ff-08d9b69b2df2 X-MS-TrafficTypeDiagnostic: AM0PR08MB4068: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:291; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5orQHoH/4xBBi784t3KVnuvW9yK6cbMGMHE2DVE2aqlchg5fUXZBsMGVN50wQpNWnOHg/pVAvyi4NgAsEbJehvRyW12IqqLIfvk0ke9IZpMevkHxoXLX26tNqzMbRAty517s4OTuyX9PNmL26nTC1Oi293qSiCmQmByREb67BTGhl0NaJZ+lXKvmbRSunz9r48tLbDlYGECQayIo3v8fElfBfPnWhqOX0aCXOwci8V5Oh1I15jYsPUoQNuhtnNJCC+dzHZx8fAFsjb9ldRmURpI8UuYYjao9+gdUKEzNdk70pTj3UF7/dyd6F3HoGs84qZRxh4VH+BGoQQpqkZdQwChORlOToZc7NgXY9PqBQtiT4VP5Pal/g6pvqEY1JMPKJrB1Ur0WqEm0fVBKbIqVtNcJvXHIVuZ6AEe0Q7Kxy0T3Y4PnFd6UgH/4+rvSyjO+B/OJur7f4HgMsT5wcYl1TyE82AVIRgNOTp+o4vPwc4MEe75ew8g0lMoGG42xmlgQgpdq5fFNbOfS1Wjh0P6d3pQss1q9zMzj8y00rgY+jbIJrvd4qQqagXIDxOju6tA0j0g5Y8L18+90mmrI1rqUGu1QQmYiwmwnnNeoSN99J/Cedr9sap7JCAj4xMsyEVfpMC5VIDpEMUSvEMju/tDeQpksl65J8CZD+Y/qMhaJb4SUT+lETfuZTLRCcH0B1PwgANTGgsmo+Gba3+Nhs8h4rA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(1076003)(107886003)(83380400001)(26005)(6916009)(8936002)(2616005)(66556008)(2906002)(508600001)(6506007)(6666004)(38350700002)(66946007)(66476007)(38100700002)(52116002)(186003)(316002)(4326008)(6512007)(36756003)(6486002)(956004)(8676002)(5660300002)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?JnOftCNd/yZ6tzwNkVaDV9GhhnFO9GOpr5GP1a580ZDITrG8Vxk9amJGaV7E?= =?us-ascii?Q?vM0AW3c0DQkY3UwKGLZfICbTFdQRuN81KjwhscwhRXQ9MZpfrhe4h18rrCoG?= =?us-ascii?Q?DKIbTJedmYgTtE8V75l2sc9Y0Mh3BSJV9yGzeF8NMZRFEUdvOWJ+QbB8yC+s?= =?us-ascii?Q?olJNsbyKfWIGbUbIDvv63MUcr9yTvDkX3TsWUtRttRLJuV9z8Psd53vg3k/k?= =?us-ascii?Q?PREA7MCFqwjRHM5nleqyogNcH51OSqYXbXozXixbM8YfCpfIpozRF8QHLNBf?= =?us-ascii?Q?wksqyYmbObbl5Uso2S5opOhGwwgS4EWqpRwkNd1f8v5mdj5vIJzq36SkBNxG?= =?us-ascii?Q?PsNN30qlZq83ok/YTgnF0BYQLojuTnFQs5BANpk448CmZYrRniNhCiyWXioZ?= =?us-ascii?Q?lNSW1xVj1vi/L41fQrpjVrC/2yLyLJpMEyjd1I/0o+NH7ycwnplkLGg/8glr?= =?us-ascii?Q?mulOPMxwrLwqApfVFF6H9Xlgj3kxzKnwehk6DrawH6hqKqlARcrCkYu+Uc1b?= =?us-ascii?Q?HqDO8tyBad4y1C1egn5iSzgPAr1wl895f8diSgaPlnrHwFtn0CQKq/auSKr7?= =?us-ascii?Q?dZ3G4u68u8oJHDcJSX4QP9YznfoC35BOH+kYuUlzqqNarxiNArzE75UHHKM3?= =?us-ascii?Q?AAIR7At/ANna6rs+5KaEyocNef6KQVU3AGtCwNSDhWJg1ZpvRjEGF8xx8isg?= =?us-ascii?Q?g0oRnj9SM/9N3hEm7VmOtDt03Y8/VVdwdwqXjFobchQvFn0mEdMrHkUzJo1T?= =?us-ascii?Q?7d8irwxqPgI6Dr1RaFn0fG4w2admt5MLRHeveIiXSLHkbrwvN8PJ3RbNJLRc?= =?us-ascii?Q?su14nYCV3tyvB9h/UNLOocc4L91LMSD7RcUL0vX1VMVKOH3J5GCl79yaOW8s?= =?us-ascii?Q?iwYh0FlKOBqAmfp6BOqq0/i1aLTrfZ0lyUDQSvCu6LLSHXe9+NuLJTW+nQya?= =?us-ascii?Q?0w0bD/m6K5RHQc+6PC4espXEosZ0jUx+cp8pKaTDO+WNKGWNXTWPrDSkdo8v?= =?us-ascii?Q?sMAtzlp08olQ0yHUG8r4PAwpxfyu5OtvSlh1zG7EJAVoPB7s8QE4jtTTq47I?= =?us-ascii?Q?xiSESz9KRJxYBxoQmTtAkVY/2xAqU6SUt72mhLyCnkgNRV29AzzdBKZY676G?= =?us-ascii?Q?rATUI0qvU/X4KSYzvbKzMDf0fI6WyMH50ZypulLYPotYtc5feBwBwVUo2yND?= =?us-ascii?Q?f/S85lO9mCEohdZKYLh5zal6bNoPel5+dP20U06p1osK2soQYE3qkLcL37/u?= =?us-ascii?Q?D0jaxA+K5l6L6cNnYl3tEIcI2DtblpQoHNU7wiLVs0M9qNlFLz95LlSQOCJE?= =?us-ascii?Q?ALEcYXIl6qehTLNcLf9ymLVwB/Vc71gerNyLpRqEuTD1vaVCtNsMBTXA3WTl?= =?us-ascii?Q?FdcaLmcBOEZL+0jIUhRPmPc6Y0FRvmvgkqXf+g8knLWtpfWkQOrCiD0d5W1r?= =?us-ascii?Q?x/dn1OGsb15GBeyMJpkt2MoqoRKNMt8sP63o+0pSNzAElagVmfqm91DVrUv7?= =?us-ascii?Q?oFAQCXu+ctEB7E4GmLi3ydi9lw15NrYOQzJMIbPhdG7s+FdBPNPRo/6M+bjy?= =?us-ascii?Q?g5mfVoJLTyG5qo7tZd4BHcOBfFiNcakiJHy2DW+CO6XCgn7kvP5jtpBV+Cjy?= =?us-ascii?Q?ul0UFXkN53P4nItCmxjjogCvVkA/c+a7ZnQprASibDjSHhToASHDscX9Gk4z?= =?us-ascii?Q?3ngGNw=3D=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1fb5f9b5-dfce-4598-74ff-08d9b69b2df2 X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2021 20:26:25.8956 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: or7ptYQ5xTB2BIUj03xN3vY8kq7nt4icSe1QPRoUyi26FWLTZ4jkDspSWAnxY8wRuQsrw3UwU3zN5Tjoze0E+BQMgkJG4XkbQm921RJakwo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4068 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=40.107.20.98; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-DB8-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1638563516875100001 Content-Type: text/plain; charset="utf-8" Now the indirection is not actually used, we can safely reduce it to simple pointer. Signed-off-by: Vladimir Sementsov-Ogievskiy --- block/snapshot.c | 39 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/block/snapshot.c b/block/snapshot.c index cb184d70b4..e32f9cb2ad 100644 --- a/block/snapshot.c +++ b/block/snapshot.c @@ -148,34 +148,29 @@ bool bdrv_snapshot_find_by_id_and_name(BlockDriverSta= te *bs, } =20 /** - * Return a pointer to the child BDS pointer to which we can fall + * Return a pointer to child of given BDS to which we can fall * back if the given BDS does not support snapshots. * Return NULL if there is no BDS to (safely) fall back to. - * - * We need to return an indirect pointer because bdrv_snapshot_goto() - * has to modify the BdrvChild pointer. */ -static BdrvChild **bdrv_snapshot_fallback_ptr(BlockDriverState *bs) +static BdrvChild *bdrv_snapshot_fallback_ptr(BlockDriverState *bs) { - BdrvChild **fallback; - BdrvChild *child =3D bdrv_primary_child(bs); + BdrvChild *fallback =3D bdrv_primary_child(bs); + BdrvChild *child; =20 /* We allow fallback only to primary child */ - if (!child) { + if (!fallback) { return NULL; } - fallback =3D (child =3D=3D bs->file ? &bs->file : &bs->backing); - assert(*fallback =3D=3D child); =20 /* * Check that there are no other children that would need to be * snapshotted. If there are, it is not safe to fall back to - * *fallback. + * fallback. */ QLIST_FOREACH(child, &bs->children, next) { if (child->role & (BDRV_CHILD_DATA | BDRV_CHILD_METADATA | BDRV_CHILD_FILTERED) && - child !=3D *fallback) + child !=3D fallback) { return NULL; } @@ -186,8 +181,8 @@ static BdrvChild **bdrv_snapshot_fallback_ptr(BlockDriv= erState *bs) =20 static BlockDriverState *bdrv_snapshot_fallback(BlockDriverState *bs) { - BdrvChild **child_ptr =3D bdrv_snapshot_fallback_ptr(bs); - return child_ptr ? (*child_ptr)->bs : NULL; + BdrvChild *child_ptr =3D bdrv_snapshot_fallback_ptr(bs); + return child_ptr ? child_ptr->bs : NULL; } =20 int bdrv_can_snapshot(BlockDriverState *bs) @@ -230,7 +225,7 @@ int bdrv_snapshot_goto(BlockDriverState *bs, Error **errp) { BlockDriver *drv =3D bs->drv; - BdrvChild **fallback_ptr; + BdrvChild *fallback; int ret, open_ret; =20 if (!drv) { @@ -251,13 +246,13 @@ int bdrv_snapshot_goto(BlockDriverState *bs, return ret; } =20 - fallback_ptr =3D bdrv_snapshot_fallback_ptr(bs); - if (fallback_ptr) { + fallback =3D bdrv_snapshot_fallback_ptr(bs); + if (fallback) { QDict *options; QDict *file_options; Error *local_err =3D NULL; - BlockDriverState *fallback_bs =3D (*fallback_ptr)->bs; - char *subqdict_prefix =3D g_strdup_printf("%s.", (*fallback_ptr)->= name); + BlockDriverState *fallback_bs =3D fallback->bs; + char *subqdict_prefix =3D g_strdup_printf("%s.", fallback->name); =20 options =3D qdict_clone_shallow(bs->options); =20 @@ -268,8 +263,8 @@ int bdrv_snapshot_goto(BlockDriverState *bs, qobject_unref(file_options); g_free(subqdict_prefix); =20 - /* Force .bdrv_open() below to re-attach fallback_bs on *fallback_= ptr */ - qdict_put_str(options, (*fallback_ptr)->name, + /* Force .bdrv_open() below to re-attach fallback_bs on fallback */ + qdict_put_str(options, fallback->name, bdrv_get_node_name(fallback_bs)); =20 /* Now close bs, apply the snapshot on fallback_bs, and re-open bs= */ @@ -278,7 +273,7 @@ int bdrv_snapshot_goto(BlockDriverState *bs, } =20 /* .bdrv_open() will re-attach it */ - bdrv_unref_child(bs, *fallback_ptr); + bdrv_unref_child(bs, fallback); =20 ret =3D bdrv_snapshot_goto(fallback_bs, snapshot_id, errp); open_ret =3D drv->bdrv_open(bs, options, bs->open_flags, &local_er= r); --=20 2.31.1