From nobody Wed Nov 13 07:10:36 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=1dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1621521562; cv=pass; d=zohomail.com; s=zohoarc; b=YpmzYeFu3CsMGGA65ih0k2BFqXuUbbGNCh5Yj4uOkMNVYLKZE3a6r/EK9pifIo5EGs716xOt4dou6UqKFtVTuI6WDSQniCZLP6tK1skqdrXEqdFqcKk037056QmHD5LPLVbsB1bGgz++6GeheXVtQ7RULenzFw2/lJ8j38tBvwo= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621521562; 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=JDA9K1JXkeUMHr90edWPnuaYvk89QAc3UVnpb6fe40E=; b=FMyAHIKksjjTxiu5dNmTlrkM71c5fqClIpUuTVdfPWQFRsc7aaztRFKUjcGRXDyPNXWHenS1dsv7gyrfg1dDBh87CBPAEQh8Kp9zGMbHO4obHCi5q5oP1jOpir0zxafykMWeQu1nAjAKNF8fc7AbJ7JbtaeCb/z34SyKb7Pgezk= 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=1dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1621521562646588.4093852445196; Thu, 20 May 2021 07:39:22 -0700 (PDT) Received: from localhost ([::1]:36338 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ljjpZ-0008Gf-FE for importer@patchew.org; Thu, 20 May 2021 10:39:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60940) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljjZw-0006NF-Ql; Thu, 20 May 2021 10:23:12 -0400 Received: from mail-eopbgr00128.outbound.protection.outlook.com ([40.107.0.128]:8320 helo=EUR02-AM5-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 1ljjZu-0005ij-On; Thu, 20 May 2021 10:23:12 -0400 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB3544.eurprd08.prod.outlook.com (2603:10a6:20b:4e::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.25; Thu, 20 May 2021 14:22:48 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::b403:c1a9:6bb7:133]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::b403:c1a9:6bb7:133%7]) with mapi id 15.20.4129.033; Thu, 20 May 2021 14:22:48 +0000 Received: from localhost.localdomain (185.215.60.197) by HE1P190CA0034.EURP190.PROD.OUTLOOK.COM (2603:10a6:7:52::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.23 via Frontend Transport; Thu, 20 May 2021 14:22:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ee93ZzLSnMciM1Qwdc6ZUxVRUKcW0q9FOcxFCtLEpWrjiIF2mv9mppDRP45HPH1qBz8DynagGBjgXQmowbldNOj6E0pgu1He6zcMjW9EMyozSsNJ7usni2bFPcEBNEJZtGtCxv7wvtL72XoyQXbKu0AM9l5uhFDc0c5xXOMAqcnYrnV0XpDV3zImRuhOTMMyRyEv+zeAEahd20Ou49TmzfqzNi2Rpz9OE+QJVpQ3P4uU/QJi9af2G4/P71N/Vyiukl1scBR3S6GLZBR0wEtuJThKD7obd7TcQKMoV+T72YV5zBqm+9KXVYIhK7eEZqdU5jyOcRC+EjFhlyW5jhwn5A== 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-SenderADCheck; bh=JDA9K1JXkeUMHr90edWPnuaYvk89QAc3UVnpb6fe40E=; b=H1AEq13N3+Avjs8YJJ9k5KE+zBEoz7KrXhVYi75uYm3IbXLVTuNG2L5CztiyMgHambZHa4DHovBd+R3PAJo58RuBdtZherP6wV5Bq5IT81JZNHTl+W5mS1rLoxCLTyw1Tvn2+L65gLGFUyRCCSszA6tK9BR12ozUmQzJlPaPthYXhZLfs6KD6XmxpUKhVng0BpLPQDkHGPel+YEbgAM6ayYpq8jiXrLE7doQTX8gF64ZR+vWqE2dSR1VvWkJa6fhBItHdqZ5bpzVoouhzpge94H6BYg7izGjedOeIriJ/BGRPKd3Cz9sHwrPyhS4gh6cqEw9mOm4eb7ynfhOdAom/g== 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=JDA9K1JXkeUMHr90edWPnuaYvk89QAc3UVnpb6fe40E=; b=hSwcf22yfiwDQEWuZMJAfhl/W4BKSDy1+B0HLJvQgulROwyX0EKGfJ/PHqoT0pCpmbipc3tCh+dO+uYvySB4PwHR3ycPH7nn9MdVuBTiSxkOqvXqiOnd1LbQ5hgAYYK/AlLgAbuXdjdH7vLajhjZQmnivi1uj1vUiV/TztHZSUo= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, eblake@redhat.com, armbru@redhat.com, crosa@redhat.com, ehabkost@redhat.com, berrange@redhat.com, pbonzini@redhat.com, vsementsov@virtuozzo.com, jsnow@redhat.com, mreitz@redhat.com, kwolf@redhat.com, den@openvz.org Subject: [PATCH v2 18/33] block/copy-before-write: cbw_init(): use options Date: Thu, 20 May 2021 17:21:50 +0300 Message-Id: <20210520142205.607501-19-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210520142205.607501-1-vsementsov@virtuozzo.com> References: <20210520142205.607501-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-Originating-IP: [185.215.60.197] X-ClientProxiedBy: HE1P190CA0034.EURP190.PROD.OUTLOOK.COM (2603:10a6:7:52::23) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 55f34d9a-2a49-42eb-e6fe-08d91b9abe56 X-MS-TrafficTypeDiagnostic: AM6PR08MB3544: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:820; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HNFbnzwmRZFKRiyQGfSQTVoqB+zUQKDp3slm64XPf3DXlV0Is5SIhiFeXDqyYRGHgioJjSWSd6zs5MTXJXQNiLFZUW1PUuAcJAiKldQrXV7dsJOh65SzCV0Wb/GlYCUxL55qHgm4ar9tX7In5GrBtisNaJ7A4tKorPpLJ2gLOY1OsjeJytOmB8xGOc8cKLgQrwvDrPueWykcBJC0cfv0o5DiY1JvqsYY3NCdyOqbt51waUzssvaXkReWMAPWh5ix8gQZpFAARuLj5fgIir/VLNemmsZBFwlaPiP+GSS2PM27X3BzIGY87iiDbMDw1eY2JMZxxEPlBpVVDKTgcf6ysbBmxsuU7P3Uv+Lw5Sr1hAsXBxDRVtwzhlqe3E/bcRelSKVtazFzSbZy1QajRy4oPvtFgKjo8YhCa8Gt1dmF48yg1DaWLK7iay3ItXbu9Mdk8yAA9A19Ps3iuZo6xGycW6+RO4at9ZHUHkt3PiGt0nAR0LeRmQaymK4cbf1IMvyBBN8j9X83H0jEk7ZAbcQ/u3BIkvg5Q5XxjdLUNJgQN4GgHMGIyIXLrC9BGHtGTxdlDMQ1p5eZsKVR7q7naaVbyby+Zh2u4mg6WWuLlN0OvAZeiML1hPhrdwhbApaaMHfB9A8B0+kMoplWpcsBBxxXrzttNv9aIFroOsenHCO5gwBA/2FIf143s0MbTvLzdeCb X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(346002)(376002)(39840400004)(396003)(136003)(478600001)(1076003)(52116002)(86362001)(66946007)(66476007)(4326008)(6486002)(2616005)(66556008)(956004)(26005)(5660300002)(6506007)(107886003)(7416002)(38100700002)(2906002)(8936002)(36756003)(186003)(316002)(6916009)(6512007)(8676002)(16526019)(6666004)(38350700002)(83380400001)(69590400013); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?jOQVgzj+QTKA16V7v9XppXXCj7L4Ut7jrk+SF+qYYzypdsJgZW1vF2gYOBUm?= =?us-ascii?Q?5lQuY6MYnwN/WBCup20D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?us-ascii?Q?XGNayA+ruFrTA17F31Vj6wnpnyl/hQbp3zNahBQJkAntz5qtkrjmp7536N1t?= =?us-ascii?Q?CtwN+Awkwgyx8KCPzjaIecphbRjiteitPrKHIZtGmpzRrJa8K1sZ9QDzjPPt?= =?us-ascii?Q?uSH6d7r3tyW+o4J2UeR9SvuF/R0gmaDj97ioP1tgeX8BUyZYJfgqhUP/csw1?= =?us-ascii?Q?pyLk/7/zis+RFhU0tlUoknJMKKQJAZzxy7Riy7UQ/10KvEcvGmLDJNIM+7sN?= =?us-ascii?Q?3cKmzjJjVX0i682YEq8QjXEVi17wDUF4FKcfTYopsJ1+3a0XsDFF0xfl5AsR?= =?us-ascii?Q?9XaZu/UJzYA+uLRJ4V0j/DXKMLr0Moj0t0H2fyCuU1+BmKJaIjO+IaJCgVVU?= =?us-ascii?Q?4pcnxmaK1+KCqlYMvujI4UmE?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 55f34d9a-2a49-42eb-e6fe-08d91b9abe56 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 May 2021 14:22:48.3588 (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: lKITgsrIoeP/923M2xrTG5WmPtGvkDI7cHLDZ00PIudqpUopXSKQTHj9epEzBFlNGMVwJvHovDf8M0DLMDD80A8sSgmAmnybjPA6TQWLShM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3544 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.0.128; envelope-from=vsementsov@virtuozzo.com; helo=EUR02-AM5-obe.outbound.protection.outlook.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_LOW=-0.7, 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.23 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) Content-Type: text/plain; charset="utf-8" One more step closer to .bdrv_open(): use options instead of plain arguments. Move to bdrv_open_child() calls, native for drive open handlers. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Max Reitz --- block/copy-before-write.c | 40 +++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/block/copy-before-write.c b/block/copy-before-write.c index 4858dcf8ff..e889af7b80 100644 --- a/block/copy-before-write.c +++ b/block/copy-before-write.c @@ -144,25 +144,21 @@ static void cbw_child_perm(BlockDriverState *bs, Bdrv= Child *c, } } =20 -static int cbw_init(BlockDriverState *bs, BlockDriverState *source, - BlockDriverState *target, bool compress, Error **errp) +static int cbw_init(BlockDriverState *bs, QDict *options, Error **errp) { BDRVCopyBeforeWriteState *s =3D bs->opaque; + bool compress; =20 - bdrv_ref(target); - s->target =3D bdrv_attach_child(bs, target, "target", &child_of_bds, - BDRV_CHILD_DATA, errp); - if (!s->target) { - error_prepend(errp, "Cannot attach target child: "); + 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; } =20 - bdrv_ref(source); - bs->file =3D bdrv_attach_child(bs, source, "file", &child_of_bds, - BDRV_CHILD_FILTERED | BDRV_CHILD_PRIMARY, - errp); - if (!bs->file) { - error_prepend(errp, "Cannot attach file child: "); + s->target =3D bdrv_open_child(NULL, options, "target", bs, &child_of_b= ds, + BDRV_CHILD_DATA, false, errp); + if (!s->target) { return -EINVAL; } =20 @@ -173,6 +169,15 @@ static int cbw_init(BlockDriverState *bs, BlockDriverS= tate *source, ((BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP | BDRV_REQ_NO_FALLBACK) & bs->file->bs->supported_zero_flags); =20 + /* + * The option x-deprecated-compress is only for internal use, to suppo= rt + * compress option of backup job. New users should instead use compress + * filter, if they want output to be compressed. + * Moreover compress option of backup should probably be deprecated to= o. + * So, x-deprecated-compress is not visible through QMP. + */ + compress =3D qdict_get_try_bool(options, "x-deprecated-compress", fals= e); + qdict_del(options, "x-deprecated-compress"); s->bcs =3D block_copy_state_new(bs->file, s->target, false, compress, = errp); if (!s->bcs) { error_prepend(errp, "Cannot create block-copy-state: "); @@ -210,6 +215,7 @@ BlockDriverState *bdrv_cbw_append(BlockDriverState *sou= rce, int ret; BDRVCopyBeforeWriteState *state; BlockDriverState *top; + QDict *opts; =20 assert(source->total_sectors =3D=3D target->total_sectors); =20 @@ -221,7 +227,13 @@ BlockDriverState *bdrv_cbw_append(BlockDriverState *so= urce, } state =3D top->opaque; =20 - ret =3D cbw_init(top, source, target, compress, errp); + opts =3D qdict_new(); + qdict_put_str(opts, "file", bdrv_get_node_name(source)); + qdict_put_str(opts, "target", bdrv_get_node_name(target)); + qdict_put_bool(opts, "x-deprecated-compress", compress); + + ret =3D cbw_init(top, opts, errp); + qobject_unref(opts); if (ret < 0) { goto fail; } --=20 2.29.2