From nobody Mon May 20 22:21:03 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=1608099781; cv=pass; d=zohomail.com; s=zohoarc; b=OspXKwAKl162yvgnNvJA+q4RriyxVZYQROf/5K6JpoCSvQwZduJItMGMY8CK/7XdYhiTcYh1zfewz7jMnuVCp38Ilsm5z5cL+7sVTAOQTsVQQGb7oDOPodSDRKolQOTCLsm/LTw9Phr9xsaGV3G6sApIFfA8cJYZc14K8oNFrRQ= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608099781; 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=avDoDJt8s6WZWtYVhHRa0PqWPJYjWOUDROl2/vpS+sQ=; b=UFIZdHjzP+LuT2D8QK+qvSddUiVtO+NTVy1hOvoum0U8KSyE/Zet+Fbptmh05dAWstUyhZntt5kdOriifBbFNKmjrG/+IqjAY6gEE0etY4Gh0IgoUAyXu4mQhf9IdJ7GxdmcMN/e/VI+ihY1mvA0H8dP6oDX2sTeNMQP+q7uHks= 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 1608099781109111.03454601817305; Tue, 15 Dec 2020 22:23:01 -0800 (PST) Received: from localhost ([::1]:34330 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpQDD-0008V3-Uy for importer@patchew.org; Wed, 16 Dec 2020 01:22:59 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53492) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpQ7y-0002cn-FO; Wed, 16 Dec 2020 01:17:34 -0500 Received: from mail-eopbgr00123.outbound.protection.outlook.com ([40.107.0.123]:51180 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 1kpQ7r-0001E7-DR; Wed, 16 Dec 2020 01:17:34 -0500 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AS8PR08MB6309.eurprd08.prod.outlook.com (2603:10a6:20b:29f::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.24; Wed, 16 Dec 2020 06:17:17 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::d585:99a4:d7a4:d478]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::d585:99a4:d7a4:d478%4]) with mapi id 15.20.3654.024; Wed, 16 Dec 2020 06:17:17 +0000 Received: from kvm.sw.ru (185.215.60.92) by AM4PR0202CA0008.eurprd02.prod.outlook.com (2603:10a6:200:89::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.12 via Frontend Transport; Wed, 16 Dec 2020 06:17:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=byUn8QSV59OB0uaEC8i3DOWCjQf0W+KXhQK1BlDimp11TSgZ0AavaLvKaTCKgIC4bT7BtyuYEl9/TDtzURFoED8urxLvdxrdSkeFbddvjKXAgLrjCYL+YFwHm0hX0yr005ZaWrOBo1G3mr73iyoaAYrHQ/q6823acVApfmCB/kyDk+E9OgvUggXHXhcm70iw+USDTDeazcsfKI37hbCQP2tl7nDLWeUDvB8iT1v5OrLBB1fjmo71hdCMuvTbsb73tEr2bb5DjdTu6DXk+86NQL5hVsBuCB2Sq5twFLGEwHo++bwxl9NbHzlE0BNwYbSitizuHYlLOziV1kKiqP6wPw== 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=avDoDJt8s6WZWtYVhHRa0PqWPJYjWOUDROl2/vpS+sQ=; b=auoGhZAplkA1VJtsjjuDP/naAZQS64UWtBAVLkK6ewtj+hEBp/tEqZxef92XGzmRn69TZ4JI5OO8Vowe/vCWGInwHCYkFbDt0L7BU3FTCsrFPL1cqCmVBKsQq2JzpKunoG4MtOoVz97WNICbFlTPed+o9LGo7LQnvaueahNBxlnRd6JolN6/YmKeX+hwnxrUrZLB1t6xmYZdchJdfgjULZou2CSQ9QPV5NTILdQhbuZ59DyDOtf66cVNvkTsO0PN1BPsE+vQgSSpoG8MFNtvu2wZjKIC8TLkwF29wNBI8Od/W8K2Ikmx0lw5v1SfMDsjEQFl0S3ispnndToM9QLHvQ== 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=avDoDJt8s6WZWtYVhHRa0PqWPJYjWOUDROl2/vpS+sQ=; b=Mxu31HFdHmVoHVli5GLFS7A2GNcsO4rz7sB0mlWFR9r45+OTjeRssNAV0WaxNdca5UvmBGeGVcDqH9V544oWFjijY8ktj6ayRf/77UEq7W05MElAn67cxpQtzLDVFD1OO8hD+clDTz4AZ+HoKr1Xii6kvb/VfEGesuOew4AfoWY= 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 Subject: [PATCH v15 01/13] copy-on-read: support preadv/pwritev_part functions Date: Wed, 16 Dec 2020 09:16:51 +0300 Message-Id: <20201216061703.70908-2-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20201216061703.70908-1-vsementsov@virtuozzo.com> References: <20201216061703.70908-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-Originating-IP: [185.215.60.92] X-ClientProxiedBy: AM4PR0202CA0008.eurprd02.prod.outlook.com (2603:10a6:200:89::18) 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: 5133af0f-36d6-4f83-198f-08d8a18a3d4c X-MS-TrafficTypeDiagnostic: AS8PR08MB6309: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3276; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QtDZnLUsHKm/ZSWCgQgUfW7weYxq9IquSD/EohH3dIqMjh3sY3lr01EEp1Yd+xq7gEbxS96SeoW85ekwx5Urp/s+e/JsALPThrizGg5hQfPagTcNT9NuAsS8ftFwlRBpRUpSpkWwhQD2QAkxGS9vxxvw18tBg2QbdUM5A2lMBe0HpDmWW87XxU0dPiuQGuT72sTaujCONl1dG/Y/22XRfFNmocbi8nWOrWOMYw3xGgmGjbD+jd07L/Y9w0ZVhkEdHX/G/Lxqfo89VHliqE7wBK0HSntipg7D8xHlEFHK3GQz5ikJTr5vnDu47DAeULZC7NYzrhbNWlX0pRUZZJHF8g== 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)(376002)(136003)(396003)(366004)(39830400003)(346002)(4326008)(5660300002)(66556008)(66476007)(186003)(16526019)(956004)(6506007)(6512007)(2616005)(66946007)(36756003)(6666004)(1076003)(86362001)(6916009)(316002)(6486002)(52116002)(2906002)(8676002)(83380400001)(107886003)(478600001)(8936002)(26005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?B5jGsAplPcgLWWGfCj1sLP+JySG+mq1uoLRqefY9AsSpBS4Sp2E4yUcVmiQ/?= =?us-ascii?Q?n5/VcOl1u9OvM2o27nWBR8orPC3kgfcgoqYtRiHXumuW3jusIxwAemAg2+j/?= =?us-ascii?Q?Ww+K/pxlgwDkvF/iAue3C+uBH6q2M7r0Q6oMwa0Cr+PEcwWDePNIUWMvC/vA?= =?us-ascii?Q?aG2r+6u7kPRArTVNrQLGEcmo97IvKK7q0WAlDBONnhy+eMv9t4mYm4mYIVsE?= =?us-ascii?Q?P5WIbaAIzsibNTi2IdOMziZ/xsEGf8qW0zmPN4k1tf7bLm0LnmhEgFB/dSqp?= =?us-ascii?Q?rIQ5VZF0NIn0vBbgBVvtITJGKo2hykswvvL+sMmwiISD7ayPYvrOJDgTN7ZV?= =?us-ascii?Q?k3J+MuqZaS1Pnbf5LcvhLbVL9yrssIOH0ea7wqARSws3tT/TRmCZ7loUsZKi?= =?us-ascii?Q?zY0KqVgT4ciOA3b2tCYRIzZEQ/4kmV0ZU5QyijCSbQqQqfpDQTipBf2wI9F1?= =?us-ascii?Q?03wmDdKI51DwtDIBMrNnbbTQbYgl3pw7FR/Z7xC1/1cHHXhDvirhsR054j0i?= =?us-ascii?Q?Jlvh7JRTxwmPgU5HzdUMIqkd/1F8HLsPE6bcqjHuHTixAf4A43e8CGM2Md/Z?= =?us-ascii?Q?2MBvEvp/82z2yRLTYFdgljTAnoj0wIt80PxRxHoMjbFLwGkDe0WzoOrI6Ukk?= =?us-ascii?Q?LzR6DokXJ6ofbrdlwHZkDN4U65CQbPhrtQ+OYhT5nR48/nA5+s+VyncN1arA?= =?us-ascii?Q?5WUNHLA4MkVlI8eGKU3Q29RQCI+4dsgSFXzVBx8zg0i++NOgDf4ckWEY/AXY?= =?us-ascii?Q?hbttGjG815XQ7r/Ajlh6fh1WgjpkFvoRSey9TNfF7TF7O+TeTUOuoC1HMree?= =?us-ascii?Q?c3gWYxZVEdfmpmdLoSOUFfEdBUrtzxWble2H9Zz59x2aF3qoRreHQmuhh5j8?= =?us-ascii?Q?yARhiYthMQV9h45GI6DAS226FfRz965X6tCfQPa6bU6nP1SMv8G5U42GUgBI?= =?us-ascii?Q?SfS+Sn+09TglVICCrlnt3oddr4CNCK6OlWzGAPL56w59f4+ZxBT6Uq5LulOY?= =?us-ascii?Q?Ityg?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Dec 2020 06:17:17.8453 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-Network-Message-Id: 5133af0f-36d6-4f83-198f-08d8a18a3d4c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: X/55NFxjbHZ4hNYCptL6aTJ0ixathbX34eXwE5WNXznSANmVnf87JaSvPQhSmm6Xz/bVbPbGMNGH/Z+TGyFZ3asVCYfSWOWIdKeLcLgEAE4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6309 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.123; 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: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, qemu-devel@nongnu.org, armbru@redhat.com, stefanha@redhat.com, den@openvz.org, andrey.shinkevich@virtuozzo.com, mreitz@redhat.com, jsnow@redhat.com 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" From: Andrey Shinkevich Add support for the recently introduced functions bdrv_co_preadv_part() and bdrv_co_pwritev_part() to the COR-filter driver. Signed-off-by: Andrey Shinkevich Reviewed-by: Vladimir Sementsov-Ogievskiy --- block/copy-on-read.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/block/copy-on-read.c b/block/copy-on-read.c index 2816e61afe..cb03e0f2d3 100644 --- a/block/copy-on-read.c +++ b/block/copy-on-read.c @@ -74,21 +74,25 @@ static int64_t cor_getlength(BlockDriverState *bs) } =20 =20 -static int coroutine_fn cor_co_preadv(BlockDriverState *bs, - uint64_t offset, uint64_t bytes, - QEMUIOVector *qiov, int flags) +static int coroutine_fn cor_co_preadv_part(BlockDriverState *bs, + uint64_t offset, uint64_t bytes, + QEMUIOVector *qiov, + size_t qiov_offset, + int flags) { - return bdrv_co_preadv(bs->file, offset, bytes, qiov, - flags | BDRV_REQ_COPY_ON_READ); + return bdrv_co_preadv_part(bs->file, offset, bytes, qiov, qiov_offset, + flags | BDRV_REQ_COPY_ON_READ); } =20 =20 -static int coroutine_fn cor_co_pwritev(BlockDriverState *bs, - uint64_t offset, uint64_t bytes, - QEMUIOVector *qiov, int flags) +static int coroutine_fn cor_co_pwritev_part(BlockDriverState *bs, + uint64_t offset, + uint64_t bytes, + QEMUIOVector *qiov, + size_t qiov_offset, int flags) { - - return bdrv_co_pwritev(bs->file, offset, bytes, qiov, flags); + return bdrv_co_pwritev_part(bs->file, offset, bytes, qiov, qiov_offset, + flags); } =20 =20 @@ -137,8 +141,8 @@ static BlockDriver bdrv_copy_on_read =3D { =20 .bdrv_getlength =3D cor_getlength, =20 - .bdrv_co_preadv =3D cor_co_preadv, - .bdrv_co_pwritev =3D cor_co_pwritev, + .bdrv_co_preadv_part =3D cor_co_preadv_part, + .bdrv_co_pwritev_part =3D cor_co_pwritev_part, .bdrv_co_pwrite_zeroes =3D cor_co_pwrite_zeroes, .bdrv_co_pdiscard =3D cor_co_pdiscard, .bdrv_co_pwritev_compressed =3D cor_co_pwritev_compressed, --=20 2.25.4 From nobody Mon May 20 22:21:03 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=1608099587; cv=pass; d=zohomail.com; s=zohoarc; b=UCzZAwLlqdibCJOXRmAC9AkTKejd7ZEvrfkw5u29gkleHlJskij4QTWRI/IqVSUmvMY2RuANru0XpNIhk0cIVWsdwhSihLbH7lV6oAK2PTpJnUaJly7fQuzhoC3kgSLwiYFtK79XL7oc9vNoFM57IQAOclvYXRbhZj7ybFiklzY= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608099587; 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=iiFnHSDVmn8R0jv2ACkeT1KnVgS7TjugogxgWo6bRYA=; b=cGrzz2RETJLgN97+iVY61RKsOkkUkk+4jf3Xbxb226BSweUKzTe9Rs6DCshDAouqm6qYPImefjkgIux2jbgHM/Vl8geJcm8E2Xsq170/0lI63o34joUMfDXhhCQ4FR+YOsjZcFKX/WrOE+G0OEXcLYlypuFpxxLpeNa3ol8K08A= 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 1608099587229750.0045997203549; Tue, 15 Dec 2020 22:19:47 -0800 (PST) Received: from localhost ([::1]:53264 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpQA5-0004fA-Uq for importer@patchew.org; Wed, 16 Dec 2020 01:19:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53478) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpQ7u-0002cO-TN; Wed, 16 Dec 2020 01:17:30 -0500 Received: from mail-eopbgr00135.outbound.protection.outlook.com ([40.107.0.135]:52920 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 1kpQ7r-0001CD-Re; Wed, 16 Dec 2020 01:17:30 -0500 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AS8PR08MB6309.eurprd08.prod.outlook.com (2603:10a6:20b:29f::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.24; Wed, 16 Dec 2020 06:17:18 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::d585:99a4:d7a4:d478]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::d585:99a4:d7a4:d478%4]) with mapi id 15.20.3654.024; Wed, 16 Dec 2020 06:17:18 +0000 Received: from kvm.sw.ru (185.215.60.92) by AM4PR0202CA0008.eurprd02.prod.outlook.com (2603:10a6:200:89::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.12 via Frontend Transport; Wed, 16 Dec 2020 06:17:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bxFGvhzHNoKR5LMpLJgxXcigeVn/AFqVXE2tg9AuBe1qZjI3mdhU7+Ik+UfMTZnCEkXm0GqVE8XgV0hmX79DU4v7IqG/kNWkTXffPXmUMRRYv8lEvpS4fgaCdFkvVoqaXX4HDfkcETLbXNB1eDmQnvoS6tq6gjDkNQ/Dfqkuchj/dz2o8qH9nWYLsWPxfyETZ5POmTNPk/AoCx/AWL7IxgvrhBsWuydEyi0RVgzDQcQpJegKYhKzbL7U0oqaKuvyX+LWQK3tfQEDS/oColB1UBvyM387Vhmy9Xn2w76+SSVUVxcZ2vJv63rgR5bnGBxsqBkEbNL1oew+V6ZIYrUaTQ== 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=iiFnHSDVmn8R0jv2ACkeT1KnVgS7TjugogxgWo6bRYA=; b=VJZ3pjdstOWsI7xIYZU4lgrJScjG7TpEsszxi1ybLhW+2ucnLKv685+oz01VsX5x1oGJtSS6MRnGcVOxv38XWa5UUhiS6hzAizXL2/SAl3wqy0x4wFdR2MPyLf15P1Si0zUXhCtF4kActwBTaCB3OHQehscQx6dyz0gulxzusSHVDe0ex7tO9fOXkhh+lvDwE/SaFxqq1pLubgoUKo6YVD6wfRyN7ws1KxyYFb64uxXEEfROUy3aqoQDioY5hTnSDRaggLaSlhWXsgEe+tdszEGwH4PkrHTCHkRdqsPVcsuSzgb5IbNViTHAn4qYBMtWeHGbVn6Egc90EiaGc+I7RA== 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=iiFnHSDVmn8R0jv2ACkeT1KnVgS7TjugogxgWo6bRYA=; b=qVfP54UDpOUt4PNZxYaiy81og72A2gjycp2geikPjRX9xlhgeEl2X49vMVGYngbKlR3LdrK9coJC0QBtbxtxUO2U9Cv1D1i5hicnuBWdNJP1LAkxbxMT56qhQkiTrvJDUPCLjtF4IUxTlDacMJCp5H/Y2neUTnfw6AJ7zhFS3/0= 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 Subject: [PATCH v15 02/13] block: add API function to insert a node Date: Wed, 16 Dec 2020 09:16:52 +0300 Message-Id: <20201216061703.70908-3-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20201216061703.70908-1-vsementsov@virtuozzo.com> References: <20201216061703.70908-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-Originating-IP: [185.215.60.92] X-ClientProxiedBy: AM4PR0202CA0008.eurprd02.prod.outlook.com (2603:10a6:200:89::18) 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: 6d785eaf-f9d8-4bf6-0bc4-08d8a18a3de2 X-MS-TrafficTypeDiagnostic: AS8PR08MB6309: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5516; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zTI64n3QejFGMs1celTnA7maMTaGwm794okvOuEgSjO/8O1yxSt4/KWIGxjryqOihTDB6kIeh/WPzfgxIcVw2/jaYnI/dLpc6qRwr3UGJb2MliOl9jEVb+mYf8KjhI7Q11hfrWC42hZMbCELRK8GhVOLcX6pO0YFi83rBIPI6oUFXVi6LYHMNfYlTm9FCMTFjXne66HkDW0nKIiwScOQc+bUJWzkYSlZfXGX63QtDXuOPGUPykxISVfVbyF9q8MKSRCSDOZzkCtoQ3fNk5rqC2vBN9GNW5D4wMuN3rDMf1l0dpJT7KlPXnB+LKlg9cTEJT4/UPSmiCCtcnsjm7ohYQ== 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)(376002)(136003)(396003)(366004)(39830400003)(346002)(4326008)(5660300002)(66556008)(66476007)(186003)(16526019)(956004)(6506007)(6512007)(2616005)(66946007)(36756003)(6666004)(1076003)(86362001)(6916009)(316002)(6486002)(52116002)(2906002)(8676002)(83380400001)(107886003)(478600001)(8936002)(26005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?KBwQJmivsN0/MTlfEqMbMbjw/Ow4rIN6l2vw94iVaYPE12zDO0CNOEuST7w8?= =?us-ascii?Q?FAwnWE/MoE7WGz15C4xz7qZn9C6S9IANWIJUjTDRr56atz/QSButxqXAAmQu?= =?us-ascii?Q?uU4d5UE+icdMT+hHgN0ZXpHpQvzyUdx0iHJRZnziwGbo+ONApUS8Ppi4D+jf?= =?us-ascii?Q?cjs6FF22Rl82kFP2ITaum6k5IFwfV2/ro5pmo//psKtC/C79o9kLJW/1n4n3?= =?us-ascii?Q?ByhNfE3giVULSNKGKTyTgxU1y5kwNdJ/dbD4wPOlg0bUkpOUfMEcj5be1hrC?= =?us-ascii?Q?tYj5UQyLwGIvnsZ0uhv2ylMyyDwS/LNiAVtvC1xygLy+Rp1Tw1J5nzSPPYlo?= =?us-ascii?Q?NJ3b7Q0iENL2vHkZOA/cGricLRPycIcCrnZSFNkH7kuwx/3gv30GA3EmSGGA?= =?us-ascii?Q?QqHX90/sZXIpsJE1vtIWUYPSmZFWd5lbSPNI/Kmio29mIAxp8lkrmCigFUFg?= =?us-ascii?Q?lJfgs3atqLN35+0HRzEmUe9ADRCZ7LRdfsYFLDe+GH0A49dM15frJ6FunS6l?= =?us-ascii?Q?lG0orsd6E4ngZzin3Ub3VX40ek2PtTa3cehQq3WGRqajYeMcN5sJC67FnRtl?= =?us-ascii?Q?Zp5rhdGMMPWLn7x/ijbH1O9eOWuV3QdNWs6SVuQMqzLlLQtVccyBo5w2LHQF?= =?us-ascii?Q?aygioUkoASGP3+VTtIgl7Hst7xbbpydX2rUE5SPm3cZnFtA2x6dwphxjgZOZ?= =?us-ascii?Q?GGkYhOD+I8HcHDsPuOLyVcWrAanR3eDh2+26QxKnTYiw36gH0m932ZtK163O?= =?us-ascii?Q?mFttog6VZJXW1GieHqkShreIzDSbVLWD0b/r5+1XzMtdSzHdAM28FrDjehdo?= =?us-ascii?Q?Y2ATdmx4PwqS5FaIHVea/9Fbl81+6G8tR/3AxR8qGpfbFFq9zlA+jGzd0TtR?= =?us-ascii?Q?6VWhMoOOkjzeBvFMn4i3JJ2B4emCdWHVFLFCTfkMUWk7urpCymgmVFh59X+q?= =?us-ascii?Q?xglH4tf0sNTwV6ZXll011Arn7gh2q9ho9ZU/G9wBazTcpOc+23ih3viIFpbl?= =?us-ascii?Q?3m8T?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Dec 2020 06:17:18.7881 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-Network-Message-Id: 6d785eaf-f9d8-4bf6-0bc4-08d8a18a3de2 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: LjRwmNrFQCyCD6fAQMJBHnnrsLn1QJzTfXWZjlTdaTnOQmcsIxcUtHzVZCsEGCgGuhsokqUzeEgWewSboX1ONjZxy0+yiNro+oWedeTFQmU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6309 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.135; envelope-from=vsementsov@virtuozzo.com; helo=EUR02-AM5-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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, qemu-devel@nongnu.org, armbru@redhat.com, stefanha@redhat.com, den@openvz.org, andrey.shinkevich@virtuozzo.com, mreitz@redhat.com, jsnow@redhat.com 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" From: Andrey Shinkevich Provide API for insertion a node to backing chain. Suggested-by: Max Reitz Signed-off-by: Andrey Shinkevich Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Max Reitz --- include/block/block.h | 2 ++ block.c | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/include/block/block.h b/include/block/block.h index 5b81e33e94..8ea794959b 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -360,6 +360,8 @@ void bdrv_append(BlockDriverState *bs_new, BlockDriverS= tate *bs_top, Error **errp); void bdrv_replace_node(BlockDriverState *from, BlockDriverState *to, Error **errp); +BlockDriverState *bdrv_insert_node(BlockDriverState *bs, QDict *node_optio= ns, + int flags, Error **errp); =20 int bdrv_parse_aio(const char *mode, int *flags); int bdrv_parse_cache_mode(const char *mode, int *flags, bool *writethrough= ); diff --git a/block.c b/block.c index 8f177504d4..8ed9c5eaf9 100644 --- a/block.c +++ b/block.c @@ -4704,6 +4704,31 @@ static void bdrv_delete(BlockDriverState *bs) g_free(bs); } =20 +BlockDriverState *bdrv_insert_node(BlockDriverState *bs, QDict *node_optio= ns, + int flags, Error **errp) +{ + BlockDriverState *new_node_bs; + Error *local_err =3D NULL; + + new_node_bs =3D bdrv_open(NULL, NULL, node_options, flags, errp); + if (new_node_bs =3D=3D NULL) { + error_prepend(errp, "Could not create node: "); + return NULL; + } + + bdrv_drained_begin(bs); + bdrv_replace_node(bs, new_node_bs, &local_err); + bdrv_drained_end(bs); + + if (local_err) { + bdrv_unref(new_node_bs); + error_propagate(errp, local_err); + return NULL; + } + + return new_node_bs; +} + /* * Run consistency checks on an image * --=20 2.25.4 From nobody Mon May 20 22:21:03 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=1608100024; cv=pass; d=zohomail.com; s=zohoarc; b=g2n4MOmM6xLp43DF4W6HbfeHmtiTztc7V1nz5m7HkgKtZcYfkmbsN/fuN8GUAZ2yfXzxVtzuiQs5ACiiPDJsMnr+E5EOsE7XHhYHSFqtFaWAB9VIwBEpgEBu89TTK3a5Qf4UB0oUuJfuBy158F53GJtYc/ju9EFjcnqU0IrNoqY= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608100024; 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=E6YVmnt9CqAhz6txSmyiUCiEqwEwFbJuqX60R09fycs=; b=JDiB4gulK5OseO+fEyPPV7DIvBdPUZyGA2oiB3Iwgr5WYex11r4Q0uvBvmYfCxoKBvHE6XgObr2e3sgwJhdSFPQPs5VgHWgJwexB47IHKezSQurzDigtg9W+CxihuiCvTEBzZ8bGJPZ7GevzALKrmS4eAPw7c5QeXh8oTHQ04Hg= 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 1608100024168490.56051322029145; Tue, 15 Dec 2020 22:27:04 -0800 (PST) Received: from localhost ([::1]:41638 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpQH9-0003F4-1F for importer@patchew.org; Wed, 16 Dec 2020 01:27:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53510) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpQ81-0002ds-G7; Wed, 16 Dec 2020 01:17:37 -0500 Received: from mail-eopbgr00134.outbound.protection.outlook.com ([40.107.0.134]:2800 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 1kpQ7w-0001G1-6j; Wed, 16 Dec 2020 01:17:36 -0500 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AS8PR08MB6309.eurprd08.prod.outlook.com (2603:10a6:20b:29f::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.24; Wed, 16 Dec 2020 06:17:19 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::d585:99a4:d7a4:d478]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::d585:99a4:d7a4:d478%4]) with mapi id 15.20.3654.024; Wed, 16 Dec 2020 06:17:19 +0000 Received: from kvm.sw.ru (185.215.60.92) by AM4PR0202CA0008.eurprd02.prod.outlook.com (2603:10a6:200:89::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.12 via Frontend Transport; Wed, 16 Dec 2020 06:17:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FxR0+g+CZatUXENFp+WV2w3/i5O0pG+Yk7zYUfrcmQS5YBrErasB5gyC6K4WItXT6ApsBeFEznftTRmUDPy8ANnV3HfVeQN4f4QmNhrh3wUPMpiJoL+GIVMyWXNBzfMxKFqC90RgEPHI/fpkmRK/BTjRJ/kZqOZBSQaorKGn0eoXjNJtHjqSrtWmlZlAdWdWGhykEbjGr+n1yXu3xsqV/U+379tcvEUcxDAGTWAnIagl6SAWiEIzM8Ej/wI7OL+uxBxLk7j3SociEEhYVJm4ulgnX+EhvDnPtJsYaKuobSLV4HsBwzn+2ObC711THfFLrS5lWgr4A5K0wL8jGHi0sw== 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=E6YVmnt9CqAhz6txSmyiUCiEqwEwFbJuqX60R09fycs=; b=WwIYih5oi7sLubJe7MO9s5TWBwvaXNRFAzx2Yc8sMxqQ4MgcqbSqhXW40M422m9UQzVFKLI6grSuytNj3t7Tpc8Qm5FkroWJXJx7RdH0k93AH/LEVVuE6ZU40nRHVWjnHdNSWqCBhej3UuC/qkpH4dDxBvovzIpg0VgIa4bb+FNom7EWbJ/dPiCyXgwaUP6anJGksM/aWCE18z/akTp5HQz/JdsB+sPwc/jQtax7oaOFLXzVKGkNMw/2xB57JcdLXyPt3ZQ8cJnJi/ZyamFV22V1UeQNUmENo6OdFVexJBKHNxJMZjA8c6YSIqJVKKyX6OobvrrT1L2NkBNj0VA9uQ== 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=E6YVmnt9CqAhz6txSmyiUCiEqwEwFbJuqX60R09fycs=; b=vkwIw9D5D0UH8vfe4I6tSysnHYrxixGaeULAFdhRycCJJiymeRjtoNYLgzrrnI2vh0oe3syO53ubRAk6o/w7RPOdAcl8RXx5fYr1bYW9UkNxrTMbkiYdqiOq4gLqBa1M9uygbPPjqN8Q88p9h/bzzxz8Fm+/AwQeoD+Na5QJwSc= 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 Subject: [PATCH v15 03/13] copy-on-read: add filter drop function Date: Wed, 16 Dec 2020 09:16:53 +0300 Message-Id: <20201216061703.70908-4-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20201216061703.70908-1-vsementsov@virtuozzo.com> References: <20201216061703.70908-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-Originating-IP: [185.215.60.92] X-ClientProxiedBy: AM4PR0202CA0008.eurprd02.prod.outlook.com (2603:10a6:200:89::18) 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: 13368b52-0d89-4994-045d-08d8a18a3e76 X-MS-TrafficTypeDiagnostic: AS8PR08MB6309: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YBqTKoDPzJsx00IjsMei1QUPH7LkV+NCpBMR7s+qIzNrVyx4cTmPS0HpSFtCLJKQwXmOQ6rLmhBLZ9nCb1nVaQzHKagrpwmVHZPnFFnRW6bAoPpowBBHZZJXpnVs53u/N3gZoeiOhp3XmqiEjGazrNltcFi85CqJDyzOrHDecnKvtRpBH195/5PvaG0Euqg656YJzVg/DuupzoFsItaP5mQ5fhVWQ1IL4mqp7imtvHfZLgmHwwFhtdI+YXyyAjkRdoivhDr184QfpyCOoBdbC9W/ZErhJaRM0yQ0+aljDP8F7vDVGuoS8QOWgflYryVq6Zp82Oy55GlrqmAa3Gs+nPRnLa/Obc/TbC8B/mXh+aEZNBvw9DXjXQiYIPLRYNYfhIoV44SZXqP1DtVKo6BeS6gaGNaXV/xTmvZs8U3DqmUbRfKumnMn69RhvOyk+hd6aU9raPlY1od4fwKz3DvCGg== 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)(376002)(136003)(396003)(366004)(39830400003)(346002)(4326008)(5660300002)(66556008)(66476007)(186003)(16526019)(956004)(6506007)(6512007)(2616005)(66946007)(36756003)(6666004)(1076003)(86362001)(6916009)(316002)(6486002)(52116002)(2906002)(8676002)(83380400001)(107886003)(478600001)(8936002)(26005)(2004002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?7y8CoYb33zkKz2S5uqj2uqe1Hpb7hKudFfAaM5pCSQCbS1wpIKF2ACLPIRdW?= =?us-ascii?Q?q2D5LlZoW2x5PQ0roa/ThWM1fdqL0NnPAmUlcXeRSF4njS6H1xK71Leejfr+?= =?us-ascii?Q?UrWft3mdcaEfQhdsbGhJGxAywPJ7/FvPTNvaUBNF4eQzrH7jPilUfAmTu0mP?= =?us-ascii?Q?Z2j3z7tiHlmoYnH9A+EBp8NKHJqr7iO/A+PU7713nTGjTZS4iEb+09tDZfrR?= =?us-ascii?Q?xILP4YrjLXHuTJ3jIFDK/pCpvjCV378FWfAtepwJRh8DTXHh9v71dUm3N9/D?= =?us-ascii?Q?PDYweqHFXcDDSXCpmkYZ98ll0foQV60U5LoSE4svVZb3tHudjSFgnZ/porDt?= =?us-ascii?Q?NNbNpIKpjvAnu2VEs6gzvX/+eYqaLOtqi0IEsETx8mff4zf7MDCyZ3y7C3O6?= =?us-ascii?Q?5gIDUl4Wt2D67sGs+SVpOwofdpQ+SgP2X+qunHbf/FHK/1W2RI/1Qj7ONbM3?= =?us-ascii?Q?Pth4n8+viQKVcAYvq1hWDyHqB1OsuMJpkn/a92BEapHXALt+on1L0YvCbNZ2?= =?us-ascii?Q?/ZVbcpRoZ+1kJAZxhbk6Y0jXvA1RB7E+LYxzAZzDwss+cLETX+dOW8hjgLNc?= =?us-ascii?Q?g/yVy479QVWtHNWfrvk5zq65LKG0rT5TzsMCVuwev0/6lab6oV6EaHSp2TMr?= =?us-ascii?Q?7uktelsIrFyl+4C0SVMpcmux13pUddpPg2UAvu81iEfxWcRhn0vfZitzn4wp?= =?us-ascii?Q?J1FZx1pG4Iw/Moark4CsrE5A1Zqf6c6o4TVCTC+4vdai68HR5t5+vxz42xsf?= =?us-ascii?Q?hfg1aVTR/VxFEkJVlsl/OdswHyCfJjTOCC6jOOMdr7w8NBVS4WFWT+PKci0w?= =?us-ascii?Q?9Ool8OD7Mmh96xF6IBDJYGb1WwSOPQwN/H5FaJ6EeH9+LNB+N1CYr50WBR7w?= =?us-ascii?Q?sJqcH7WXeTHPN/kyEkFBc2FgGAQQlYOTlqBBrlQpoKPI/nYwCeXq6mTaOVwX?= =?us-ascii?Q?dIWSYGXpSBJ5HKAwrhsbVOrRO5hKsrWNGAPnGWs/AfjH+/qiHbCnCV28yRPJ?= =?us-ascii?Q?rhsa?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Dec 2020 06:17:19.7828 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-Network-Message-Id: 13368b52-0d89-4994-045d-08d8a18a3e76 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: EKXRB0kT8rJejgHySnijcir7NE5fF1lZpqyK9M3PykbMBuykVkAoyWCekVIscVEHzv08KgwvK/B+nx4OHpelDlvQ/V5MQ7ah6iloWBIG1Vs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6309 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.134; envelope-from=vsementsov@virtuozzo.com; helo=EUR02-AM5-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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, qemu-devel@nongnu.org, armbru@redhat.com, stefanha@redhat.com, den@openvz.org, andrey.shinkevich@virtuozzo.com, mreitz@redhat.com, jsnow@redhat.com 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" From: Andrey Shinkevich Provide API for the COR-filter removal. Also, drop the filter child permissions for an inactive state when the filter node is being removed. To insert the filter, the block generic layer function bdrv_insert_node() can be used. The new function bdrv_cor_filter_drop() may be considered as an intermediate solution before the QEMU permission update system has overhauled. Then we are able to implement the API function bdrv_remove_node() on the block generic layer. Signed-off-by: Andrey Shinkevich Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Max Reitz --- block/copy-on-read.h | 32 +++++++++++++++++++++++++ block/copy-on-read.c | 56 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 block/copy-on-read.h diff --git a/block/copy-on-read.h b/block/copy-on-read.h new file mode 100644 index 0000000000..7bf405dccd --- /dev/null +++ b/block/copy-on-read.h @@ -0,0 +1,32 @@ +/* + * Copy-on-read filter block driver + * + * The filter driver performs Copy-On-Read (COR) operations + * + * Copyright (c) 2018-2020 Virtuozzo International GmbH. + * + * Author: + * Andrey Shinkevich + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef BLOCK_COPY_ON_READ +#define BLOCK_COPY_ON_READ + +#include "block/block_int.h" + +void bdrv_cor_filter_drop(BlockDriverState *cor_filter_bs); + +#endif /* BLOCK_COPY_ON_READ */ diff --git a/block/copy-on-read.c b/block/copy-on-read.c index cb03e0f2d3..618c4c4f43 100644 --- a/block/copy-on-read.c +++ b/block/copy-on-read.c @@ -23,11 +23,20 @@ #include "qemu/osdep.h" #include "block/block_int.h" #include "qemu/module.h" +#include "qapi/error.h" +#include "block/copy-on-read.h" + + +typedef struct BDRVStateCOR { + bool active; +} BDRVStateCOR; =20 =20 static int cor_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { + BDRVStateCOR *state =3D bs->opaque; + bs->file =3D bdrv_open_child(NULL, options, "file", bs, &child_of_bds, BDRV_CHILD_FILTERED | BDRV_CHILD_PRIMARY, false, errp); @@ -42,6 +51,13 @@ static int cor_open(BlockDriverState *bs, QDict *options= , int flags, ((BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP | BDRV_REQ_NO_FALLBACK) & bs->file->bs->supported_zero_flags); =20 + state->active =3D true; + + /* + * We don't need to call bdrv_child_refresh_perms() now as the permiss= ions + * will be updated later when the filter node gets its parent. + */ + return 0; } =20 @@ -57,6 +73,17 @@ static void cor_child_perm(BlockDriverState *bs, BdrvChi= ld *c, uint64_t perm, uint64_t shared, uint64_t *nperm, uint64_t *nshared) { + BDRVStateCOR *s =3D bs->opaque; + + if (!s->active) { + /* + * While the filter is being removed + */ + *nperm =3D 0; + *nshared =3D BLK_PERM_ALL; + return; + } + *nperm =3D perm & PERM_PASSTHROUGH; *nshared =3D (shared & PERM_PASSTHROUGH) | PERM_UNCHANGED; =20 @@ -135,6 +162,7 @@ static void cor_lock_medium(BlockDriverState *bs, bool = locked) =20 static BlockDriver bdrv_copy_on_read =3D { .format_name =3D "copy-on-read", + .instance_size =3D sizeof(BDRVStateCOR), =20 .bdrv_open =3D cor_open, .bdrv_child_perm =3D cor_child_perm, @@ -154,6 +182,34 @@ static BlockDriver bdrv_copy_on_read =3D { .is_filter =3D true, }; =20 + +void bdrv_cor_filter_drop(BlockDriverState *cor_filter_bs) +{ + BdrvChild *child; + BlockDriverState *bs; + BDRVStateCOR *s =3D cor_filter_bs->opaque; + + child =3D bdrv_filter_child(cor_filter_bs); + if (!child) { + return; + } + bs =3D child->bs; + + /* Retain the BDS until we complete the graph change. */ + bdrv_ref(bs); + /* Hold a guest back from writing while permissions are being reset. */ + bdrv_drained_begin(bs); + /* Drop permissions before the graph change. */ + s->active =3D false; + bdrv_child_refresh_perms(cor_filter_bs, child, &error_abort); + bdrv_replace_node(cor_filter_bs, bs, &error_abort); + + bdrv_drained_end(bs); + bdrv_unref(bs); + bdrv_unref(cor_filter_bs); +} + + static void bdrv_copy_on_read_init(void) { bdrv_register(&bdrv_copy_on_read); --=20 2.25.4 From nobody Mon May 20 22:21:03 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=1608099570; cv=pass; d=zohomail.com; s=zohoarc; b=dONqDzVoUwkzSMcwiPx8eio9TEYtJnOcSq0q0Ej9XrLK7bt3CrDOvY+PKXZQ/HgTodnl8ogV13HIB3fpEhL7nfCWgs3oT2l8N0rAJ3W07+AoM8151Sc260S4M8yKea0BIhXBmrJbcdm8HTfDXc0SdkVG8IIGdmOwmncnBlYikFQ= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608099570; 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=xREeye5cUA3DLZcSCdMj7Kij5v2Xx2dGoZhbMvOHd1E=; b=l5bnz3GO4Veo6AQ45xL2yod5oCMPeLRBvVG3U52KQYoLm+ZNEolpI41LMyV2zCHg/a7LZQ5Dlg7iSCx5gxRe3x6e6VgafJ3/k9YdhXM139J7QywOtL0iGr90/bbWFOTo8uatbgu585HA0xJGuzEp0IID4V/6GjiTXydwQTSJsic= 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 1608099570456459.1126211696687; Tue, 15 Dec 2020 22:19:30 -0800 (PST) Received: from localhost ([::1]:52604 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpQ9o-0004O5-QQ for importer@patchew.org; Wed, 16 Dec 2020 01:19:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53504) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpQ7z-0002d9-Vx; Wed, 16 Dec 2020 01:17:36 -0500 Received: from mail-eopbgr00135.outbound.protection.outlook.com ([40.107.0.135]:52920 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 1kpQ7v-0001CD-Lq; Wed, 16 Dec 2020 01:17:35 -0500 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AS8PR08MB6309.eurprd08.prod.outlook.com (2603:10a6:20b:29f::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.24; Wed, 16 Dec 2020 06:17:21 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::d585:99a4:d7a4:d478]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::d585:99a4:d7a4:d478%4]) with mapi id 15.20.3654.024; Wed, 16 Dec 2020 06:17:20 +0000 Received: from kvm.sw.ru (185.215.60.92) by AM4PR0202CA0008.eurprd02.prod.outlook.com (2603:10a6:200:89::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.12 via Frontend Transport; Wed, 16 Dec 2020 06:17:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S/wbov7j1k6/78l57iJPAgaq50fsX+Bk1UG7+ow6R9gthtYy5WlHNS8bJ/DRmWMA3E1TZIHniI1h0zCNjApjcKYhAmy0eldgmmFE1rG/eFSHeqN6ufD5yl+hN9YXfAsA5We91bEeWf3BoPOkkKmldS5PFKmuheyvwZ+nQwlfaUsRFKYgFMq0DtaWVZCSgvz1BZFo/rSuDj/0u+56/JozscLdBMBd9ZpVUozP8uutLYYXH09VbKXmZf1eXaQVq9/+4EwAREZ4qAD0yME3E6Fi7tYIMuO4UXzI+N30wDFe4R9fDPZp4F6DN0qSzuPuQgmfBgtWrxzPOYN3ErvF/1LcHw== 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=xREeye5cUA3DLZcSCdMj7Kij5v2Xx2dGoZhbMvOHd1E=; b=BHWc943uqmf2bdjZGTavlbF+fmSXqYMXLkkgHHRdaGMRSm8vducjpfUPwMpLS06pzVOlpHywqmzwASPTlC5euNv57u+zwJBYL+Mo3viWYBSLUfJccfi6hCE0EJaR2HX9FwEEDSAddH7BXvkQ2/m/HqxuoAi0foYRAbiOjELmx3z1nnToPSYxnstOeYUSihfxzghfGFcOoVXoGuaLG2k9LdnDVNC5T0E+I3jtgQWW585ApeyQriEwDnJrvPIi5qpA8t8Yct60SyO1oTBOSGd4Ql+g/bCG/H4BDNwcsQZV3dwq5gZGCRkH9uZ3d6Nd64lx6xkJDZCZgogqqAOpzYGZ9A== 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=xREeye5cUA3DLZcSCdMj7Kij5v2Xx2dGoZhbMvOHd1E=; b=a+Oo5PyVJ7GNV4AKE1wEaauwoJ1Xh+dyPlnIQJTc3uZP0XaGMSI/ajnHGzS72n7i3KRMuDMgclNzXfzmnii6FdcTm9OGSlBF6rQZcq9ewCV8o/iCsh+w9zyGpwKvWKdoqgf7xF1ROygfZ+w8/zy9fsrFMpNzrX3g1VhFmUMGhj8= 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 Subject: [PATCH v15 04/13] qapi: add filter-node-name to block-stream Date: Wed, 16 Dec 2020 09:16:54 +0300 Message-Id: <20201216061703.70908-5-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20201216061703.70908-1-vsementsov@virtuozzo.com> References: <20201216061703.70908-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-Originating-IP: [185.215.60.92] X-ClientProxiedBy: AM4PR0202CA0008.eurprd02.prod.outlook.com (2603:10a6:200:89::18) 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: c99a887e-2c3a-434a-3502-08d8a18a3f23 X-MS-TrafficTypeDiagnostic: AS8PR08MB6309: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:201; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1X+kcJh+V4NXfF9/voCFGPiMFn7qxmte9o5DYDRZ1jTL00/IjswMkFM98dvIZoJSDwlvgYMkCi3x20TQ8ILGUYSfBtHCQ25CF0EEjTazBi6gG0LbE5rO6NgpNAueyeTIAxwFqki9Wd+4HLDPbsPacrPHJMqP6YQ1d07TOBHIX1aBUIvt/gAZTQo7pGdyajA3AGvGB4HEhEZRmJW36zFRqd2jlP4lOKyzcU1U511t6UXEkY4SdO0Sol377XhFU9c6DD16BHb46MaldbOegM5n4MQtr/GIizfzzTP/xvXpIOjnxyBZQEi3wNq1xUf0iF1cLgXwSm0TDXzpC8ZCo1pX9g== 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)(376002)(136003)(396003)(366004)(39830400003)(346002)(4326008)(5660300002)(66556008)(66476007)(186003)(16526019)(956004)(6506007)(6512007)(2616005)(66946007)(36756003)(6666004)(1076003)(86362001)(6916009)(316002)(6486002)(52116002)(2906002)(8676002)(83380400001)(107886003)(478600001)(8936002)(26005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?k7WNkNgIGSbMAT3Ll1/nYm6VUrJYKCEEST7J8lXYDlDlwEGe/2IIUnnAGJiO?= =?us-ascii?Q?iiG664IHWsgBcNT4slSfEtHO7AXn/SkEdCIlPOocs+Rg6zM9h/q0AFTp889l?= =?us-ascii?Q?G/J9JuT1UIkLUTOOiYrNpk+Awz+IINP1Y0vQg5tPQFXXCtLyZ2ruoo26VE/T?= =?us-ascii?Q?/6AWZYHdNlMEN8ZdyHkZu6aMZXMHDVWsoQgNbSVSNthKQbVsAZlYY9juGwl6?= =?us-ascii?Q?QH0kOdFOutjSqxKn1MSp78JhgE4hcWUQ1ZquxT2kZEZ9gibKRUaNdrxKkzPU?= =?us-ascii?Q?fFfhAWdL7dAgjctQ5dnpO6/QLpbd7utA59y9rKqhlszlo6lzp7PVol4Lwtss?= =?us-ascii?Q?cTbvt7oCm3dqQNYUid3C4qKPnyEX3P2ke8tD8OVi58VSHGgNsD3uw67SOrhG?= =?us-ascii?Q?lP/NN2+KfISR5a2ae3QcSIj43KtVNJNPw/oeUebYnAhRRg4T9HwfqNayR+ZK?= =?us-ascii?Q?MNhBUnkCnu+o7CB6kVUG+wHbVZkwq+/li8cSNo1MH3l5kg4M3uIQoPQpO7jc?= =?us-ascii?Q?ZdM4rpkQAiH6UTmSL3nrmxpV7dko8x5EiplhiEEt8+Fh3aObcBmHrb9aVO7z?= =?us-ascii?Q?yxAP/KvCQGw64BTRIBqQXkfdorIbBNDmBRKWrrBWMGANNK5c+hfC1d6HFde8?= =?us-ascii?Q?Z7SRCuHF0JqbgIhraKTrZF+6yeLodP133LA/rrV5Y3oMI9xQDceJDlge2ZLn?= =?us-ascii?Q?wRseU9fG8pzX8tl3u+2amc4QRCxEI0hFn/SAVNipcryATT2smouMrw56kegL?= =?us-ascii?Q?45dtlquDmd809Sbfcg4HD450JA+yj0YMXmfkS6niVem9/wWwPFP4T4cKNTNc?= =?us-ascii?Q?iyUYWY9gIglgRrZpSpD9pUQFu9DJ2dUJ9VaYxM3qBV/pvh8yym7JFbppB77z?= =?us-ascii?Q?SClvPn65+1yYE1AIMRbpo76QVlS3qfUBM0ciDwS1W71q+tCk6QOF8n46GsZp?= =?us-ascii?Q?RT/6XdNxJHd113BLtLc5DC3ORL3B75y3DGkgzsH8JxckOVaoxiMx/5eDBpT9?= =?us-ascii?Q?W3Va?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Dec 2020 06:17:20.8670 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-Network-Message-Id: c99a887e-2c3a-434a-3502-08d8a18a3f23 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: pHKIPPziRsErF1xZFyhzfimoUiHwsFxmPFfrBBzcLYcqARY8FOssahKSb7FJu1i3a9cX77aX3AA7eUJH0GXBdzbM3SWccd3gCPqEPp1XAhA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6309 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.135; envelope-from=vsementsov@virtuozzo.com; helo=EUR02-AM5-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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, qemu-devel@nongnu.org, armbru@redhat.com, stefanha@redhat.com, den@openvz.org, andrey.shinkevich@virtuozzo.com, mreitz@redhat.com, jsnow@redhat.com 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" From: Andrey Shinkevich Provide the possibility to pass the 'filter-node-name' parameter to the block-stream job as it is done for the commit block job. Signed-off-by: Andrey Shinkevich Reviewed-by: Vladimir Sementsov-Ogievskiy [vsementsov: comment indentation, s/Since: 5.2/Since: 6.0/] Reviewed-by: Max Reitz --- qapi/block-core.json | 6 ++++++ include/block/block_int.h | 7 ++++++- block/monitor/block-hmp-cmds.c | 4 ++-- block/stream.c | 4 +++- blockdev.c | 4 +++- 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/qapi/block-core.json b/qapi/block-core.json index 04c5196e59..6050cf3c39 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -2543,6 +2543,11 @@ # 'stop' and 'enospc' can only be used if the block device # supports io-status (see BlockInfo). Since 1.3. # +# @filter-node-name: the node name that should be assigned to the +# filter driver that the stream job inserts into the gr= aph +# above @device. If this option is not given, a node na= me is +# autogenerated. (Since: 6.0) +# # @auto-finalize: When false, this job will wait in a PENDING state after = it has # finished its work, waiting for @block-job-finalize before # making any block graph changes. @@ -2573,6 +2578,7 @@ 'data': { '*job-id': 'str', 'device': 'str', '*base': 'str', '*base-node': 'str', '*backing-file': 'str', '*speed': 'int', '*on-error': 'BlockdevOnError', + '*filter-node-name': 'str', '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } } =20 ## diff --git a/include/block/block_int.h b/include/block/block_int.h index 1eeafc118c..6f778e2517 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -1142,6 +1142,9 @@ int is_windows_drive(const char *filename); * See @BlockJobCreateFlags * @speed: The maximum speed, in bytes per second, or 0 for unlimited. * @on_error: The action to take upon error. + * @filter_node_name: The node name that should be assigned to the filter + * driver that the commit job inserts into the graph ab= ove + * @bs. NULL means that a node name should be autogener= ated. * @errp: Error object. * * Start a streaming operation on @bs. Clusters that are unallocated @@ -1154,7 +1157,9 @@ int is_windows_drive(const char *filename); void stream_start(const char *job_id, BlockDriverState *bs, BlockDriverState *base, const char *backing_file_str, int creation_flags, int64_t speed, - BlockdevOnError on_error, Error **errp); + BlockdevOnError on_error, + const char *filter_node_name, + Error **errp); =20 /** * commit_start: diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c index d15a2be827..e8a58f326e 100644 --- a/block/monitor/block-hmp-cmds.c +++ b/block/monitor/block-hmp-cmds.c @@ -508,8 +508,8 @@ void hmp_block_stream(Monitor *mon, const QDict *qdict) =20 qmp_block_stream(true, device, device, base !=3D NULL, base, false, NU= LL, false, NULL, qdict_haskey(qdict, "speed"), speed, tru= e, - BLOCKDEV_ON_ERROR_REPORT, false, false, false, false, - &error); + BLOCKDEV_ON_ERROR_REPORT, false, NULL, false, false, = false, + false, &error); =20 hmp_handle_error(mon, error); } diff --git a/block/stream.c b/block/stream.c index 236384f2f7..6e281c71ac 100644 --- a/block/stream.c +++ b/block/stream.c @@ -221,7 +221,9 @@ static const BlockJobDriver stream_job_driver =3D { void stream_start(const char *job_id, BlockDriverState *bs, BlockDriverState *base, const char *backing_file_str, int creation_flags, int64_t speed, - BlockdevOnError on_error, Error **errp) + BlockdevOnError on_error, + const char *filter_node_name, + Error **errp) { StreamBlockJob *s; BlockDriverState *iter; diff --git a/blockdev.c b/blockdev.c index 412354b4b6..c290cb1dca 100644 --- a/blockdev.c +++ b/blockdev.c @@ -2501,6 +2501,7 @@ void qmp_block_stream(bool has_job_id, const char *jo= b_id, const char *device, bool has_backing_file, const char *backing_file, bool has_speed, int64_t speed, bool has_on_error, BlockdevOnError on_error, + bool has_filter_node_name, const char *filter_node_n= ame, bool has_auto_finalize, bool auto_finalize, bool has_auto_dismiss, bool auto_dismiss, Error **errp) @@ -2583,7 +2584,8 @@ void qmp_block_stream(bool has_job_id, const char *jo= b_id, const char *device, } =20 stream_start(has_job_id ? job_id : NULL, bs, base_bs, base_name, - job_flags, has_speed ? speed : 0, on_error, &local_err); + job_flags, has_speed ? speed : 0, on_error, + filter_node_name, &local_err); if (local_err) { error_propagate(errp, local_err); goto out; --=20 2.25.4 From nobody Mon May 20 22:21:03 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=1608099751; cv=pass; d=zohomail.com; s=zohoarc; b=XmE9x0hPiFEB+D9ygBvNkXJ+AGcsj3IcGASjO1/KqNNoEqE5YQTqtr+ANX8HaJGMfRasnX1GpNS7X+rF+OnfJGD7RFKmi7Z+z3sv6Lxeipokw3W6izRHsvnIDS/xhgNV0qCeRkA9GPHOg9EwMpkkHpQ8qUamZQ2affcsNKeBp4M= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608099751; 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=ysAk9YjDb8FYXiFzmRglteAShBBDwua/b0Vip14ydTU=; b=V9LcBJW9wt+kZbS7ZgQNd5IwpDlUdmpilETyUi1Y1rp5iQkHiNgOVIRbuELRbC3fjputhORBHW/n9peBgaRIf194oFpbD0pbtd8C3zkDF1X0F3Y8yci5KUSAAxht0Qfa5NTPxDfp92yYKQ7iRG1wzzRfBQnEB4dYVDu6QD+9LTc= 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 1608099751914685.6833647836227; Tue, 15 Dec 2020 22:22:31 -0800 (PST) Received: from localhost ([::1]:32828 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpQCk-0007tP-N4 for importer@patchew.org; Wed, 16 Dec 2020 01:22:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53542) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpQ82-0002eu-1X; Wed, 16 Dec 2020 01:17:38 -0500 Received: from mail-eopbgr00123.outbound.protection.outlook.com ([40.107.0.123]:51180 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 1kpQ7z-0001E7-7n; Wed, 16 Dec 2020 01:17:37 -0500 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AS8PR08MB6309.eurprd08.prod.outlook.com (2603:10a6:20b:29f::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.24; Wed, 16 Dec 2020 06:17:22 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::d585:99a4:d7a4:d478]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::d585:99a4:d7a4:d478%4]) with mapi id 15.20.3654.024; Wed, 16 Dec 2020 06:17:22 +0000 Received: from kvm.sw.ru (185.215.60.92) by AM4PR0202CA0008.eurprd02.prod.outlook.com (2603:10a6:200:89::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.12 via Frontend Transport; Wed, 16 Dec 2020 06:17:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WJGftD0nQHAiWQsYB5jdkOuQewPK4s1NG8O26I0iqHQ3kP5G3Djgen+lnpRUehs0Yj7zZVbsu8Kwo0x26kqeKUwBQRvmViVWRxRsiIGMYLVNKwjWJejst8a91BsWdIAxj2Ot8vu1aspejTsRri/I09Ry2gHekoH2pF2uITypvaCZYRsyn4OSJrrQpayWewBqVLG3itYdDP+AFgVTrgOu7X7k5NUpSmlV25tc/sOWQf6H4oBKPbRLgntw0Jki5BqQjk8vwvGfnH9Du6KYmkcVVvLRp+J61abpGGnotzCOrvUgTABjmyoKrpE0e55FqmxBGpwjQ+HHI4RpbEjojMm8LQ== 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=ysAk9YjDb8FYXiFzmRglteAShBBDwua/b0Vip14ydTU=; b=bIKD+jsB7JsQmr+eIgWVqeVgcp7U+08YwaI6/PqZEBgiqa/F/nbFcxJ63ogtteBESMkKs6zbMipNn9rlvWxfDXqipXygTiaDyoCw/pETq+SSGUs85H7DRHT2utL1ez3CkvyIrREXoXg0brpY8RgC57TdXEU2ucHbRzW+3qaW9m9bkrHTzA5AYK1S3ymtt0yVVffhgZhnP12z7SmYhhxLCq8cTl+LpFioPcj+DXBz04Ny18XufNxeDKdsv9FA4eLLS7ZU2tQCZXnH/L+DY5EVZ15EX4MRT6fg/G7O+3Zo+RU+2JK3OeNB+aRU4XPKx0zNbduBWmKwI1YgyaS6Cuhj/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=ysAk9YjDb8FYXiFzmRglteAShBBDwua/b0Vip14ydTU=; b=IByhYPjsXQ4bMp1UVS1e2CSHIRNoC9xIEkiQTo2/IPgStoleQPPD8X+ynr4SC5I1QI/aLvOZvW5/ewT6UAT4CAEE5rbnpNJ8nEtc59P2BA4g8WyDztzBOgdwwvzCH85CbwsX3RYPP9TW+Rd5V14N5WDNxyeUAlh7rAeN5ZQvWqc= 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 Subject: [PATCH v15 05/13] qapi: copy-on-read filter: add 'bottom' option Date: Wed, 16 Dec 2020 09:16:55 +0300 Message-Id: <20201216061703.70908-6-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20201216061703.70908-1-vsementsov@virtuozzo.com> References: <20201216061703.70908-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-Originating-IP: [185.215.60.92] X-ClientProxiedBy: AM4PR0202CA0008.eurprd02.prod.outlook.com (2603:10a6:200:89::18) 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: 9fea41af-0043-4a21-fa5e-08d8a18a3fc6 X-MS-TrafficTypeDiagnostic: AS8PR08MB6309: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2803; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8ss0CvJ9Sj7al4f4FrDmhRQDJBj8CWettksuW7AS5Rs9J165mwsDzPVNnIAgwgo1eUF0GzE3YJQZQM1rL+3qQbHIXXYNMZKGkvLfkz6N9DLxikl3r7BBVh/Polm3oVyGcrgmckmeziBtGPqcXs7hKPnAYzDgxN/jplFYRvXXluI1siz77CLdjk8IqxKbc99lHfbf3tEzZJK4faNbo0JPA8ilwl/S0hnQxhtHmuUxn5vQMV2QZNUpE7mamGwtV9Zw/T0WABiXPemUoZYSxWQRBtcX07pTxNQl1u7jBUrxndPW7UCfzQdcWNdR2b3gvar5 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)(376002)(136003)(396003)(366004)(39830400003)(346002)(4326008)(5660300002)(66556008)(66476007)(186003)(16526019)(956004)(6506007)(6512007)(2616005)(66946007)(36756003)(6666004)(1076003)(86362001)(6916009)(316002)(6486002)(52116002)(2906002)(8676002)(83380400001)(107886003)(478600001)(8936002)(26005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?L15FD5IEoKuUuwsuXyuKm1zzqVVFXq1xqH05pQkS66TDffFAJLmczF0Q2S6l?= =?us-ascii?Q?LXS//zO0cMuArXaIJRmuK9UOFipTxYs8Jgj2AK14pDfO8y8kBMxeTpFMg1Vn?= =?us-ascii?Q?m/1u/tzbWjhRm2iLwsD9Jxh4/abuic+mgg3jzBaXZwBs6mw52LvggEY8iB/0?= =?us-ascii?Q?0St0mOwvvpIr1mf5vbAje7Ur89VsHyItU76Hi7rzyNTnKf62bV6hXF6HpIXr?= =?us-ascii?Q?8lSBkzAbDrsuDyGdVDIz3T/dc/3JVbtBoqrs3MGXeEAmKNXX/xJXG5/kgRw9?= =?us-ascii?Q?J1oa3LymwUcZwt+iS0/fPbmV7z1R6iOtdB/Yv6m+3+t6xwv0KtXQTFm2jYI+?= =?us-ascii?Q?9AJOqOEgWvP1T433s+FVtH+N+Ve9FJPrHCpDXjSLWhikuVAiINp0mgPgdr7r?= =?us-ascii?Q?NWt+d9Z93AVDErJ9FW2zXfxserpmQHxIxaOdR+7SC7JheAsMU/2Y3xEpHqHe?= =?us-ascii?Q?HWxbZa8G9EiNT3NSW27Q3qKB4x0Xs7TW9jr+pCHYmylOjzQ5nEh6VtxGxXRX?= =?us-ascii?Q?9e/WH6iEEjpap2U9akao3Nipa7paASaemqb+WaEQRHXQ1GLEgOpjUHYKU7sW?= =?us-ascii?Q?7h/Sg6ZT7BF7RFkxXLccwRKQ+lH7Ps/lDLcWwVmbxF1eDTRtlzTlE7QlY63U?= =?us-ascii?Q?yPSZNbthnc4zl39E/aVDaFz4ihsE63NEfw10MUoms+Z5HQLH9CMwfci4D78n?= =?us-ascii?Q?/WItaDhWtxT3M7pR4Q3YFZfobflRTO98PDkS2Rqjhv9ne5G6kMRumf95uoAm?= =?us-ascii?Q?iQKSQsqFKCWebm4u5VTs09t5383bWkwYUmzIJ0NdLoTaZRiijMj8s36ApVJg?= =?us-ascii?Q?IaP5PceS6pprUm1kY7qIxjspxWS95UkS7ymjN3qCU7Lf7G6gVbyqirdaP3OP?= =?us-ascii?Q?/zvnsBZ8D8NRU8/Lt7Rvbp27r9ruNGW6hbWi3O9HVFkf4u0CLl6DYA7Z7FYx?= =?us-ascii?Q?5FgFLeVDfPUwDWXAsd9MdX9tHN0GfSEDcvizN6qfhWKLix3s66g7S0SVnSPi?= =?us-ascii?Q?gMYl?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Dec 2020 06:17:21.9702 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-Network-Message-Id: 9fea41af-0043-4a21-fa5e-08d8a18a3fc6 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: bEOtXj3oj7EUUpSygVjRAAqApe6ut9Iy7iAvy3qLNvR5xmt6mDQTbQEs0alpX+OCDlbSibtsv/RBj71AX8VkK2AzP5rbU0AsLMz00gopnT8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6309 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.123; 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: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, qemu-devel@nongnu.org, armbru@redhat.com, stefanha@redhat.com, den@openvz.org, andrey.shinkevich@virtuozzo.com, mreitz@redhat.com, jsnow@redhat.com 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" From: Andrey Shinkevich Add an option to limit copy-on-read operations to specified sub-chain of backing-chain, to make copy-on-read filter useful for block-stream job. Suggested-by: Max Reitz Suggested-by: Vladimir Sementsov-Ogievskiy Signed-off-by: Andrey Shinkevich Signed-off-by: Vladimir Sementsov-Ogievskiy [vsementsov: change subject, modified to freeze the chain, do some fixes] --- qapi/block-core.json | 20 ++++++++- block/copy-on-read.c | 98 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 115 insertions(+), 3 deletions(-) diff --git a/qapi/block-core.json b/qapi/block-core.json index 6050cf3c39..b8094a5ec7 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -3942,6 +3942,24 @@ 'data': { 'throttle-group': 'str', 'file' : 'BlockdevRef' } } + +## +# @BlockdevOptionsCor: +# +# Driver specific block device options for the copy-on-read driver. +# +# @bottom: The name of a non-filter node (allocation-bearing layer) that +# limits the COR operations in the backing chain (inclusive), so +# that no data below this node will be copied by this filter. +# If option is absent, the limit is not applied, so that data +# from all backing layers may be copied. +# +# Since: 6.0 +## +{ 'struct': 'BlockdevOptionsCor', + 'base': 'BlockdevOptionsGenericFormat', + 'data': { '*bottom': 'str' } } + ## # @BlockdevOptions: # @@ -3994,7 +4012,7 @@ 'bochs': 'BlockdevOptionsGenericFormat', 'cloop': 'BlockdevOptionsGenericFormat', 'compress': 'BlockdevOptionsGenericFormat', - 'copy-on-read':'BlockdevOptionsGenericFormat', + 'copy-on-read':'BlockdevOptionsCor', 'dmg': 'BlockdevOptionsGenericFormat', 'file': 'BlockdevOptionsFile', 'ftp': 'BlockdevOptionsCurlFtp', diff --git a/block/copy-on-read.c b/block/copy-on-read.c index 618c4c4f43..71560984f6 100644 --- a/block/copy-on-read.c +++ b/block/copy-on-read.c @@ -24,18 +24,24 @@ #include "block/block_int.h" #include "qemu/module.h" #include "qapi/error.h" +#include "qapi/qmp/qdict.h" #include "block/copy-on-read.h" =20 =20 typedef struct BDRVStateCOR { bool active; + BlockDriverState *bottom_bs; + bool chain_frozen; } BDRVStateCOR; =20 =20 static int cor_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { + BlockDriverState *bottom_bs =3D NULL; BDRVStateCOR *state =3D bs->opaque; + /* Find a bottom node name, if any */ + const char *bottom_node =3D qdict_get_try_str(options, "bottom"); =20 bs->file =3D bdrv_open_child(NULL, options, "file", bs, &child_of_bds, BDRV_CHILD_FILTERED | BDRV_CHILD_PRIMARY, @@ -51,7 +57,38 @@ static int cor_open(BlockDriverState *bs, QDict *options= , int flags, ((BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP | BDRV_REQ_NO_FALLBACK) & bs->file->bs->supported_zero_flags); =20 + if (bottom_node) { + bottom_bs =3D bdrv_find_node(bottom_node); + if (!bottom_bs) { + error_setg(errp, "Bottom node '%s' not found", bottom_node); + qdict_del(options, "bottom"); + return -EINVAL; + } + qdict_del(options, "bottom"); + + if (!bottom_bs->drv) { + error_setg(errp, "Bottom node '%s' not opened", bottom_node); + return -EINVAL; + } + + if (bottom_bs->drv->is_filter) { + error_setg(errp, "Bottom node '%s' is a filter", bottom_node); + return -EINVAL; + } + + if (bdrv_freeze_backing_chain(bs, bottom_bs, errp) < 0) { + return -EINVAL; + } + state->chain_frozen =3D true; + + /* + * We do freeze the chain, so it shouldn't be removed. Still, stor= ing a + * pointer worth bdrv_ref(). + */ + bdrv_ref(bottom_bs); + } state->active =3D true; + state->bottom_bs =3D bottom_bs; =20 /* * We don't need to call bdrv_child_refresh_perms() now as the permiss= ions @@ -107,8 +144,46 @@ static int coroutine_fn cor_co_preadv_part(BlockDriver= State *bs, size_t qiov_offset, int flags) { - return bdrv_co_preadv_part(bs->file, offset, bytes, qiov, qiov_offset, - flags | BDRV_REQ_COPY_ON_READ); + int64_t n; + int local_flags; + int ret; + BDRVStateCOR *state =3D bs->opaque; + + if (!state->bottom_bs) { + return bdrv_co_preadv_part(bs->file, offset, bytes, qiov, qiov_off= set, + flags | BDRV_REQ_COPY_ON_READ); + } + + while (bytes) { + local_flags =3D flags; + + /* In case of failure, try to copy-on-read anyway */ + ret =3D bdrv_is_allocated(bs->file->bs, offset, bytes, &n); + if (ret <=3D 0) { + ret =3D bdrv_is_allocated_above(bdrv_backing_chain_next(bs->fi= le->bs), + state->bottom_bs, true, offset, + n, &n); + if (ret > 0 || ret < 0) { + local_flags |=3D BDRV_REQ_COPY_ON_READ; + } + /* Finish earlier if the end of a backing file has been reache= d */ + if (n =3D=3D 0) { + break; + } + } + + ret =3D bdrv_co_preadv_part(bs->file, offset, n, qiov, qiov_offset, + local_flags); + if (ret < 0) { + return ret; + } + + offset +=3D n; + qiov_offset +=3D n; + bytes -=3D n; + } + + return 0; } =20 =20 @@ -160,11 +235,25 @@ static void cor_lock_medium(BlockDriverState *bs, boo= l locked) } =20 =20 +static void cor_close(BlockDriverState *bs) +{ + BDRVStateCOR *s =3D bs->opaque; + + if (s->chain_frozen) { + s->chain_frozen =3D false; + bdrv_unfreeze_backing_chain(bs, s->bottom_bs); + } + + bdrv_unref(s->bottom_bs); +} + + static BlockDriver bdrv_copy_on_read =3D { .format_name =3D "copy-on-read", .instance_size =3D sizeof(BDRVStateCOR), =20 .bdrv_open =3D cor_open, + .bdrv_close =3D cor_close, .bdrv_child_perm =3D cor_child_perm, =20 .bdrv_getlength =3D cor_getlength, @@ -201,6 +290,11 @@ void bdrv_cor_filter_drop(BlockDriverState *cor_filter= _bs) bdrv_drained_begin(bs); /* Drop permissions before the graph change. */ s->active =3D false; + /* unfreeze, as otherwise bdrv_replace_node() will fail */ + if (s->chain_frozen) { + s->chain_frozen =3D false; + bdrv_unfreeze_backing_chain(cor_filter_bs, s->bottom_bs); + } bdrv_child_refresh_perms(cor_filter_bs, child, &error_abort); bdrv_replace_node(cor_filter_bs, bs, &error_abort); =20 --=20 2.25.4 From nobody Mon May 20 22:21:03 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=1608099956; cv=pass; d=zohomail.com; s=zohoarc; b=DwhF0mFgQnyeaeZE3vq37pb7CnKd4LX9hjtKxLC+CXNOFYV49uWhV509XACk/CcE6X76d37ni4ftt8oSUkJe5J6T9QH3sO44Hp+BUorYvXV1SQkaHAqHbhpKCAE+3BEgwUZe0+IZBJxmcAHUkVBs4I+2dJgEtde4u853rmr7/Do= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608099956; 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=vdW3agc+22dzruYsT1wtqRfmBd73+Jv+FVjlt+0gPXk=; b=bDkE8DKn5h2WcGJ9xdO7Z0okEugxBw7TTFU/i423GlTULJQ4R1UmBIcLDddegdUHnCpCIeVMNlxoWMK4DbLkpXTBVy5CNs0vPfOoPO+fIAnx1QD0iaBORNEGJpiU2m+8QXHKNjiA/Rmlnv3HzVYJNePN3xeUkdRNlIZ+cw96na4= 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 1608099956167763.8989536885563; Tue, 15 Dec 2020 22:25:56 -0800 (PST) Received: from localhost ([::1]:39952 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpQG2-0002QO-V4 for importer@patchew.org; Wed, 16 Dec 2020 01:25:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53548) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpQ83-0002hW-6K; Wed, 16 Dec 2020 01:17:39 -0500 Received: from mail-eopbgr00135.outbound.protection.outlook.com ([40.107.0.135]:52920 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 1kpQ80-0001CD-KC; Wed, 16 Dec 2020 01:17:38 -0500 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AS8PR08MB6309.eurprd08.prod.outlook.com (2603:10a6:20b:29f::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.24; Wed, 16 Dec 2020 06:17:23 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::d585:99a4:d7a4:d478]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::d585:99a4:d7a4:d478%4]) with mapi id 15.20.3654.024; Wed, 16 Dec 2020 06:17:23 +0000 Received: from kvm.sw.ru (185.215.60.92) by AM4PR0202CA0008.eurprd02.prod.outlook.com (2603:10a6:200:89::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.12 via Frontend Transport; Wed, 16 Dec 2020 06:17:22 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ScBT6hpFSxHPw9BbO3CNrvGHKAWg4eNPAEXjUGZ2n1MpeaGrK+mJRriSXhhS3o06qZDak+8mKCkqBXBEVrBxy12cBWI52pzq5R+XCZML/Lzgb62huXRzlvPe2zVMOUaPgnKCHfLxFXvIR4Gx6TKcb4S+vXDT112/uTq5vxyhwPHsYrpBtxQR482z1exb5oID/flh0mZUIONbOD33FSFDcAXRbl9jabo6xlBeTh0xIsSb9kZqZkSgZl4BD02xWJ1hdmiUsGmDsYDH6DnZcM7VsHDbxeGbhTI06fk0lMY71yiRLxPzlBfIlu4cP1+NHXoEuXMYQHuP6Pmi7E4ofdnrOA== 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=vdW3agc+22dzruYsT1wtqRfmBd73+Jv+FVjlt+0gPXk=; b=Q/At3hyXCiXu+nHOz6r+jQYgE3nBSxlo3TK+VxtlX97/jk80VaDiiNLxemR0w9qop4nw5ZNgZsxzkgFJd7T2SB0mf3Gn2VvcZzTYTY212N3YVtweIb5ZZ6+R7SulxVUDtasQwveSP6MRiEwSQdKbnC02Rw42eJlsdkA+hCbuREtsiFVNv5FcyoGbZ3xlIYUoTvZOUBMgssb+7s3ZhsNGpUVHHECeUP8GjkFQMrgPx0b5jxaz6UEYrfjGhpFjIUvB6H5doouP4h7ZI7JCn1sekQxejhKdURdJekLyFuytKM2iZ363gvSmb3d66SNoH8HbV0HFqaZVWdMEsMAFxXzoAQ== 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=vdW3agc+22dzruYsT1wtqRfmBd73+Jv+FVjlt+0gPXk=; b=qWbdEIFZVD5ZGO9fuPjR0qWaLJOSQP+XIki0NFkrafZN+Vxmm38tgCEu6UhxwAm8zHdcZ1x70LocmGh73/I9Ha4b9zBznAlIHP1erxTkzIZRWE+2h0Qi00Ao+hHHb48QKVagjSVgJYLHmh3YeiqmcQ1OuhAwpcrJBAjtwzF46gI= 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 Subject: [PATCH v15 06/13] iotests: add #310 to test bottom node in COR driver Date: Wed, 16 Dec 2020 09:16:56 +0300 Message-Id: <20201216061703.70908-7-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20201216061703.70908-1-vsementsov@virtuozzo.com> References: <20201216061703.70908-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-Originating-IP: [185.215.60.92] X-ClientProxiedBy: AM4PR0202CA0008.eurprd02.prod.outlook.com (2603:10a6:200:89::18) 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: ae779ee3-b849-400a-613a-08d8a18a405d X-MS-TrafficTypeDiagnostic: AS8PR08MB6309: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: z2mtM930x75hvsx278qiQw/0I0GatdcBPNVe8SiA+5cFemsV/gzSZxke1RZFVXgCVsFCgbcxTVxi6B+ECkKM3/W0fkTkYKWySloAX5lFnL7tNTt7quwqsVFeo0EgckLXPT/33v6uNfFGwgGt9tmrsiueK/EJ1iOPLtFu9MzPvPl0MayD6DgWp1dRpZiJr5nvjmabtyIPCR6fPetduRg3Ox5+pZ0Vi+cW4PNnb+gJDZ0pbJIAISHoUYnhhrtEzBMXLdiSr83HAa27RApd3EuOQKrrp9CJhLSCAtSCZMrbsmHihp6h2Is5TkZCLx3HYi79JxR5onE0bvwna8FoI4V8odGs/zqzYrfY20KjFvtIStkq63EjQFPxr6ay6ewNBGEhsxCrJc4lT2uGhurm9pTbg8/7hudam5Tz7U8pHFQYntw7YBBnZ/jnti1iQMngUs+lzYMyQlXzWpbgF3o4+r42+w== 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)(376002)(136003)(396003)(366004)(39830400003)(346002)(4326008)(5660300002)(66556008)(66476007)(186003)(16526019)(956004)(6506007)(6512007)(2616005)(66946007)(36756003)(6666004)(1076003)(86362001)(6916009)(316002)(6486002)(52116002)(2906002)(8676002)(83380400001)(107886003)(478600001)(8936002)(26005)(2004002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?2K7OUEQBYy/iUU9NDgJNH0cvYFHacu3BKgmMckxIVlZdpdlD0b5/GhjN5dI+?= =?us-ascii?Q?JUe8r7IS9tlYwBjifkQe3VptXzOISoMkIPCw3/y6ohUjz3ern/2wnEP2jekj?= =?us-ascii?Q?CU2VJXZA0zXR7qM1nt8hjCGJUNrvmTrLlnyVz4yTkfdOow3ArAp6G2M9OJU2?= =?us-ascii?Q?/f0iYzi1+63Trn6XADfLdIed6fMt5NCNI6+SU+rL/vrpljCT26SJVZm67IAH?= =?us-ascii?Q?k9GKPdEeJMUZQPXfmBnrI5icuRFnt1dOSxtxBZ5D+DxtN04GplCToOQLfpKO?= =?us-ascii?Q?oXqY5f4a1GT77K87HvHTg6vcQM6JsDZWjHmM5VfcsaP/gEt0bW9LGTYGqZ3s?= =?us-ascii?Q?2WQx141TmEZwiYhesohulAeThyp4v5hXYWf5RS1bfmcXziqhsnV1yZoppL/a?= =?us-ascii?Q?kf1+foep01nte1eivnjIkeRhZTVOmkmaLyADiYCfA5xnV3x9WE5wKUlkvE4A?= =?us-ascii?Q?KJHaBvn/8WlsD8d/bMcVa0DKv17TXwOp/vWEz0oUeH0kpyvW4F4QUmPiFYuf?= =?us-ascii?Q?2ab4AyZbklfZL8R03SVOdyKX5R3Cip8F7huCaAXWrdkvBaP0ZKV4WBQhZpRB?= =?us-ascii?Q?vmbtVnNfJuXKeNJ+lgjxsv5ReNPpDm3cxeIkAktanzDjPojtyLFBkbn61QX0?= =?us-ascii?Q?YJPrHaGzcYRRgrU+CUd2IzcEzXv/C0t8XozAaWf/nkZ3xJMmKKsVapdjcaDT?= =?us-ascii?Q?KE3HBQgk8B6b0JFPz6UuS+jB9hkWnuE0SA2gz50s2+v6kY5ZPXDsazvr914n?= =?us-ascii?Q?B8XFxVoD4fKyfoQmizMOOKGxc5XciHmHltZ9RpN0nwVMEfksa18gXk4Fb9sj?= =?us-ascii?Q?OQfUfHgqFdfMYHbEqSuT/7QLlAgrKY96FN7mdqjmQtevzL6nOvIEjoYLYFVA?= =?us-ascii?Q?alng70JmiXtUkPLAs2vLBPU2Zi5M6ZUGPUXXKDsbum9Y/L5w4jUq8KGGOQon?= =?us-ascii?Q?iBiD6hU6+CKELDZpEhAZkcyhvhb+h2R5YMUjiPV9iJ66Ajh2v4+hBCRoeity?= =?us-ascii?Q?FxTM?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Dec 2020 06:17:22.9907 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-Network-Message-Id: ae779ee3-b849-400a-613a-08d8a18a405d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: yTKOiOKU7wCd0K7TYD3ZK2/B6Rl68kFoAseTT1jICWoqGt19mok9ApwHMlybfCTdmpnPSZSDmL2JabbEY9zvoNSOaow6Yd2frzanFipbNLs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6309 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.135; envelope-from=vsementsov@virtuozzo.com; helo=EUR02-AM5-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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, qemu-devel@nongnu.org, armbru@redhat.com, stefanha@redhat.com, den@openvz.org, andrey.shinkevich@virtuozzo.com, mreitz@redhat.com, jsnow@redhat.com 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" From: Andrey Shinkevich The test case #310 is similar to #216 by Max Reitz. The difference is that the test #310 involves a bottom node to the COR filter driver. Signed-off-by: Andrey Shinkevich Signed-off-by: Vladimir Sementsov-Ogievskiy [vsementsov: detach backing to test reads from top, limit to qcow2] --- tests/qemu-iotests/310 | 116 +++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/310.out | 15 +++++ tests/qemu-iotests/group | 1 + 3 files changed, 132 insertions(+) create mode 100755 tests/qemu-iotests/310 create mode 100644 tests/qemu-iotests/310.out diff --git a/tests/qemu-iotests/310 b/tests/qemu-iotests/310 new file mode 100755 index 0000000000..a35e8e14f5 --- /dev/null +++ b/tests/qemu-iotests/310 @@ -0,0 +1,116 @@ +#!/usr/bin/env python3 +# +# Copy-on-read tests using a COR filter with a bottom node +# +# Copyright (C) 2018 Red Hat, Inc. +# Copyright (c) 2020 Virtuozzo International GmbH +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +import iotests +from iotests import log, qemu_img, qemu_io_silent + +# Need backing file support +iotests.script_initialize(supported_fmts=3D['qcow2'], + supported_platforms=3D['linux']) + +log('') +log('=3D=3D=3D Copy-on-read across nodes =3D=3D=3D') +log('') + +# This test is similar to the 216 one by Max Reitz +# The difference is that this test case involves a bottom node to the +# COR filter driver. + +with iotests.FilePath('base.img') as base_img_path, \ + iotests.FilePath('mid.img') as mid_img_path, \ + iotests.FilePath('top.img') as top_img_path, \ + iotests.VM() as vm: + + log('--- Setting up images ---') + log('') + + assert qemu_img('create', '-f', iotests.imgfmt, base_img_path, '64M') = =3D=3D 0 + assert qemu_io_silent(base_img_path, '-c', 'write -P 1 0M 1M') =3D=3D 0 + assert qemu_io_silent(base_img_path, '-c', 'write -P 1 3M 1M') =3D=3D 0 + assert qemu_img('create', '-f', iotests.imgfmt, '-b', base_img_path, + '-F', iotests.imgfmt, mid_img_path) =3D=3D 0 + assert qemu_io_silent(mid_img_path, '-c', 'write -P 3 2M 1M') =3D=3D 0 + assert qemu_io_silent(mid_img_path, '-c', 'write -P 3 4M 1M') =3D=3D 0 + assert qemu_img('create', '-f', iotests.imgfmt, '-b', mid_img_path, + '-F', iotests.imgfmt, top_img_path) =3D=3D 0 + assert qemu_io_silent(top_img_path, '-c', 'write -P 2 1M 1M') =3D=3D 0 + +# 0 1 2 3 4 +# top 2 +# mid 3 3 +# base 1 1 + + log('Done') + + log('') + log('--- Doing COR ---') + log('') + + vm.launch() + + log(vm.qmp('blockdev-add', + node_name=3D'node0', + driver=3D'copy-on-read', + bottom=3D'node2', + file=3D{ + 'driver': iotests.imgfmt, + 'file': { + 'driver': 'file', + 'filename': top_img_path + }, + 'backing': { + 'node-name': 'node2', + 'driver': iotests.imgfmt, + 'file': { + 'driver': 'file', + 'filename': mid_img_path + }, + 'backing': { + 'driver': iotests.imgfmt, + 'file': { + 'driver': 'file', + 'filename': base_img_path + } + }, + } + })) + + # Trigger COR + log(vm.qmp('human-monitor-command', + command_line=3D'qemu-io node0 "read 0 5M"')) + + vm.shutdown() + + log('') + log('--- Checking COR result ---') + log('') + + # Detach backing to check that we can read the data from the top level= now + assert qemu_img('rebase', '-u', '-b', '', '-f', iotests.imgfmt, + top_img_path,) =3D=3D 0 + + assert qemu_io_silent(top_img_path, '-c', 'read -P 0 0 1M') =3D=3D 0 + assert qemu_io_silent(top_img_path, '-c', 'read -P 2 1M 1M') =3D=3D 0 + assert qemu_io_silent(top_img_path, '-c', 'read -P 3 2M 1M') =3D=3D 0 + assert qemu_io_silent(top_img_path, '-c', 'read -P 0 3M 1M') =3D=3D 0 + assert qemu_io_silent(top_img_path, '-c', 'read -P 3 4M 1M') =3D=3D 0 + + log('Done') diff --git a/tests/qemu-iotests/310.out b/tests/qemu-iotests/310.out new file mode 100644 index 0000000000..a70aa5cdae --- /dev/null +++ b/tests/qemu-iotests/310.out @@ -0,0 +1,15 @@ + +=3D=3D=3D Copy-on-read across nodes =3D=3D=3D + +--- Setting up images --- + +Done + +--- Doing COR --- + +{"return": {}} +{"return": ""} + +--- Checking COR result --- + +Done diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group index 9a8394b4cd..9fa72cf442 100644 --- a/tests/qemu-iotests/group +++ b/tests/qemu-iotests/group @@ -317,3 +317,4 @@ 307 rw quick export 308 rw 309 rw auto quick +310 rw quick --=20 2.25.4 From nobody Mon May 20 22:21:03 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=1608100364; cv=pass; d=zohomail.com; s=zohoarc; b=cOKn/gUhqZI4zgcGbWKzPLdXb7+29N/ILVfwmbVuzZL3/ULiELQUuoILvyyfd7e3f9CK3iEap+QnaAQDjmt4saxJc40dxIliNFcmG7a2XQDeXhT/7jkGjIg8TDDjjwjug311tiRmEkz/qhWqVD3719vuUkbGs41bw60XWIQgW7o= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608100364; 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=nA8LQ4eZzyYMhSG9wyttv6NAPJeEINQsntt7+iQw/e0=; b=Qst45OPJN38qRdc8BARXV2lbf9ZsKsv0dvtUWsCN5bYAX2/cEg5Wk0+UWLdI2im8CmBrBHfT529B3Bjlc4lVj9cz/384m8L3EWwDiFygqV7tV0ASKm1Z/xcRsgbwm4eRqeWOZuG1iUeNHwr1PIwZQA9gc5uet+Lv/fIZZZydKuE= 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 1608100364810113.28243779174079; Tue, 15 Dec 2020 22:32:44 -0800 (PST) Received: from localhost ([::1]:53330 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpQMd-0008ID-KR for importer@patchew.org; Wed, 16 Dec 2020 01:32:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53620) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpQ8A-0002vx-L1; Wed, 16 Dec 2020 01:17:46 -0500 Received: from mail-eopbgr00134.outbound.protection.outlook.com ([40.107.0.134]:2800 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 1kpQ81-0001G1-5A; Wed, 16 Dec 2020 01:17:46 -0500 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AS8PR08MB6309.eurprd08.prod.outlook.com (2603:10a6:20b:29f::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.24; Wed, 16 Dec 2020 06:17:24 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::d585:99a4:d7a4:d478]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::d585:99a4:d7a4:d478%4]) with mapi id 15.20.3654.024; Wed, 16 Dec 2020 06:17:24 +0000 Received: from kvm.sw.ru (185.215.60.92) by AM4PR0202CA0008.eurprd02.prod.outlook.com (2603:10a6:200:89::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.12 via Frontend Transport; Wed, 16 Dec 2020 06:17:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JuTfZY4J4wDtY40ipiwOhH0HxUaD8w/mPyWgoKxSQyrVfmN9YtgbkkOsOkuMZQS4l4/mSREHMBOVJ/oyjlW4TcmFeheRtUn5S4AgHa1iqK/r30HM7VbpYMf3x1MOYh/5zIS81RXLIRgFpIypN8cI9JVOwjE9J9vdFUV+6eyzAWLMqFxIk+k2fj9KCNWXYfmrqtKvf/Wmbb0bK6m2hZVZCmt4MDNEvWmRkKdVusSEmhDU7ztSylY6j7MA854tfCfsPpYAP+Jqv0qPh0zA9+oK9ZIbxVp5oUOeesnwhqLRxuzgDj3htTHOcJv1F3rN2C3HLWn0y5Ir7R0ven/iGozxxw== 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=nA8LQ4eZzyYMhSG9wyttv6NAPJeEINQsntt7+iQw/e0=; b=jl/zV1Wr18wkiAJ4asGInNhzN2pnBtMnz77xWuipW5OyRyKbmzMGp0JoWXlWnu/mh8Nwz6ga9iTjFsoXBy8QxCJQ5u+7ZH+WiAmXMK78W8vWOwKiAoDwBHVtOGQGqDa06ESyX9xvXwMLV0n4dkzuRKpwR3wBXJ0Aml6mYYrbRrqzDWT6lbFTlxKJNESZVIn6UOnW4O2wWVyVZt3cMTSQgh9YtkVQB4CRsrgbyo9boWokhSdTLek7UtCnuaIQxz3V9V/Hd3puVhlL5DRuNpZkZmsN+3yyqt8H/qxeYN4twkr59Q52gc1lawu5hUrq8+HDBLG/KZGSplQrEajlVaUhTg== 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=nA8LQ4eZzyYMhSG9wyttv6NAPJeEINQsntt7+iQw/e0=; b=LGB2h2sWTZAePT093RytSlUbp75kOYEGYOSy9m5X9NrIWT7b8OrSYtb/X3+knSAELC9vP8pskQ1W+N1qhd0S810i/X5RwF/WTdLStxb9ezwzh55IWmfp4YLFCAtgcmXkuehpwFgR055BZEkbGurTuwoWnMLOTq1e15Lw1vxPX4g= 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 Subject: [PATCH v15 07/13] block: include supported_read_flags into BDS structure Date: Wed, 16 Dec 2020 09:16:57 +0300 Message-Id: <20201216061703.70908-8-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20201216061703.70908-1-vsementsov@virtuozzo.com> References: <20201216061703.70908-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-Originating-IP: [185.215.60.92] X-ClientProxiedBy: AM4PR0202CA0008.eurprd02.prod.outlook.com (2603:10a6:200:89::18) 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: 8f82bec2-5c02-40af-239e-08d8a18a4108 X-MS-TrafficTypeDiagnostic: AS8PR08MB6309: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1824; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RY1hgH4+Ri+f7NZM4VA3YXDiAhmltTTTm+ZudWebG4AfxPcy27HPV+excdz0pD+oCkbRBh2rVO4cmCt7UjyStJ8Rd+hi+pxWjTP9Z+106/yIvcKOLSitApwACHEnjy9UOGAvffooK4yJYbHS5kzzs/iNBfZM9mHEIkHmadMf+cDIICE0Es7HTW/+qjvFt2FC0yFrM21TzI78v3MvMK8nqS2INriksaIW/Ek9O1SZZ03o1AqJsnSPTk3OopHWGZRTPOaWarTFzLbgCJMZfemfv+lYyEEeVgqjy93gX2leD5ZJYJhHRpsjvfuWcCf0qLMs7IXM389yfJ0vhXwfOd5BbQ== 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)(376002)(136003)(396003)(366004)(39830400003)(346002)(4326008)(5660300002)(66556008)(66476007)(186003)(16526019)(956004)(6506007)(6512007)(2616005)(66946007)(36756003)(6666004)(1076003)(86362001)(6916009)(316002)(6486002)(52116002)(2906002)(8676002)(83380400001)(107886003)(478600001)(8936002)(26005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?pg5QtUHmhCmUrOkjbr3FMAKkOeDtm0TOUB2OGh0Q10rLWhGZyfVHyTZPT0Ku?= =?us-ascii?Q?DCBozX5r2TWAjskUp1aTA6HtXmJ8JJL5P/0vncUOSiDRk5G4dpe328IhHsD/?= =?us-ascii?Q?910KAe1oPWoL5LPoS/BWm8K7bwRrJv5BkjdKPQcyX/2/X7VfJaaTuNCx3c/H?= =?us-ascii?Q?t+X0tNthkvqRVLeWVYyVXu2jbkqOCSjCV7N1eTrMOxSL3OMKXR/RAJcSLUIF?= =?us-ascii?Q?TPl5jbF1ZrnGRrVHyDwhkQ3yWbsNTcejc5UdlWGRC3qStNKHmvZUvvFvv7Ct?= =?us-ascii?Q?hOi4MX6v5AE2lqnWSQLjxHDqKl2ypTDVCay//nGyEFkJvENW1OJxQLamIije?= =?us-ascii?Q?3Ng4gJFdMh2se3qJsyjFIUQaNX5PokEjjhtnwcMeL3Hz7eNztPeKQR+l4Hfi?= =?us-ascii?Q?Y1xlp3fSIKvZnX1YE2Snxv0I1Vex4Q6EbvWtaIbA83c9RRVWb4AGUN0jbBWu?= =?us-ascii?Q?Dzoz6OWVnS6F30Na7O14Ni0VDiQuPij14wTnx/Iw3ybqrbjMRGtqIfa+wWKf?= =?us-ascii?Q?O0h/lS7c2NzelmG9BI1l4htCr66Zg3yKVqVwvyLvUz0Tsm6jn21KiR2c4udP?= =?us-ascii?Q?jtVC/yH5sOhtXKfp2CGN/Jg8b0/sAfHZmJ7Dcbq7OFhw+3XbDe8/Cu6tsRKM?= =?us-ascii?Q?xJ3obmgLBZCxIaXsd5mDgNVaqjhobpmsWDeaPaUNuEmL6roFB8tFb2vSoXWO?= =?us-ascii?Q?zIlBUJ3gCMoPAcbztq/zsqcgE09kUepmJSTyDuU6nn26zFMC4c6Nlim0Bn94?= =?us-ascii?Q?dGgJdOkqSkrgtBj0RAjeaBlvQj2kA4EZMTC8GHjJHE9ZvA1Xz9YclY52uv1S?= =?us-ascii?Q?R4BQ3VtwfyNicCSp7xcsitxF+gVViEwXJJwWt4Co/kRBgS5m2r4mQ9v2rb5e?= =?us-ascii?Q?Fe+4m+ObT14MEgxSLtHcge70NMF0dUC/08w7sURYjWJMYwi1dY163J3lHKbl?= =?us-ascii?Q?+EMPX5R52zV82PHsYYqrP0WsJEnTXtVscFjooXvRx6cJhiT+ePrviypgMQW6?= =?us-ascii?Q?DOr3?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Dec 2020 06:17:24.0769 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-Network-Message-Id: 8f82bec2-5c02-40af-239e-08d8a18a4108 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: WQs1gYwzDgedZKF43yuJiWpOPwT0OW9gFMpeE86Vm85LjdTGN3Ibx1vx/7/Jz7gj/7XRqu+yQuXM6aOYHQ0RZp4ZiFqM7o7QM1cRoNWV+DE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6309 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.134; envelope-from=vsementsov@virtuozzo.com; helo=EUR02-AM5-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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, qemu-devel@nongnu.org, armbru@redhat.com, stefanha@redhat.com, den@openvz.org, andrey.shinkevich@virtuozzo.com, mreitz@redhat.com, jsnow@redhat.com 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" From: Andrey Shinkevich Add the new member supported_read_flags to the BlockDriverState structure. It will control the flags set for copy-on-read operations. Make the block generic layer evaluate supported read flags before they go to a block driver. Suggested-by: Vladimir Sementsov-Ogievskiy Signed-off-by: Andrey Shinkevich Signed-off-by: Vladimir Sementsov-Ogievskiy [vsementsov: use assert instead of abort] Reviewed-by: Max Reitz --- include/block/block_int.h | 4 ++++ block/io.c | 10 ++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/include/block/block_int.h b/include/block/block_int.h index 6f778e2517..1f56443440 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -881,6 +881,10 @@ struct BlockDriverState { /* I/O Limits */ BlockLimits bl; =20 + /* + * Flags honored during pread + */ + unsigned int supported_read_flags; /* Flags honored during pwrite (so far: BDRV_REQ_FUA, * BDRV_REQ_WRITE_UNCHANGED). * If a driver does not support BDRV_REQ_WRITE_UNCHANGED, those diff --git a/block/io.c b/block/io.c index 24205f5168..851fe53604 100644 --- a/block/io.c +++ b/block/io.c @@ -1431,6 +1431,9 @@ static int coroutine_fn bdrv_aligned_preadv(BdrvChild= *child, if (flags & BDRV_REQ_COPY_ON_READ) { int64_t pnum; =20 + /* The flag BDRV_REQ_COPY_ON_READ has reached its addressee */ + flags &=3D ~BDRV_REQ_COPY_ON_READ; + ret =3D bdrv_is_allocated(bs, offset, bytes, &pnum); if (ret < 0) { goto out; @@ -1452,9 +1455,11 @@ static int coroutine_fn bdrv_aligned_preadv(BdrvChil= d *child, goto out; } =20 + assert(!(flags & ~bs->supported_read_flags)); + max_bytes =3D ROUND_UP(MAX(0, total_bytes - offset), align); if (bytes <=3D max_bytes && bytes <=3D max_transfer) { - ret =3D bdrv_driver_preadv(bs, offset, bytes, qiov, qiov_offset, 0= ); + ret =3D bdrv_driver_preadv(bs, offset, bytes, qiov, qiov_offset, f= lags); goto out; } =20 @@ -1467,7 +1472,8 @@ static int coroutine_fn bdrv_aligned_preadv(BdrvChild= *child, =20 ret =3D bdrv_driver_preadv(bs, offset + bytes - bytes_remainin= g, num, qiov, - qiov_offset + bytes - bytes_remaining= , 0); + qiov_offset + bytes - bytes_remaining, + flags); max_bytes -=3D num; } else { num =3D bytes_remaining; --=20 2.25.4 From nobody Mon May 20 22:21:03 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=1608100151; cv=pass; d=zohomail.com; s=zohoarc; b=Gj7HhrW6RgvUDlzkyKALp+sAIUGiBt2YDFJd0/ld7mqqvhxLyJil8MP7CTB2rDp5PkF4WK1utqKfhu/zzCInCDAOxPfnH7dSVi04+Gd3G51ZOGGHR88+iucvI3saDNYDF3TRea6MhsbnrHDhauaYtAgFb/stWet/pQQvqreWcA4= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608100151; 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=lTXwsXtRlJe/PeIsn8mrc7KxlQIf2b9A1I32uEYF7kc=; b=FWJAHQaLH+IgFTU0hQAnsal6I2rnd7sOBKnMekhoV2w0jZOFCeorhNYDX9diQcq/fXsLZq2MlCk5eml2VUrKwbjzPNNq1x4quTx4dmRIf6QJ/ru7d08Iu8JFCwe1MsFXQLaKVNtxsrS5yIr1Col0NkCwCbi73RacUiHvAYe0CpA= 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 1608100151183284.7227226207774; Tue, 15 Dec 2020 22:29:11 -0800 (PST) Received: from localhost ([::1]:46670 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpQJB-0005NN-NV for importer@patchew.org; Wed, 16 Dec 2020 01:29:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53558) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpQ85-0002is-66; Wed, 16 Dec 2020 01:17:41 -0500 Received: from mail-eopbgr00123.outbound.protection.outlook.com ([40.107.0.123]:51180 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 1kpQ82-0001E7-KU; Wed, 16 Dec 2020 01:17:40 -0500 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AS8PR08MB6309.eurprd08.prod.outlook.com (2603:10a6:20b:29f::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.24; Wed, 16 Dec 2020 06:17:25 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::d585:99a4:d7a4:d478]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::d585:99a4:d7a4:d478%4]) with mapi id 15.20.3654.024; Wed, 16 Dec 2020 06:17:25 +0000 Received: from kvm.sw.ru (185.215.60.92) by AM4PR0202CA0008.eurprd02.prod.outlook.com (2603:10a6:200:89::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.12 via Frontend Transport; Wed, 16 Dec 2020 06:17:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UjEjjyUYso+K5wtmZU7BhNuq81JrIzm1e1kObWE/Ye9KYpeX09M4d3C2A9i0atpJKpKinEVJw58STwshElAnE0ZyPyYS+pCvDihJR6Ax3G+W7SiZSfdSa9m1GRqCYBtqytjOPkNMUBMeNcNtHEj6AJw9adju7ZGmRbdqTsGe/lUyb1YbSLlHW3uzDJ4+GX1G9yrMv5OdKhfJ27xP2rG2RvJpFb1S3dXyj/gsh2Bsc4hYaQlfcqp0tXl3s78ZAFs6cXn66WQ9ogwjbx+39BqkB4qhbWOeUpQI8m314Hau4yYY5sDjlHTe7UqiScHDGXNJfbZC1PyRbrl3JgYsS0jQdw== 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=lTXwsXtRlJe/PeIsn8mrc7KxlQIf2b9A1I32uEYF7kc=; b=UPmrYuuzY1ru2ml4xBm9HI5A1rSLALC7phlc2p4iFhMtuzeGfFP0T3Tvct2JVKb9hLSXmvj67wOitu99UcWTmfGan71L9d7FMSKIq+CgAsWDrz4RXjjQGM0DEuQOjThbIulTByHTM/3JZTp8f9vCt9TFA7xYi2XGBrUInx7B9bvgArYQ7ItbxIkQ3gnksfyGCWam2EdJMNWjHFivoF2D7mSASic5jlZbZR2mNqdUSEWmDYbJf8Co3oRHi/NFPnZlBATjqTyoSwq6ZMfdAt400c9cmnjRovXiRaDV/k6sPdBsSUM1G1hOw1k+zrcAAR1VKXg3BGJL1C6upMMZGHqNqA== 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=lTXwsXtRlJe/PeIsn8mrc7KxlQIf2b9A1I32uEYF7kc=; b=tXhOdkK4VDwC13zO9tJ9i/8TG1mglW+R3L/0uF+NrrVRpcETcZhP321q7evV/sQ7aeHKu9VnhhCplkLnvbro8FWEBUAP8I47Xgej2mft/F7vwfsjLBn0fCfT1NsJPpBAFbHboHeTLE57++LalGFqPOzA4c4WOTgxfYfD0Q4w9ns= 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 Subject: [PATCH v15 08/13] copy-on-read: skip non-guest reads if no copy needed Date: Wed, 16 Dec 2020 09:16:58 +0300 Message-Id: <20201216061703.70908-9-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20201216061703.70908-1-vsementsov@virtuozzo.com> References: <20201216061703.70908-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-Originating-IP: [185.215.60.92] X-ClientProxiedBy: AM4PR0202CA0008.eurprd02.prod.outlook.com (2603:10a6:200:89::18) 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: e857aad3-44a8-4247-f2d0-08d8a18a41ae X-MS-TrafficTypeDiagnostic: AS8PR08MB6309: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: y8za/zpgfKGEFgAAuNOoQ4VW5xc3duxU5FA9LO/QbeW4veKWe+u1crhRd1gKZH4ks9+tZ58bD1hi2lFFenHUQ7Mer4Wg8IK6jHa9cyebn3Q9o6ueHBn7+kzIMJAbztLEucnLArIB7sEL9dwziKLx5QdeZDBRFqCInvOgWOq890M05KvqId2/aKNVJibIGQgQMchB65ulr5kEKoXz7rACPGqumM6spkGV5aiACd0KKfvNBsNWc2kQjtqQ5nGjEafAoKYe3e6gcH02dyWmJz7eufunqtaCMJhUhD8xyqeV1+DX/czlIO/vHPxfhO1YQ/2O 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)(376002)(136003)(396003)(366004)(39830400003)(346002)(4326008)(5660300002)(66556008)(66476007)(186003)(16526019)(956004)(6506007)(6512007)(2616005)(66946007)(36756003)(6666004)(1076003)(86362001)(6916009)(316002)(6486002)(52116002)(2906002)(8676002)(83380400001)(107886003)(478600001)(8936002)(26005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?q9UiGXv+/+K8J+Tp7Hr+Gi5ayQtSQrPau+iFpmy71XpxClbv8liexow7zg4V?= =?us-ascii?Q?M1dhjel11n7EkuJ5UdDp7YjN5wSsup8phXSlhTLO1tGYUoZ88kpcAM5pYExG?= =?us-ascii?Q?xTdbdLGh/3xam31EIpUTEZhedQfBeYUx12nDE3KuhCqNrOAosH2iUlQ2rdKF?= =?us-ascii?Q?nlX/FUjTS6WrHKBgEeZV73bM4Y32hTdfELkxtt27uQ4d/f6hBAmlo3C8Wk8k?= =?us-ascii?Q?EwJYMPoluOib6G9Zli/+DOctzNVu0PDzhQAXYLNTtA325xQ/2RJO/IKGzwtt?= =?us-ascii?Q?fm9gHeILeU/8XL4IVVf3pFH2VYYyzh/s/xCc5d0S/ak6oTlxHHShgzuZJuHE?= =?us-ascii?Q?5EiSFipZaZo9f7rkT+DO69hrnvYv0e/R+JQRmI5Pt4D7tiJkEtwLSo0TvU7I?= =?us-ascii?Q?HDpljUvnWJW5Ae4g0bVC+7M4IcWKNjiy9TDnooZd8THhej/YEzV7PlIOR/dW?= =?us-ascii?Q?MTAoneUT09s+RtQJCADIrhWxBqWmwJ1c767t2Ozj+7YLq8h60cqT9+rcgx0W?= =?us-ascii?Q?koWRueHvnUTdXEreSmhg801u7pt3CvkQmhT9yHep50Lkfs6wGctweRqi3nR2?= =?us-ascii?Q?JbZd6lbOn01i50rHxGuzU72hozcpppt3EYdwPhwW2UptyJFw0iyaL2TdQ/G0?= =?us-ascii?Q?8YpwQQ1Z5mYa2ucCl44omnXAo/EwFEtxDRW2Oqx/+UvV1OSgmoGWpand60Qz?= =?us-ascii?Q?bs6wPyNXEHxjD6ZY/HCOi0GPwPyG/aKOF103iY5KlPEa4IbNBbjUjOLodz4i?= =?us-ascii?Q?9qznpzRxVQKPByiAFJXgJ0BU0RvLmGSIFqK8EofT+6iNMiOYoFY+Gl4aJIkO?= =?us-ascii?Q?dCsfnrIfYntDl747c5X8ccEdnNxKVq1da8D18kt5nbJYbIIMIwxbp/mgMgqp?= =?us-ascii?Q?xO6tenQw9JhPvVL3BfkT8Kbf4DieonOTbQKhWKTvbfw2npq6ZwxC5E9VYvi2?= =?us-ascii?Q?mEvCKgcURVtErPQRGgYa/wQvzvj5sax6uNJugxc145zTdqkus+wdwPbJKHrh?= =?us-ascii?Q?lrw3?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Dec 2020 06:17:25.1920 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-Network-Message-Id: e857aad3-44a8-4247-f2d0-08d8a18a41ae X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 04ydCdqPsCvGfoGaGpjYSJ9ltxqlOORrUR0cbxUKQdHsHn3bTuILw2gig62SNzErqMCt03OBMKWeWV64YBQFVHE7LnsfxGDCW6JXbRtuJwA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6309 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.123; 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: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, qemu-devel@nongnu.org, armbru@redhat.com, stefanha@redhat.com, den@openvz.org, andrey.shinkevich@virtuozzo.com, mreitz@redhat.com, jsnow@redhat.com 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" From: Andrey Shinkevich If the flag BDRV_REQ_PREFETCH was set, skip idling read/write operations in COR-driver. It can be taken into account for the COR-algorithms optimization. That check is being made during the block stream job by the moment. Add the BDRV_REQ_PREFETCH flag to the supported_read_flags of the COR-filter. block: Modify the comment for the flag BDRV_REQ_PREFETCH as we are going to use it alone and pass it to the COR-filter driver for further processing. Signed-off-by: Andrey Shinkevich Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Max Reitz --- include/block/block.h | 8 +++++--- block/copy-on-read.c | 14 ++++++++++---- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/include/block/block.h b/include/block/block.h index 8ea794959b..f652f31406 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -81,9 +81,11 @@ typedef enum { BDRV_REQ_NO_FALLBACK =3D 0x100, =20 /* - * BDRV_REQ_PREFETCH may be used only together with BDRV_REQ_COPY_ON_R= EAD - * on read request and means that caller doesn't really need data to be - * written to qiov parameter which may be NULL. + * BDRV_REQ_PREFETCH makes sense only in the context of copy-on-read + * (i.e., together with the BDRV_REQ_COPY_ON_READ flag or when a COR + * filter is involved), in which case it signals that the COR operation + * need not read the data into memory (qiov) but only ensure they are + * copied to the top layer (i.e., that COR operation is done). */ BDRV_REQ_PREFETCH =3D 0x200, /* Mask of valid flags */ diff --git a/block/copy-on-read.c b/block/copy-on-read.c index 71560984f6..9cad9e1b8c 100644 --- a/block/copy-on-read.c +++ b/block/copy-on-read.c @@ -50,6 +50,8 @@ static int cor_open(BlockDriverState *bs, QDict *options,= int flags, return -EINVAL; } =20 + bs->supported_read_flags =3D BDRV_REQ_PREFETCH; + bs->supported_write_flags =3D BDRV_REQ_WRITE_UNCHANGED | (BDRV_REQ_FUA & bs->file->bs->supported_write_flags); =20 @@ -172,10 +174,14 @@ static int coroutine_fn cor_co_preadv_part(BlockDrive= rState *bs, } } =20 - ret =3D bdrv_co_preadv_part(bs->file, offset, n, qiov, qiov_offset, - local_flags); - if (ret < 0) { - return ret; + /* Skip if neither read nor write are needed */ + if ((local_flags & (BDRV_REQ_PREFETCH | BDRV_REQ_COPY_ON_READ)) != =3D + BDRV_REQ_PREFETCH) { + ret =3D bdrv_co_preadv_part(bs->file, offset, n, qiov, qiov_of= fset, + local_flags); + if (ret < 0) { + return ret; + } } =20 offset +=3D n; --=20 2.25.4 From nobody Mon May 20 22:21:03 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=1608099769; cv=pass; d=zohomail.com; s=zohoarc; b=CHPUH1knTQhg+tb+UcDoH7LlsgCQ0I2BEfmvX4zXSbUnfPRwmKNzQNig+y6Kp5y4Ut+V0s+a739p5gcX12Zbv8eW57OlnfQi6Z8erXulMNHzHRP48dDUi/2OpWg9Mo9VC6UcLSBoa6YFqdgURWfq/5TroyRHRVpDGjw3+ynYZcE= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608099769; 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=5sckIrKV/n6gtHxZ1OrslJy6szM3D7oCMQC98Y1jUEw=; b=l4osaARFXHrJhk8VNx4AmnVILQI6zqCVFW3PDOSkCFVJWnV6962pTZHL3RRa7NLtACtisZQe6XLyGZ8XBdUbnhPv6x79j5fIbodTT2cs1+wj0mqUbpiFK24/iWMMzRHhKSMLzvZFbiXr9in0M6qhCmaOaM0vou8kcuQqKljFJ7c= 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 1608099769465498.69903023388974; Tue, 15 Dec 2020 22:22:49 -0800 (PST) Received: from localhost ([::1]:33250 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpQD2-00084w-8M for importer@patchew.org; Wed, 16 Dec 2020 01:22:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53586) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpQ87-0002me-8a; Wed, 16 Dec 2020 01:17:43 -0500 Received: from mail-eopbgr00135.outbound.protection.outlook.com ([40.107.0.135]:52920 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 1kpQ85-0001CD-Bc; Wed, 16 Dec 2020 01:17:42 -0500 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AS8PR08MB6309.eurprd08.prod.outlook.com (2603:10a6:20b:29f::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.24; Wed, 16 Dec 2020 06:17:26 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::d585:99a4:d7a4:d478]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::d585:99a4:d7a4:d478%4]) with mapi id 15.20.3654.024; Wed, 16 Dec 2020 06:17:26 +0000 Received: from kvm.sw.ru (185.215.60.92) by AM4PR0202CA0008.eurprd02.prod.outlook.com (2603:10a6:200:89::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.12 via Frontend Transport; Wed, 16 Dec 2020 06:17:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fIYOGSAnVoYPz4yA0lN9kJCA7vcYvIQSCFVy2w7dOSfuZfgul7woiC2o5077TaJrDfthuIWgGEFxZCnZMChzCabfrwDg6mcVLEqsLYQpkOyHt0+ZHF28Q2M77mVachsmuYKYsL58fIoir50Cj9BEekysUkIKucqaSoWOyA5awte1tYdOETtXsq/SG/HUWzWIAfRQjuL6Nax6PHww/LoFRJOUUIGM+F3q8enaxfVkHaR+dQoEnhCJos+MGmPhr61qVgGv22GN0/yNKTxhK7VZY6KFuW65+tVLTAOqSmbEfHhZseYpL78dtLB5eB/V2aY2bYLa4ec6Jgmbb4S5rkhrvQ== 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=5sckIrKV/n6gtHxZ1OrslJy6szM3D7oCMQC98Y1jUEw=; b=DSMwapFm6uPDwLvl7Wjs68iKcTu93rf0ACf9OaIb6BjxKC8iOcYnb95O70EfOYojHgXzh/AbcMlAt9CQEGkwkYrNCgXM5Jj28xGc3M2t8GvlRQnXiZnWVWPX/gVKTHfeGXnooXEvzTzt5/omULAqTqcJ5vvMlHxg7SL20xM18sO0F8vuBHn/xjT6kZ9nNaLF8EleG5N9AFBZ2hP7p4UCfYjRGNHKBzHijiJMC8ycLC1le4VWpAPkByuFWuoFSom7Hv2HQlA+wEhzLjyC8BI/tKVZdTG5pl8tCk+wfwBsQ4iyw1ea1x5hq7fVhdEY/xCivz1tAWeCSKUwiE3VMxIrlw== 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=5sckIrKV/n6gtHxZ1OrslJy6szM3D7oCMQC98Y1jUEw=; b=NJUbSSZ1D8RpHL9VV312K5ANBMEB50fCzlto9kRXWE7l0Qv6QTTn6Z/8zZvm5QBtkmGEiZj6AsUzKH+XFJN8Kgh43JaTtJfFzORCW+SBzniHCjyLcuMCNS50uIx1UkDRobHF3ZJIPj00ygBhYP2bS8H9ymDHejRYyf8ySAHQWDk= 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 Subject: [PATCH v15 09/13] stream: rework backing-file changing Date: Wed, 16 Dec 2020 09:16:59 +0300 Message-Id: <20201216061703.70908-10-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20201216061703.70908-1-vsementsov@virtuozzo.com> References: <20201216061703.70908-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-Originating-IP: [185.215.60.92] X-ClientProxiedBy: AM4PR0202CA0008.eurprd02.prod.outlook.com (2603:10a6:200:89::18) 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: 7e686734-c34e-4720-fc19-08d8a18a424f X-MS-TrafficTypeDiagnostic: AS8PR08MB6309: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:335; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: z7Yi5forDbAb8hM+VNsbzwMWdJV4b88hoRBrgSVg/Evh3oWgYpIKy/QHkx9wjVW+X1cXBOfBOO7LngdvtmM/y5Sr4ZoOC7hGVLIy+WlPKZZIcYcfrqWwjU2mHUIYN1jCpM7ZfE9tN+p9RafIAPwGIuU97KOmxC54NHTFukY7YFj3RbQjkJCpGg7yCssQ1gzaB2AQukvl8n9NBaax0Heb1GzTeF3pQ3VO/2T+gCpGV/zNmuCUDoEl3R4HcgRwgHXNjoG43CDzuNutfhEzmicafz1k4PVFspqtqr1poV5qGX+ZJX3BBaXeof33b94AeYZkgpG5qpGYqaR9QYp7l0Z0bw== 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)(376002)(136003)(396003)(366004)(39830400003)(346002)(4326008)(5660300002)(66556008)(66476007)(186003)(16526019)(956004)(6506007)(6512007)(2616005)(66946007)(36756003)(6666004)(1076003)(86362001)(6916009)(316002)(6486002)(52116002)(2906002)(8676002)(83380400001)(107886003)(478600001)(8936002)(26005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?2GWR+/KQy80+5zrrswKXDsLdTvGiHnvvQmDog9hgKt/oqeWkuhLaQQ9x4UGG?= =?us-ascii?Q?vjqxrI/UmRpmrYbc4ywGNTJwWyPBXn+ks4MvYGsAOLfgxVw6tIAJEZApwVLf?= =?us-ascii?Q?4UdvWurE5K8xqdbDEUincTSnnCbQVuSHafwgh4+3t06fbOLk4LZlCwPob9MO?= =?us-ascii?Q?Xlx1vbQB0A5JIn1zCLNBhY0QwnFj0AKEoVqIfdYmyA5dE3KOdmNQkNPwDlMv?= =?us-ascii?Q?E580cLgWKa8aOOgIDah0ep7kcj94WGJSoOnQlH07B/5t0PSurQTV2DxCqfRa?= =?us-ascii?Q?FmuyIDcExL+pbnoyeDrw57Vy9kHuyEWbDcui6HHTeIApME21GrjSKN80YsJz?= =?us-ascii?Q?J61A0MtCRjPL/ZizCI8molCHe/ZcWvJrSWjMUh41H0/K9UEb3JzWB5pRmLuJ?= =?us-ascii?Q?uEzG7ihJMlrgjL7kjMAogDuoXskhauitP7NlRfbMLKYCOzNIaDg8YknJq10a?= =?us-ascii?Q?SQVxESy14suSsjazLX3ZZ1cAiRp5JvT7rvSebTQFSVmtBag8tm/pktXk7nC7?= =?us-ascii?Q?AGQBEgcb3S+x0BN7GE9mnRK0+yblqUCVlA14qEdvs+2O3W5QTl+fFWmppa56?= =?us-ascii?Q?mF4Th27qHgPMuNp8miPmwsOl/t1R1RUFaqaZze1bwXTfNNElptUJYqE2VVB0?= =?us-ascii?Q?mJzoLaYmRHHPAFrfPPcLcIebIB7n3BvUxs0vL3mtqqy/8ivtKs36RA3MgpeJ?= =?us-ascii?Q?DmoXefes3qPCjYmd59CWnzqBL0huzkIXCpA+0lOq33HooEjjp0nBUHe6dIhH?= =?us-ascii?Q?nE6F4b9EdKgv9UYpgukSHteBSWq8fXijrr2FPP2lXSRyPypT/zFMVi6kwShw?= =?us-ascii?Q?iJATbF+RtdyjXufYmNMIJx8Tcto9lvR5egXW0/rtooqMdxtrqt1//olpLK+L?= =?us-ascii?Q?5xc4IOMqs60HRLEI2AVDfPs7jgmX8iWhWR48L13F7Opa0YTlb3f3PyRebKVk?= =?us-ascii?Q?YaP1HazFLAJTBhTjE2VAHjT0EJUJpqgcYpDg+6MMnpqZqv8Zh26qnK7o3Um1?= =?us-ascii?Q?erf/?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Dec 2020 06:17:26.2564 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-Network-Message-Id: 7e686734-c34e-4720-fc19-08d8a18a424f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: jQ4ho2g92vmxz6uI8nFcIuMnV/LfF9ewnlpH8S8TD4kYGT2LDFHiBAQL4W4CZAPfgrbLJV9ZJQmKJrySjrFWrRKhkm6KFtiul/DaB+daCMQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6309 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.135; envelope-from=vsementsov@virtuozzo.com; helo=EUR02-AM5-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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, qemu-devel@nongnu.org, armbru@redhat.com, stefanha@redhat.com, den@openvz.org, andrey.shinkevich@virtuozzo.com, mreitz@redhat.com, jsnow@redhat.com 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" From: Andrey Shinkevich Stream in stream_prepare calls bdrv_change_backing_file() to change backing-file in the metadata of bs. It may use either backing-file parameter given by user or just take filename of base on job start. Backing file format is determined by base on job finish. There are some problems with this design, we solve only two by this patch: 1. Consider scenario with backing-file unset. Current concept of stream supports changing of the base during the job (we don't freeze link to the base). So, we should not save base filename at job start, - let's determine name of the base on job finish. 2. Using direct base to determine filename and format is not very good: base node may be a filter, so its filename may be JSON, and format_name is not good for storing into qcow2 metadata as backing file format. - let's use unfiltered_base Signed-off-by: Andrey Shinkevich Signed-off-by: Vladimir Sementsov-Ogievskiy [vsementsov: change commit subject, change logic in stream_prepare] Reviewed-by: Max Reitz --- block/stream.c | 9 +++++---- blockdev.c | 8 +------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/block/stream.c b/block/stream.c index 6e281c71ac..6a525a5edf 100644 --- a/block/stream.c +++ b/block/stream.c @@ -65,6 +65,7 @@ static int stream_prepare(Job *job) BlockDriverState *bs =3D blk_bs(bjob->blk); BlockDriverState *unfiltered_bs =3D bdrv_skip_filters(bs); BlockDriverState *base =3D bdrv_filter_or_cow_bs(s->above_base); + BlockDriverState *unfiltered_base =3D bdrv_skip_filters(base); Error *local_err =3D NULL; int ret =3D 0; =20 @@ -73,10 +74,10 @@ static int stream_prepare(Job *job) =20 if (bdrv_cow_child(unfiltered_bs)) { const char *base_id =3D NULL, *base_fmt =3D NULL; - if (base) { - base_id =3D s->backing_file_str; - if (base->drv) { - base_fmt =3D base->drv->format_name; + if (unfiltered_base) { + base_id =3D s->backing_file_str ?: unfiltered_base->filename; + if (unfiltered_base->drv) { + base_fmt =3D unfiltered_base->drv->format_name; } } bdrv_set_backing_hd(unfiltered_bs, base, &local_err); diff --git a/blockdev.c b/blockdev.c index c290cb1dca..b58f36fc31 100644 --- a/blockdev.c +++ b/blockdev.c @@ -2510,7 +2510,6 @@ void qmp_block_stream(bool has_job_id, const char *jo= b_id, const char *device, BlockDriverState *base_bs =3D NULL; AioContext *aio_context; Error *local_err =3D NULL; - const char *base_name =3D NULL; int job_flags =3D JOB_DEFAULT; =20 if (!has_on_error) { @@ -2538,7 +2537,6 @@ void qmp_block_stream(bool has_job_id, const char *jo= b_id, const char *device, goto out; } assert(bdrv_get_aio_context(base_bs) =3D=3D aio_context); - base_name =3D base; } =20 if (has_base_node) { @@ -2553,7 +2551,6 @@ void qmp_block_stream(bool has_job_id, const char *jo= b_id, const char *device, } assert(bdrv_get_aio_context(base_bs) =3D=3D aio_context); bdrv_refresh_filename(base_bs); - base_name =3D base_bs->filename; } =20 /* Check for op blockers in the whole chain between bs and base */ @@ -2573,9 +2570,6 @@ void qmp_block_stream(bool has_job_id, const char *jo= b_id, const char *device, goto out; } =20 - /* backing_file string overrides base bs filename */ - base_name =3D has_backing_file ? backing_file : base_name; - if (has_auto_finalize && !auto_finalize) { job_flags |=3D JOB_MANUAL_FINALIZE; } @@ -2583,7 +2577,7 @@ void qmp_block_stream(bool has_job_id, const char *jo= b_id, const char *device, job_flags |=3D JOB_MANUAL_DISMISS; } =20 - stream_start(has_job_id ? job_id : NULL, bs, base_bs, base_name, + stream_start(has_job_id ? job_id : NULL, bs, base_bs, backing_file, job_flags, has_speed ? speed : 0, on_error, filter_node_name, &local_err); if (local_err) { --=20 2.25.4 From nobody Mon May 20 22:21:03 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=1608099710; cv=pass; d=zohomail.com; s=zohoarc; b=h3Rc4DMOuT7ax3gYittYIG7yjDw6zvPLzal7WaPYA8tgJVvKJj7+7FFf6u9/lcQ97Q0jISj15qFJTAFzoFl9FZdvThZPX2dt86C2HcMYT9XcDOMm9OQKsIJpkRkN8suw2HKZY5cQmWxyurI46ZyvAWQx0ccUWLhqQt0qv4Jn2sA= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608099710; 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=1GjzSAeANX6iMiNI2+2QAQzVO6kM1AnBWqMsVVhkGmw=; b=lLtbVAVLOCLzTDA/iN9pCG+ivNgx09N1qXtnrW0mBw9+EPWlI2WLIPgb3hVV5BL8rC96x6OOBaXyEWkiR5QON/O+0FUi4OM8oUVvinJHQFL++I6MT+JtNzfxVyfPUGE9DpxHmLy9zsHmYP0EvkWpG/Fttvve1Qei8GJRM8iyzvM= 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 1608099710012396.64193267231553; Tue, 15 Dec 2020 22:21:50 -0800 (PST) Received: from localhost ([::1]:58392 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpQC4-0006oX-Pl for importer@patchew.org; Wed, 16 Dec 2020 01:21:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53596) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpQ88-0002pV-8V; Wed, 16 Dec 2020 01:17:44 -0500 Received: from mail-eopbgr00123.outbound.protection.outlook.com ([40.107.0.123]:51180 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 1kpQ85-0001E7-R1; Wed, 16 Dec 2020 01:17:44 -0500 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AS8PR08MB6309.eurprd08.prod.outlook.com (2603:10a6:20b:29f::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.24; Wed, 16 Dec 2020 06:17:27 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::d585:99a4:d7a4:d478]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::d585:99a4:d7a4:d478%4]) with mapi id 15.20.3654.024; Wed, 16 Dec 2020 06:17:27 +0000 Received: from kvm.sw.ru (185.215.60.92) by AM4PR0202CA0008.eurprd02.prod.outlook.com (2603:10a6:200:89::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.12 via Frontend Transport; Wed, 16 Dec 2020 06:17:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W6wEDVOu40eEZ/8quAsDFqkMXy0Au8rNXsrdmKORwZUlh2ZWlVhnJ9n2uzwBHUTrag2SKxd1nqLRcWxxOPqSrWYvOBw5MidSNBuTXpATcXndzR2N2eXZzRMuTPf//qajoOgBIVtGGNg9l7elwzMHAJzJosMmbeu8GouYWeNAUuvURSgOJzl3YNNDDxruvZH4VC5YNn9gri9DZkIgSqXsowL3X6kWXkUffdSH8MB//KGpVJy5A6qjeH9O52wVgD4YMxsLfhPvsb1aMFo6X01pEVK4spGaoUS3jdgv6CpZA3kGROXjLGkcdVvNrVPxHk3hOQG6RRO+SqmmJEfTZAB8Og== 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=1GjzSAeANX6iMiNI2+2QAQzVO6kM1AnBWqMsVVhkGmw=; b=d6HZVFAPR9UTPlUSxKiykPW7RxdspvV0AQXouNRPVy1LEHwABx/Ga9jJufyXnAmQl46mDXVGYw7/7osoYQd9l6sdE9ghFnW6Dsxi9TTc2d0D6fF5RQU7IGnOGYylso2UsDDqIkSSryIlYXE4E7Bb6QhqFoUBDx3uHIjE9YOwi2K5962B0QMliUr9DdyxfUILWDsGsD5LPjA88H/pYyQ0tR5KERGrlrehJmVGscvpGIQHMkk0yeWlt9CzR9ZIi/FY33Q9iytxxyStEM5ZjZzm6u7/lL+tDINCtANfAOWs2TvfFQiWqEzsVCnaVsZ9lvPSDGN/P6OVrKPLDvm2CtDHhw== 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=1GjzSAeANX6iMiNI2+2QAQzVO6kM1AnBWqMsVVhkGmw=; b=qloWSQKPI047j/zzqujAVKelOKOzPB7NZM8al585c3qjoL7ajWV/WMNEnA3l6JfzKGkYAXyHIWGzUtexiUSVukkfyCOtEByb/uyJ8uFb4NKPX4dSSE3AHLawuvdDPzDw18mqulbFhnP5uLc4BN+o4lVcQcy9N1wwKasxi9MtOYM= 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 Subject: [PATCH v15 10/13] qapi: block-stream: add "bottom" argument Date: Wed, 16 Dec 2020 09:17:00 +0300 Message-Id: <20201216061703.70908-11-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20201216061703.70908-1-vsementsov@virtuozzo.com> References: <20201216061703.70908-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-Originating-IP: [185.215.60.92] X-ClientProxiedBy: AM4PR0202CA0008.eurprd02.prod.outlook.com (2603:10a6:200:89::18) 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: 48334fcc-fd8d-4a35-198d-08d8a18a4303 X-MS-TrafficTypeDiagnostic: AS8PR08MB6309: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LDFpWHQTl5eeGzzZLuagi6UW/03RI0BUMKyOdY9QgFZhKmvd2lfCLREeyHVZXl9XHmxgGHAa5VKevRixBQOuIjMkNPc1sDfvlgUFrMNgHqKZdUYb3yForqLfcnW2M5V0zjXi67LxVd4yli0AU1dBt2cz8PX3RVwg80I/a9xgiONMPVO5Amk8j8bcCOnXswZlku40+BbcKjkhONsZIQ61cArPq11esTr019ETCyCA6VO3t3BMuU64oi0n0w5KASHhfDx0AKbY3s6fx6E3Dv/B4TJ4VavxWurQPvR1KM6MJDciQuJWNpmJv/qvjsWIzD67MHi4Gfgtk4xtq4hdOwzF5g== 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)(376002)(136003)(396003)(366004)(346002)(39840400004)(4326008)(5660300002)(66556008)(66476007)(186003)(16526019)(956004)(6506007)(6512007)(2616005)(66946007)(36756003)(6666004)(1076003)(86362001)(6916009)(316002)(6486002)(52116002)(2906002)(8676002)(83380400001)(107886003)(478600001)(8936002)(26005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?CXxCNSmsKBOt7qb18neNqmv4HbL2+WUPGKD6W59ECQpll4zhAOq6k82wJZ82?= =?us-ascii?Q?822ll+Ko2H9a0Qr04rJgkJiMqicFYgG5muBxmFQyq6ALyMqMvBTz892TzLcB?= =?us-ascii?Q?JazLrg0DeT+qsiTx1/PJk3i8SnOKQlMglNzWHcRNuJMZKklwBEunF+f0B9Cm?= =?us-ascii?Q?fPdnuXX0eUDaZqssYMRLdW39AT+R0EV0Bv2R6gSWKZCgKzHouqIl0rPsFPcK?= =?us-ascii?Q?112HpE7LEhNS5ErdhZhu/GXx7L3f8F0azssTu4EgxbmEuYeAkYtak69i9XDy?= =?us-ascii?Q?YnWXDk5EqDRVs5ryRjoOtHDBQUigC78RF4BHDYaGGa2AqPtGXvOtilDN/mbw?= =?us-ascii?Q?u9AzrptnnCk0OWoqW++PDhC3iAezdFoo3+DNlcsldjnYwHmT6MmC4f9zNTW4?= =?us-ascii?Q?zvz2PjfeoQw2Phn3BrfVJKau/t0NgOMIbdznXu78tC2WkeFSz7ZM9tp5bcKF?= =?us-ascii?Q?MJ/iffIYrxeDrk9tVt3jUgSC4xNKz57+v0fnRLIBF9jkHOJZ4QDbYBIdcQgu?= =?us-ascii?Q?++Q5ilDhRLRJ1r2Cv/NXES+iYIe87VSeZkhOwEmEEaq6k+nFewzi6d5jtOJZ?= =?us-ascii?Q?j3c70zylisJEiyoyE6BThQIVi9KQz794MPqzZ98S+a71o68CQyfba3m2U4kg?= =?us-ascii?Q?RfNpzqGNKSZOAPmwLROughd+yg4eGV8jLZl3Pg4p6lcHDAI7zglmZL1/Y03R?= =?us-ascii?Q?AuTSmYJh96rGrcKrp2gZZGDJzd3bf5SWOx79xqhxTECEUiN5qrAK9B9tZ65o?= =?us-ascii?Q?r83eHG8a76BfBS6k7TzVKpTCcbVzs+avx+NT1Gf1cQ8qNcZU48HfIgnNdWOL?= =?us-ascii?Q?pzv2Z2SAswOj+rd68940Vjo6XkNxm8LiV19ry/NFsX6pOCfCV0h28dP7QJ0p?= =?us-ascii?Q?/wNf9OgMqUFQUGcFJlEvDZ+7GLkkBsCUgBesIUNt321qqEU4cX0oD1xgd87Q?= =?us-ascii?Q?21L3URciqjnoZ2OAD9UUXXypERMqP/Hk/C3beIRLXbzLpbgYtD5C1QSf8jDb?= =?us-ascii?Q?LLHj?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Dec 2020 06:17:27.4392 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-Network-Message-Id: 48334fcc-fd8d-4a35-198d-08d8a18a4303 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: b6P7LWRcIqUyN/UlpwCWc9qea0i7tBG0+M82H4vbb6midBQqF6zB8UezIgE/yBstiWD6vbNIr6wJyO/HLrQEfhlBNzKXtUBxt3K15x/ntFg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6309 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.123; 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: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, qemu-devel@nongnu.org, armbru@redhat.com, stefanha@redhat.com, den@openvz.org, andrey.shinkevich@virtuozzo.com, mreitz@redhat.com, jsnow@redhat.com 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" The code already don't freeze base node and we try to make it prepared for the situation when base node is changed during the operation. In other words, block-stream doesn't own base node. Let's introduce a new interface which should replace the current one, which will in better relations with the code. Specifying bottom node instead of base, and requiring it to be non-filter gives us the following benefits: - drop difference between above_base and base_overlay, which will be renamed to just bottom, when old interface dropped - clean way to work with parallel streams/commits on the same backing chain, which otherwise become a problem when we introduce a filter for stream job - cleaner interface. Nobody will surprised the fact that base node may disappear during block-stream, when there is no word about "base" in the interface. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Max Reitz --- qapi/block-core.json | 12 ++++--- include/block/block_int.h | 1 + block/monitor/block-hmp-cmds.c | 3 +- block/stream.c | 50 +++++++++++++++++++--------- blockdev.c | 59 ++++++++++++++++++++++++++++------ 5 files changed, 94 insertions(+), 31 deletions(-) diff --git a/qapi/block-core.json b/qapi/block-core.json index b8094a5ec7..cb0066fd5c 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -2517,10 +2517,14 @@ # @device: the device or node name of the top image # # @base: the common backing file name. -# It cannot be set if @base-node is also set. +# It cannot be set if @base-node or @bottom is also set. # # @base-node: the node name of the backing file. -# It cannot be set if @base is also set. (Since 2.8) +# It cannot be set if @base or @bottom is also set. (Since 2.8) +# +# @bottom: the last node in the chain that should be streamed into +# top. It cannot be set if @base or @base-node is also set. +# It cannot be filter node. (Since 6.0) # # @backing-file: The backing file string to write into the top # image. This filename is not validated. @@ -2576,8 +2580,8 @@ ## { 'command': 'block-stream', 'data': { '*job-id': 'str', 'device': 'str', '*base': 'str', - '*base-node': 'str', '*backing-file': 'str', '*speed': 'int', - '*on-error': 'BlockdevOnError', + '*base-node': 'str', '*backing-file': 'str', '*bottom': 'str', + '*speed': 'int', '*on-error': 'BlockdevOnError', '*filter-node-name': 'str', '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } } =20 diff --git a/include/block/block_int.h b/include/block/block_int.h index 1f56443440..4b8aa61fb4 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -1160,6 +1160,7 @@ int is_windows_drive(const char *filename); */ void stream_start(const char *job_id, BlockDriverState *bs, BlockDriverState *base, const char *backing_file_str, + BlockDriverState *bottom, int creation_flags, int64_t speed, BlockdevOnError on_error, const char *filter_node_name, diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c index e8a58f326e..afd75ab628 100644 --- a/block/monitor/block-hmp-cmds.c +++ b/block/monitor/block-hmp-cmds.c @@ -507,7 +507,8 @@ void hmp_block_stream(Monitor *mon, const QDict *qdict) int64_t speed =3D qdict_get_try_int(qdict, "speed", 0); =20 qmp_block_stream(true, device, device, base !=3D NULL, base, false, NU= LL, - false, NULL, qdict_haskey(qdict, "speed"), speed, tru= e, + false, NULL, false, NULL, + qdict_haskey(qdict, "speed"), speed, true, BLOCKDEV_ON_ERROR_REPORT, false, NULL, false, false, = false, false, &error); =20 diff --git a/block/stream.c b/block/stream.c index 6a525a5edf..045d6bc76b 100644 --- a/block/stream.c +++ b/block/stream.c @@ -221,6 +221,7 @@ static const BlockJobDriver stream_job_driver =3D { =20 void stream_start(const char *job_id, BlockDriverState *bs, BlockDriverState *base, const char *backing_file_str, + BlockDriverState *bottom, int creation_flags, int64_t speed, BlockdevOnError on_error, const char *filter_node_name, @@ -230,25 +231,42 @@ void stream_start(const char *job_id, BlockDriverStat= e *bs, BlockDriverState *iter; bool bs_read_only; int basic_flags =3D BLK_PERM_CONSISTENT_READ | BLK_PERM_WRITE_UNCHANGE= D; - BlockDriverState *base_overlay =3D bdrv_find_overlay(bs, base); + BlockDriverState *base_overlay; BlockDriverState *above_base; =20 - if (!base_overlay) { - error_setg(errp, "'%s' is not in the backing chain of '%s'", - base->node_name, bs->node_name); - return; - } + assert(!(base && bottom)); + assert(!(backing_file_str && bottom)); + + if (bottom) { + /* + * New simple interface. The code is written in terms of old inter= face + * with @base parameter (still, it doesn't freeze link to base, so= in + * this mean old code is correct for new interface). So, for now, = just + * emulate base_overlay and above_base. Still, when old interface + * finally removed, we should refactor code to use only "bottom", = but + * not "*base*" things. + */ + assert(!bottom->drv->is_filter); + base_overlay =3D above_base =3D bottom; + } else { + base_overlay =3D bdrv_find_overlay(bs, base); + if (!base_overlay) { + error_setg(errp, "'%s' is not in the backing chain of '%s'", + base->node_name, bs->node_name); + return; + } =20 - /* - * Find the node directly above @base. @base_overlay is a COW overlay= , so - * it must have a bdrv_cow_child(), but it is the immediate overlay of - * @base, so between the two there can only be filters. - */ - above_base =3D base_overlay; - if (bdrv_cow_bs(above_base) !=3D base) { - above_base =3D bdrv_cow_bs(above_base); - while (bdrv_filter_bs(above_base) !=3D base) { - above_base =3D bdrv_filter_bs(above_base); + /* + * Find the node directly above @base. @base_overlay is a COW ove= rlay, + * so it must have a bdrv_cow_child(), but it is the immediate ove= rlay + * of @base, so between the two there can only be filters. + */ + above_base =3D base_overlay; + if (bdrv_cow_bs(above_base) !=3D base) { + above_base =3D bdrv_cow_bs(above_base); + while (bdrv_filter_bs(above_base) !=3D base) { + above_base =3D bdrv_filter_bs(above_base); + } } } =20 diff --git a/blockdev.c b/blockdev.c index b58f36fc31..18699d3cda 100644 --- a/blockdev.c +++ b/blockdev.c @@ -2499,6 +2499,7 @@ void qmp_block_stream(bool has_job_id, const char *jo= b_id, const char *device, bool has_base, const char *base, bool has_base_node, const char *base_node, bool has_backing_file, const char *backing_file, + bool has_bottom, const char *bottom, bool has_speed, int64_t speed, bool has_on_error, BlockdevOnError on_error, bool has_filter_node_name, const char *filter_node_n= ame, @@ -2506,12 +2507,31 @@ void qmp_block_stream(bool has_job_id, const char *= job_id, const char *device, bool has_auto_dismiss, bool auto_dismiss, Error **errp) { - BlockDriverState *bs, *iter; + BlockDriverState *bs, *iter, *iter_end; BlockDriverState *base_bs =3D NULL; + BlockDriverState *bottom_bs =3D NULL; AioContext *aio_context; Error *local_err =3D NULL; int job_flags =3D JOB_DEFAULT; =20 + if (has_base && has_base_node) { + error_setg(errp, "'base' and 'base-node' cannot be specified " + "at the same time"); + return; + } + + if (has_base && has_bottom) { + error_setg(errp, "'base' and 'bottom' cannot be specified " + "at the same time"); + return; + } + + if (has_bottom && has_base_node) { + error_setg(errp, "'bottom' and 'base-node' cannot be specified " + "at the same time"); + return; + } + if (!has_on_error) { on_error =3D BLOCKDEV_ON_ERROR_REPORT; } @@ -2524,12 +2544,6 @@ void qmp_block_stream(bool has_job_id, const char *j= ob_id, const char *device, aio_context =3D bdrv_get_aio_context(bs); aio_context_acquire(aio_context); =20 - if (has_base && has_base_node) { - error_setg(errp, "'base' and 'base-node' cannot be specified " - "at the same time"); - goto out; - } - if (has_base) { base_bs =3D bdrv_find_backing_image(bs, base); if (base_bs =3D=3D NULL) { @@ -2553,8 +2567,33 @@ void qmp_block_stream(bool has_job_id, const char *j= ob_id, const char *device, bdrv_refresh_filename(base_bs); } =20 - /* Check for op blockers in the whole chain between bs and base */ - for (iter =3D bs; iter && iter !=3D base_bs; + if (has_bottom) { + bottom_bs =3D bdrv_lookup_bs(NULL, bottom, errp); + if (!bottom_bs) { + goto out; + } + if (!bottom_bs->drv) { + error_setg(errp, "Node '%s' is not open", bottom); + goto out; + } + if (bottom_bs->drv->is_filter) { + error_setg(errp, "Node '%s' is a filter, use a non-filter node= " + "as 'bottom'", bottom); + goto out; + } + if (!bdrv_chain_contains(bs, bottom_bs)) { + error_setg(errp, "Node '%s' is not in a chain starting from '%= s'", + bottom, device); + goto out; + } + assert(bdrv_get_aio_context(bottom_bs) =3D=3D aio_context); + } + + /* + * Check for op blockers in the whole chain between bs and base (or bo= ttom) + */ + iter_end =3D has_bottom ? bdrv_filter_or_cow_bs(bottom_bs) : base_bs; + for (iter =3D bs; iter && iter !=3D iter_end; iter =3D bdrv_filter_or_cow_bs(iter)) { if (bdrv_op_is_blocked(iter, BLOCK_OP_TYPE_STREAM, errp)) { @@ -2578,7 +2617,7 @@ void qmp_block_stream(bool has_job_id, const char *jo= b_id, const char *device, } =20 stream_start(has_job_id ? job_id : NULL, bs, base_bs, backing_file, - job_flags, has_speed ? speed : 0, on_error, + bottom_bs, job_flags, has_speed ? speed : 0, on_error, filter_node_name, &local_err); if (local_err) { error_propagate(errp, local_err); --=20 2.25.4 From nobody Mon May 20 22:21:03 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=1608099970; cv=pass; d=zohomail.com; s=zohoarc; b=ODMRbqMZu8hsPtzfb5fX6nBSYWkFu/1dNXJUoeM8GTgDUJLwC50/5v3Eu608PFaIxC2j/OFy+rTWcPSkBNELxvuJN6K0FNFhMyofIMW6Nx4p7xQ4QsOpRiXy+YMT/se8rHUd6Oa/MCFKnpHucQrU4TUp9Vfyw6JYvIz9462Xqvc= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608099970; 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=4E+9NhwWrPoG2qRE8a9HR6Smd33Wp3DZ1RgaEhDAv6Q=; b=PGA1U6EbWGmBk9EX+XApzdJFwMxhhG97rDdjUuT6WWWu1ASpZT29y0m7YASuuLzXYYDhavYoJC6w/l84GY6q143FPLcSdjdHK7qTYvD1cMe6rrcbSlpFS6xYBE0KTiF9WorLn78kjhbYQwLkd0pU89MTMYsquRumHeBQz4l4HQ4= 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 1608099970895114.53334966481862; Tue, 15 Dec 2020 22:26:10 -0800 (PST) Received: from localhost ([::1]:40232 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpQGH-0002Xb-Lk for importer@patchew.org; Wed, 16 Dec 2020 01:26:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53610) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpQ89-0002tE-NW; Wed, 16 Dec 2020 01:17:45 -0500 Received: from mail-eopbgr00135.outbound.protection.outlook.com ([40.107.0.135]:52920 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 1kpQ87-0001CD-Tk; Wed, 16 Dec 2020 01:17:45 -0500 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AS8PR08MB6309.eurprd08.prod.outlook.com (2603:10a6:20b:29f::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.24; Wed, 16 Dec 2020 06:17:28 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::d585:99a4:d7a4:d478]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::d585:99a4:d7a4:d478%4]) with mapi id 15.20.3654.024; Wed, 16 Dec 2020 06:17:28 +0000 Received: from kvm.sw.ru (185.215.60.92) by AM4PR0202CA0008.eurprd02.prod.outlook.com (2603:10a6:200:89::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.12 via Frontend Transport; Wed, 16 Dec 2020 06:17:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iND6B7p0JkmJT4rCZMQbq0sqm2imqlKtB3w72iBfWKOuel0WyyapTGnKNNEX4SvYU/183SNdV+YSp3hwFQawuDnctFSiQmJB78onvliCuyhLLVqri3XTMspRzDQJixY1vS9pMnm/0n9C6WquQxQqxMp7jvBzdPmYXUwfyrkppUtYPbMVJeLTLMM5R1N+6F9K1UjUIUcJ4ifgIKCakYH7YGS/EeTUXoC1uw+jRwbMhE6zeRWSm6iUEOtpKzR1U5B4xi3rUs0wOGCApiU7AaPUvOUbhzpMFBvy2ANbIBDnYXU5rzAY/hiTgwZIK9DXftJZmTQ1XjJTdHksA0ITnFpcTA== 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=4E+9NhwWrPoG2qRE8a9HR6Smd33Wp3DZ1RgaEhDAv6Q=; b=RNleRCGKUYwZBiESWAOdXrpSVCYKI/Ge+gWrl2TlE3+4dJiHWnD6zRuWfiEWGusiMO2LXTQlekp4XAb2v4SIyHD/8/yrCtH2px7CtcD/0xggsIIBBfysPT2wJp1qwImG0CgQLbcWeK4aTzB95zxNF3gX3hhns5s5IoFHZ8mcMZGhAHHrMT7symTmyoysK4s/tJsQP+WAIrSkXO+WmwbLk139vvfRbcQz4P8NedjMGaYNpHhToVjcAJAY2/dISZqyzzqRPtzTnCm1zWKZPn0KKt9T2hvtYEs85mOO8AYG3+Wui7udG149bM0QNUqKAlDIPuyhhku9IoWXJpJbWuVzpw== 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=4E+9NhwWrPoG2qRE8a9HR6Smd33Wp3DZ1RgaEhDAv6Q=; b=YrrXcytCZ8vqW5QSUVQgthD/hfnTBXTvcO97OKBbosduc9Xy7YTrurA963EHuxDHMi/GqCILGd+RGYSe8bD7+XJwZT0xIXZKHSFTgGHE0viqPSRhg9zACVuVvnIpUWidvkdnGMA4KKWRPxJ835AYgJ1XeM5bWJ3RF/9RXq2K9xs= 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 Subject: [PATCH v15 11/13] iotests: 30: prepare to COR filter insertion by stream job Date: Wed, 16 Dec 2020 09:17:01 +0300 Message-Id: <20201216061703.70908-12-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20201216061703.70908-1-vsementsov@virtuozzo.com> References: <20201216061703.70908-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-Originating-IP: [185.215.60.92] X-ClientProxiedBy: AM4PR0202CA0008.eurprd02.prod.outlook.com (2603:10a6:200:89::18) 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: 598a93a2-f83d-4540-7693-08d8a18a4396 X-MS-TrafficTypeDiagnostic: AS8PR08MB6309: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Vi1s+OuNeF07pQ/FiZpv1ueim8POVsactNJzH/WcRN0xo6CSyuXfXeXHSbPFGzDZuTf0qQPLzEKFaK5nD8Y7RlZmOdZCQZfwTKkShA0QOfDDGT6n4NulKdiks39zjCTLorp1JMGNXry5nZhf74asmgMPG/9Jg7xYY9vDoyEC5hB+dUF8lmLtH6hIM9VXMi1vddPr0qoVSOl+qS8iF0VRxGzHRxbj+H5efBI1ftznipQ3jIHotDZeeKdXKLMBkJ40hGYUMiho2yTjZhXSbDsq35VDE+eIHWCz6NHv2g/Gh+aTcfJlUHpMBm0mEWtmV7F/WtSnX2sLGf8s7qyDBYTmvg== 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)(376002)(136003)(396003)(366004)(346002)(39840400004)(4326008)(5660300002)(66556008)(66476007)(186003)(16526019)(956004)(6506007)(6512007)(2616005)(66946007)(36756003)(6666004)(1076003)(86362001)(6916009)(316002)(6486002)(52116002)(2906002)(8676002)(83380400001)(107886003)(478600001)(8936002)(26005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?GVN94FtmLHqKkjlXtADk8X3HDCruYEhXtY7OsvuFp5E0d7m57wMhgNIDiyJv?= =?us-ascii?Q?98SSNzJS+Lb9Tm1ZJ4/sCB9ks0nBO8gNwikXD3arahm2DhcwZK/8FdGZpTc8?= =?us-ascii?Q?CGPLHJHyZNVLZL/Oq62ESAZNCMnnIwvRF+xOO+FVCRZFyr7UDzEZGAw+loRn?= =?us-ascii?Q?TBVrNAe6cN83KJY/hE+TXHRPg9c/NtcAxuZqn1w8Z3xvnSinGGsFI44ORdHC?= =?us-ascii?Q?823EPDctxZrz+xBVpJkUEbx3XbZiPFbEA8CR+IAEloATl2U3no7vd/OChGDL?= =?us-ascii?Q?pcWo1YPQuw6KWpI4pS1WPuqskBEIE3IyOPZzFXLTyxIVt0qD3d54GWo8PcGt?= =?us-ascii?Q?U79nCWgN38SkdxKhiUEuA81mc83lEktLzoLnbPNVSsN4adVQxgZaZ1dA3xqF?= =?us-ascii?Q?r1LxETi3WAjc+6nL4CoAIHtHa3CdULGRkI2yYEyQOcpMLq2xR/fEqD4Blb2f?= =?us-ascii?Q?U6z4BE/SU/P65iFwPTAdE6u8JufCzTq7Ok5o84MDfcTPb/77Z+I09C+yleL0?= =?us-ascii?Q?cOmwKE4Xx9umxLdAYQsue9KvBHj1Mkl9V4/Ylptd9arnFxq6KNt7P0VdU4As?= =?us-ascii?Q?Si/rf/rk53Zr3BX1dJ7uwN5jzKJo/2uQuSlbrF45x2B6dz9Eso8ubaWlClY+?= =?us-ascii?Q?XWSyLcFquNvsmh73UkTNSY/TbxFCbLrl61CsyhbaqYvKordqaftAQhvTlTzi?= =?us-ascii?Q?YKdl+B0+7Jl+HBJV3XbEgf7P9/fb/1zDTlSriOAcjcD3bqfUeJm5H6nGGjVs?= =?us-ascii?Q?GmF7O57ympu17PF1dtm/A/2dK6ROtEzyYaWzVotRg3ZvjghWiGs/0kTYLDtq?= =?us-ascii?Q?96cblLjl8exDavKmIGQMBy4nbmL1QT7XMsVk7BssuXwUuXn6Y9TjBiquN8ZT?= =?us-ascii?Q?FGJdw7wzEhkvbVv6HKpMZmB03Koiabs3jfKItbiRGhJrrSV4ls4c+5qaqJQq?= =?us-ascii?Q?vnScHIAf+umaRRr1i8pMBupzxuRQI9ywPq4vIdQUj9LxcIEApsUtMZ6NOZ8+?= =?us-ascii?Q?W3Zi?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Dec 2020 06:17:28.3810 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-Network-Message-Id: 598a93a2-f83d-4540-7693-08d8a18a4396 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: yMnYoLyzRREKtUzHr2vrvr9bRN99/hIWJvvRVudLMh+ChtlgzVj2m2oC/OW2KinTdDYeGSsFdFcRpD3NjDLf0FiUsy/7nUxxYlRLEGEJzyw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6309 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.135; envelope-from=vsementsov@virtuozzo.com; helo=EUR02-AM5-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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, qemu-devel@nongnu.org, armbru@redhat.com, stefanha@redhat.com, den@openvz.org, andrey.shinkevich@virtuozzo.com, mreitz@redhat.com, jsnow@redhat.com 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" test_stream_parallel run parallel stream jobs, intersecting so that top of one is base of another. It's OK now, but it would be a problem if insert the filter, as one job will want to use another job's filter as above_base node. Correct thing to do is move to new interface: "bottom" argument instead of base. This guarantees that jobs don't intersect by their actions. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Max Reitz --- tests/qemu-iotests/030 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/qemu-iotests/030 b/tests/qemu-iotests/030 index dcb4b5d6a6..bd8cf9cff7 100755 --- a/tests/qemu-iotests/030 +++ b/tests/qemu-iotests/030 @@ -245,7 +245,9 @@ class TestParallelOps(iotests.QMPTestCase): node_name =3D 'node%d' % i job_id =3D 'stream-%s' % node_name pending_jobs.append(job_id) - result =3D self.vm.qmp('block-stream', device=3Dnode_name, job= _id=3Djob_id, base=3Dself.imgs[i-2], speed=3D1024) + result =3D self.vm.qmp('block-stream', device=3Dnode_name, + job_id=3Djob_id, bottom=3Df'node{i-1}', + speed=3D1024) self.assert_qmp(result, 'return', {}) =20 for job in pending_jobs: --=20 2.25.4 From nobody Mon May 20 22:21:03 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=1608100182; cv=pass; d=zohomail.com; s=zohoarc; b=hiNgi9Es+EpTQcJ0aMFwUuqweex84bHsXXVgY0JurB80N4kzgCtgk7WZeeQm+QHnS2Ltyahse1NQpCeM1yzL32cbrASCgm4FrrXHkxG5PwRy5p6MaD3CsBihgYB4/8v8AiDmqHMrB9VfDZ6CnRoe2RnT+KxH5fAAwZLZVjEEcN8= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608100182; 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=K1EN1Y/Yprxl4SBjkfLXYv0cV9ISMI/aWeFX9S/Ue4E=; b=Vtqv1aP8fSgKXABfwhQS0IcmN2VuMeZ6i8WNlSWiokaTUez4gaC64Y2nIRoYetlT3px7YkKIFXf4MKrzydL6gJuLaP9lj5GTZ9vpgOL+CDLU89yu/LbWgoJpncZBWbpmBnPJgL0GhcfTKEQ600Fb39NI5r/x3e9Eyor8I6gG5LM= 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 160810018269687.61847474571744; Tue, 15 Dec 2020 22:29:42 -0800 (PST) Received: from localhost ([::1]:48436 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpQJh-000685-D9 for importer@patchew.org; Wed, 16 Dec 2020 01:29:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53630) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpQ8B-0002yo-S6; Wed, 16 Dec 2020 01:17:47 -0500 Received: from mail-eopbgr00123.outbound.protection.outlook.com ([40.107.0.123]:51180 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 1kpQ88-0001E7-V4; Wed, 16 Dec 2020 01:17:47 -0500 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AS8PR08MB6309.eurprd08.prod.outlook.com (2603:10a6:20b:29f::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.24; Wed, 16 Dec 2020 06:17:29 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::d585:99a4:d7a4:d478]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::d585:99a4:d7a4:d478%4]) with mapi id 15.20.3654.024; Wed, 16 Dec 2020 06:17:29 +0000 Received: from kvm.sw.ru (185.215.60.92) by AM4PR0202CA0008.eurprd02.prod.outlook.com (2603:10a6:200:89::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.12 via Frontend Transport; Wed, 16 Dec 2020 06:17:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oTxbcMsGmzVC2khyzwK/ygM9SE+kpZHOAAYRoUAPxz5+6KoTK/O3kQ+MGdxubKfJxSrsU5a8qb5I5kZEIflsqKif1A1Glw5zORJq1c+/w/RBqqozp9MocV1S+QcRb7I0ClQOR4+6dzN/8v9H5qQc/6qF6j9TbqE2fMeRNdvJPdRhhM69PM5Uvz2l9bVXqXzvkKYxjz0cRKcmTSA11H/O+SNOShxePmRPKHWhwueauEvJ/nhrVRomT/04E6fIvznbz9eN5+I5jY0exv0x01U3BppnlPWBiivn8SakKHtgLzS9mlOTUKVRObdGp2vnW0qr2j3Xtd1qwNgAu2oorYWU2A== 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=K1EN1Y/Yprxl4SBjkfLXYv0cV9ISMI/aWeFX9S/Ue4E=; b=mUSgxgs1ua0N65x8Uo7l6X1oeNVThD/24VqON4GcbpKL4RfPCwDlPteq/zzeRPqLBnX/OlLt0cte6N0GeJBzwYOSXXsw7GHFEJVMAOIeyJfnVLGFqJsj6u0LKmrk6CHntuy6l2JGMD8FXgjTk5mM1slIxL8uWD/f4JcOyrFFnG3yKaREdplaWb7Hne315Y9qLSTredetOVTYFN0AYQqLgz3zz1JUtP60ANV6n+iD4HHZASyAGwRaAteysZX9vdFdWNi0dGmEFnShARJqQe6aMqv5T+nZR4uIs0o6XeedckdXQEc48k/+yndsR+3tGBDq+LrF7ngsp29L92dyUSVfMw== 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=K1EN1Y/Yprxl4SBjkfLXYv0cV9ISMI/aWeFX9S/Ue4E=; b=JcJZvmebsKxdq+eS7tARSEkkT0gCZiTQyzQkSFd8YhYkc2rbYTpxlnlTaBDIH/j/GHkLfQtZMNtmNM5flQnZoc5uG3se8PqZ6wUYisedBvP2B49XKuPsOJQOYK+cB0RU8beuEkLkfhcX7uYKrLQ2zOs050AJScOmCimPb9dWExc= 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 Subject: [PATCH v15 12/13] block/stream: add s->target_bs Date: Wed, 16 Dec 2020 09:17:02 +0300 Message-Id: <20201216061703.70908-13-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20201216061703.70908-1-vsementsov@virtuozzo.com> References: <20201216061703.70908-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-Originating-IP: [185.215.60.92] X-ClientProxiedBy: AM4PR0202CA0008.eurprd02.prod.outlook.com (2603:10a6:200:89::18) 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: 69f0e266-409a-4083-a731-08d8a18a4443 X-MS-TrafficTypeDiagnostic: AS8PR08MB6309: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:137; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ULBTZN6c/J6fh7h9df2Rx5fBQI/PoiUB1nGPz6c7froPzCxHUiL1n9t3hFZNeHBw0Gn0x1j4wKgJsQWAnVuTC3BIpxTa+/67NImc5aqcNZNP10BnBfY9g8JEBdTHVNMZ29aX/ZeK0m/00ZcSzo6kkyqE9M8rMucKLrBoKforUUyswYkWMLesxUWC82a+L9p7wi0Hw4RCSaXY5hHGMqtengwtX67SQ6R3Wku546/tY3HOam28S6VwyWR4ehpibYzTuUjNqZbgEj7ZPXOT41VjikCyPshmsPC+VL8oN7EUY1HJxZUMaSjwOjHdYbtv6ovLKhjSQrx4CwNcWOL+wMgGIQ== 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)(376002)(136003)(396003)(366004)(346002)(39840400004)(4326008)(5660300002)(66556008)(66476007)(186003)(16526019)(956004)(6506007)(6512007)(2616005)(66946007)(36756003)(6666004)(1076003)(86362001)(6916009)(316002)(6486002)(52116002)(2906002)(8676002)(83380400001)(107886003)(478600001)(8936002)(26005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?ejXUsUuZbrLHg25uafrQszJoUDs1AK9iJ6cfIJIV02+A8Ghrk9S8vD6WJiKH?= =?us-ascii?Q?5nffPdTm2kpwvvYb54VwOHajtUXXn6bkfT6vYCHduvIRu81IiP/8+b2mFqY5?= =?us-ascii?Q?1RWS7SeGz+/oL+7UTuU5mvBtjuEKJPLSyYkwAlX2Z6nxxi56tWbQ6BmIar1d?= =?us-ascii?Q?2sHpwg9nQCjPPs7/UNAXuZ4cQ5tdHYG+gcqEY1Qdb6gc2lm8ienUYQTTJfjk?= =?us-ascii?Q?JOBe+We7/Ubk6bA6P+JVZ8eeVfDrqQCP3ivgrRX9c5Go1IdT7C9JrIMCvG5t?= =?us-ascii?Q?rKppZoVm9Egk/rSgINImCEfSk5mCr6B1dxNAAkovhD9Yjfu8ySxIXQB79NfO?= =?us-ascii?Q?GHgWlmVoeXR0g0gh7Aj4lZBIYN8sbvnBGvuXcfOGnnEbwOT0kkBxOgNI9Qjn?= =?us-ascii?Q?1cXBSnL/sLnpGF/gwurqP8geWije0qMzKrS6WnGDkQSPfAjEpeuKs7tH0LJC?= =?us-ascii?Q?H44HN+WikTKnItoL8/Hq9XF1q5Y2CfUSy1n4vT4F54/oD4UUAvp64M6durfU?= =?us-ascii?Q?HAD4qCsrwhe+ntY4poOB5LF8MwAg0NaQDdQBuenQHCFcK+ZJ6F2A8wF3YpYP?= =?us-ascii?Q?5LPCRql89k9zx3O6asw43h7N1nVwR0cgaonYOSPR5wOPHjyJjDkdSiN3XBj/?= =?us-ascii?Q?Zs2RtDz5C45P0ZywkseyBJzFMXkmKd72n64+IsFcGCWflXokNTFYVN7Bg3Jl?= =?us-ascii?Q?raNHuE7obvrkVpaj1LlQEekTOmpRLlKMHSGZDQ15Vd9zPZkQ5Kb90FVdIUDb?= =?us-ascii?Q?7MhuWvFd83iFsJ7tYE1vLTkA3qwE9F8gtBQz5D9Bc1lba0Zmi822VL5YdMU4?= =?us-ascii?Q?ktgia0+kPDETXSzJdToGkmQcULR+7Ph5jzI3SPmLMmaLHVkYlnlVUFDK62jf?= =?us-ascii?Q?rO/4YVC7MTXux9jWYer7MlDU7ZICEZyuHo+6OkrZl6ZTRygYTkW68gHIOhht?= =?us-ascii?Q?g2j+ArA1cXuSnIiLFZWrDzDDgyuU+kxG4pw8v5Slo2g3D2LotuTaefsm+d7m?= =?us-ascii?Q?BOK/?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Dec 2020 06:17:29.4583 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-Network-Message-Id: 69f0e266-409a-4083-a731-08d8a18a4443 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: yP0VPnpKSt6FUds2hkP8GEqW15S06rpaGelx7uSvgMB4Ic7tGU+l90ZeWTuvnjALOECBawTsq/zQ0A04ukDaRxhDZBno2we7LDj2yfZHTNU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6309 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.123; 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: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, qemu-devel@nongnu.org, armbru@redhat.com, stefanha@redhat.com, den@openvz.org, andrey.shinkevich@virtuozzo.com, mreitz@redhat.com, jsnow@redhat.com 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" Add a direct link to target bs for convenience and to simplify following commit which will insert COR filter above target bs. This is a part of original commit written by Andrey. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Max Reitz --- block/stream.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/block/stream.c b/block/stream.c index 045d6bc76b..626dfa2b22 100644 --- a/block/stream.c +++ b/block/stream.c @@ -33,6 +33,7 @@ typedef struct StreamBlockJob { BlockJob common; BlockDriverState *base_overlay; /* COW overlay (stream from this) */ BlockDriverState *above_base; /* Node directly above the base */ + BlockDriverState *target_bs; BlockdevOnError on_error; char *backing_file_str; bool bs_read_only; @@ -53,23 +54,20 @@ static void stream_abort(Job *job) StreamBlockJob *s =3D container_of(job, StreamBlockJob, common.job); =20 if (s->chain_frozen) { - BlockJob *bjob =3D &s->common; - bdrv_unfreeze_backing_chain(blk_bs(bjob->blk), s->above_base); + bdrv_unfreeze_backing_chain(s->target_bs, s->above_base); } } =20 static int stream_prepare(Job *job) { StreamBlockJob *s =3D container_of(job, StreamBlockJob, common.job); - BlockJob *bjob =3D &s->common; - BlockDriverState *bs =3D blk_bs(bjob->blk); - BlockDriverState *unfiltered_bs =3D bdrv_skip_filters(bs); + BlockDriverState *unfiltered_bs =3D bdrv_skip_filters(s->target_bs); BlockDriverState *base =3D bdrv_filter_or_cow_bs(s->above_base); BlockDriverState *unfiltered_base =3D bdrv_skip_filters(base); Error *local_err =3D NULL; int ret =3D 0; =20 - bdrv_unfreeze_backing_chain(bs, s->above_base); + bdrv_unfreeze_backing_chain(s->target_bs, s->above_base); s->chain_frozen =3D false; =20 if (bdrv_cow_child(unfiltered_bs)) { @@ -95,13 +93,12 @@ static void stream_clean(Job *job) { StreamBlockJob *s =3D container_of(job, StreamBlockJob, common.job); BlockJob *bjob =3D &s->common; - BlockDriverState *bs =3D blk_bs(bjob->blk); =20 /* Reopen the image back in read-only mode if necessary */ if (s->bs_read_only) { /* Give up write permissions before making it read-only */ blk_set_perm(bjob->blk, 0, BLK_PERM_ALL, &error_abort); - bdrv_reopen_set_read_only(bs, true, NULL); + bdrv_reopen_set_read_only(s->target_bs, true, NULL); } =20 g_free(s->backing_file_str); @@ -111,8 +108,7 @@ static int coroutine_fn stream_run(Job *job, Error **er= rp) { StreamBlockJob *s =3D container_of(job, StreamBlockJob, common.job); BlockBackend *blk =3D s->common.blk; - BlockDriverState *bs =3D blk_bs(blk); - BlockDriverState *unfiltered_bs =3D bdrv_skip_filters(bs); + BlockDriverState *unfiltered_bs =3D bdrv_skip_filters(s->target_bs); bool enable_cor =3D !bdrv_cow_child(s->base_overlay); int64_t len; int64_t offset =3D 0; @@ -125,7 +121,7 @@ static int coroutine_fn stream_run(Job *job, Error **er= rp) return 0; } =20 - len =3D bdrv_getlength(bs); + len =3D bdrv_getlength(s->target_bs); if (len < 0) { return len; } @@ -137,7 +133,7 @@ static int coroutine_fn stream_run(Job *job, Error **er= rp) * account. */ if (enable_cor) { - bdrv_enable_copy_on_read(bs); + bdrv_enable_copy_on_read(s->target_bs); } =20 for ( ; offset < len; offset +=3D n) { @@ -199,7 +195,7 @@ static int coroutine_fn stream_run(Job *job, Error **er= rp) } =20 if (enable_cor) { - bdrv_disable_copy_on_read(bs); + bdrv_disable_copy_on_read(s->target_bs); } =20 /* Do not remove the backing file if an error was there but ignored. */ @@ -314,6 +310,7 @@ void stream_start(const char *job_id, BlockDriverState = *bs, s->base_overlay =3D base_overlay; s->above_base =3D above_base; s->backing_file_str =3D g_strdup(backing_file_str); + s->target_bs =3D bs; s->bs_read_only =3D bs_read_only; s->chain_frozen =3D true; =20 --=20 2.25.4 From nobody Mon May 20 22:21:03 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=1608100398; cv=pass; d=zohomail.com; s=zohoarc; b=oBIP/NkzaqKNLQReuy/9b0StwSJJGKW8r+fmur9XbbSjw+nX70mxTi65OBaC/2K09a1B9hkeN13NpejV2U259jtFCzI2x+KGhPqAuhjR5KU9bH2NJCJgoXljUgyfQjZ9yYVQVsvPmV5l6MUIMoJtnh1VgmjqejIXBEUOmkPClU8= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608100398; 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=ZaHoqmLjbQ1IspI2B5cCs5mLZGgBX131TkEZVnz/g3Y=; b=MYl4pOyUszoGq8hAlM3bl5yoZpCCvDrD9Etj/gVIg4J/ulKLSnnIZdMpN720Zrg7aI93a+fEn/zVqGiW7SIYYG0MWWBceHxq8GQCBWp9YBrR8oDIlfV5He6AhnlixXYSZvKehDxu8CM6A4Z+f2SK7f3/rqWYhV42o5CEO+/MLjU= 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 16081003987591004.2908963058186; Tue, 15 Dec 2020 22:33:18 -0800 (PST) Received: from localhost ([::1]:54750 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpQNB-0000W8-HO for importer@patchew.org; Wed, 16 Dec 2020 01:33:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53632) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpQ8D-00032u-H3; Wed, 16 Dec 2020 01:17:49 -0500 Received: from mail-eopbgr00135.outbound.protection.outlook.com ([40.107.0.135]:52920 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 1kpQ8A-0001CD-9t; Wed, 16 Dec 2020 01:17:49 -0500 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AS8PR08MB6309.eurprd08.prod.outlook.com (2603:10a6:20b:29f::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.24; Wed, 16 Dec 2020 06:17:30 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::d585:99a4:d7a4:d478]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::d585:99a4:d7a4:d478%4]) with mapi id 15.20.3654.024; Wed, 16 Dec 2020 06:17:30 +0000 Received: from kvm.sw.ru (185.215.60.92) by AM4PR0202CA0008.eurprd02.prod.outlook.com (2603:10a6:200:89::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.12 via Frontend Transport; Wed, 16 Dec 2020 06:17:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cxDjy3T8Y16JBgVl0M6AnAUyH5cIjsB3iIHb9FynFzjYrghdhXrPOP5Q4SJQg92KHwvlZY/mPziba+zPHMe18IBtJ1MuyzMrlZ7aiJRmzvGs2ZoAZJJPGHHkK6lw4GZvsEwHK3yIQY/U4JNIwz2irOMeC0dynNTiLXwGQmHcVrCgZJwxDM7/W+kkJb5iITi3/05mGyaT58loJO0WA2ivGDR6siuyzD5qvEhrAzj7/1UWv400loY9m7hbQF8UQjgovZQPciczuZiLcOi+Ern0OsCfC4uKjY2EklUNTztoxM8SELN4dzvjbbGpRacITsX58tArYDbxWHl17HRtVgmE7Q== 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=ZaHoqmLjbQ1IspI2B5cCs5mLZGgBX131TkEZVnz/g3Y=; b=B+LM1ri+4BhiOzVv1Z0OnIKf0DpAWY0/t5n3zjGJZgopdijKp0qoXbefaFs6Gg4nsapFOqvpxy9FUFaqAGh+9ZlVvgx0OuQBTkNoTg2PfwH/NLRsbLUASzs7tra6VishDOapeTC118jwpNp0rkZ/2ADBzfMEQCIRDrxh8FhUZuP4/DEyO59qo4IO3BkC/ObhsuH2noDp/h+kvcT36a/BYTacUAvSo38KARMCwlnr4knIVUCTW6ZjJ1TO1BsJKmrALis41SE/AA8TySalUUkLsc44Ct8Luw0tDswljpMdNnACNl0EgVlYNzyvw6CzaWWWnILdZfCGPihgx7a2jWX0wg== 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=ZaHoqmLjbQ1IspI2B5cCs5mLZGgBX131TkEZVnz/g3Y=; b=SCL1xiFPzq2xCsIqSgM5JWtktxRAm0yhFKGuhDeB8vSzhp0qiPHi77HYjBQyEM6/XHkVvSf2w3vLGR9rOC/CY7tDz/DzwyZ/yfB3BsnQHC4HtGh7Gu/m7mB7dU1vIuBk8vCfkWWqZZeKBJgeAyLdNy5r3tc4QtCnzMlB9SsjDnQ= 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 Subject: [PATCH v15 13/13] block: apply COR-filter to block-stream jobs Date: Wed, 16 Dec 2020 09:17:03 +0300 Message-Id: <20201216061703.70908-14-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20201216061703.70908-1-vsementsov@virtuozzo.com> References: <20201216061703.70908-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-Originating-IP: [185.215.60.92] X-ClientProxiedBy: AM4PR0202CA0008.eurprd02.prod.outlook.com (2603:10a6:200:89::18) 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: 09c0d67c-f132-44b5-156b-08d8a18a44f0 X-MS-TrafficTypeDiagnostic: AS8PR08MB6309: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pO5sfgDj+TJRu/jshEpbdOvcvL+9mDesVRnppEIHkbWWjK7WEerXUP/kqPNNWVrqbyyTdbAsH43YCB3/t5pisMgitniVTxtMqhahoHB2FRe5XsBpPzMMTXbO07dKuucMhd2TB1DhamwItqY4DmHm+7tV4x/gxZZl/aL+N0va91315Zdz351rg8D46q50LN1NESWqWmQG2yruBcWURr8cKU9ZVBDP8HPLGm9+43Fn0MrmGek1nOCLglcWyAnNe03ihIRVJvrFXvClPxpGrTCNxh3SIO2vjWCP0MDTJ8GCoYlX6IxoW6mj+9pORGklbXrE 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)(376002)(136003)(396003)(366004)(346002)(39840400004)(4326008)(5660300002)(66556008)(66476007)(186003)(16526019)(956004)(6506007)(6512007)(2616005)(66946007)(36756003)(6666004)(1076003)(86362001)(6916009)(30864003)(316002)(6486002)(52116002)(2906002)(8676002)(83380400001)(107886003)(478600001)(8936002)(26005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?ig3K9fzG+DUy5a2Z98tuG5D+eYncH5TBuRG7e/T5e15ilsVabh/euWfDf62G?= =?us-ascii?Q?OHfEFrVZDEfJOZYKcXOqpHFCUNTo7jWikOiRPqtS1ncilJcEjpqvdkqbY1KB?= =?us-ascii?Q?eoJUjvGuPWZP0d3zt3JDIyOLccDp04BonPkderUGNY8+yiRfJBp7yafZPFkA?= =?us-ascii?Q?j3N0N5MV3xTr6ceySPLBktZlAEvE5ccAwPeZbk3BGPPEdG+hIffJ5jP5G4Wq?= =?us-ascii?Q?VI+um59nAvzohBzBNOkJ9dr1xchi/0Ze56YSnFT3KlCjPUdyU/CE0kKn0Dr8?= =?us-ascii?Q?rcUWhRj/cpicqZDcUsRM7N0EMh6zRPBu8cGSXv9K6zHHR4W4YylMCnBEgDu1?= =?us-ascii?Q?MTMFX0xlyvJjjMcODppgrZi0peyAPixYfAAOIgpWYPio5fuYFr9rhN6GqxHG?= =?us-ascii?Q?mEpu0DekifnphZ7kfmKKhA0+O9yJd96ONIKutvVwUH3NngJE0bHJDqm/YRaa?= =?us-ascii?Q?j4gHcsKaHYhGT+UMk0lU+00Urc8G/ctbR6s76sz3DJzlsv7l5XEGan6ge6ow?= =?us-ascii?Q?EhFfCgJJllHKW5yPYw3fo8CrKd0DbFyAsJ4NZmSUMsNv1zbvklOiXDl3Zd1G?= =?us-ascii?Q?oTQJLtDjezGBAfCEnh9Taba84hQgZjXf4LvP4lJCahvWEgFt6IUTzSEAGeTw?= =?us-ascii?Q?dVaZeuIdFBAaz5MwsB8IOFYdFLUzTiosVs+2VVhzcGznoATOsNDVaq+fugXH?= =?us-ascii?Q?hePJayKL2c1BkQ1z3SdKq/8MJggHwIuoKnV+5bWzFdvAS6+ODO1Lrehjbpbg?= =?us-ascii?Q?0lpLTvaxb6SYAAXMaP2Z1tYGPXwj2/5NHVqGGwHcx5xZ9AK9vp2Hb6pcRxdc?= =?us-ascii?Q?YUfNRu5ncb1W9w+k7VouyK08XsQ5AGtmqg7j/S6BKh3GIJymEWDKN5ar6WnM?= =?us-ascii?Q?8qaK0pJgiqsCl5JNOnVasQTtuf3ug3PPcfHLL/bl4AAOfUxcIRCaS+4i11jz?= =?us-ascii?Q?713HgPMUsTbjXLzP3Sdol17MlA99VTyjjV6T5HModBTVvLN8/pwyaNr67KAX?= =?us-ascii?Q?nKwn?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Dec 2020 06:17:30.6003 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-Network-Message-Id: 09c0d67c-f132-44b5-156b-08d8a18a44f0 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Gg6ZkmSK7POL1maY5KcBhwQewA82VJKtGyQhYUTUJiz879PzkDH1t/dzJ61saoXR/IhwwLzGN1iLOfw9BQN/DJNkYPgItv9MLIkK1z0lxKg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6309 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.135; envelope-from=vsementsov@virtuozzo.com; helo=EUR02-AM5-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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, qemu-devel@nongnu.org, armbru@redhat.com, stefanha@redhat.com, den@openvz.org, andrey.shinkevich@virtuozzo.com, mreitz@redhat.com, jsnow@redhat.com 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" From: Andrey Shinkevich This patch completes the series with the COR-filter applied to block-stream operations. Adding the filter makes it possible in future implement discarding copied regions in backing files during the block-stream job, to reduce the disk overuse (we need control on permissions). Also, the filter now is smart enough to do copy-on-read with specified base, so we have benefit on guest reads even when doing block-stream of the part of the backing chain. Several iotests are slightly modified due to filter insertion. Signed-off-by: Andrey Shinkevich Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Max Reitz --- block/stream.c | 105 ++++++++++++++++++++++--------------- tests/qemu-iotests/030 | 8 +-- tests/qemu-iotests/141.out | 2 +- tests/qemu-iotests/245 | 20 ++++--- 4 files changed, 80 insertions(+), 55 deletions(-) diff --git a/block/stream.c b/block/stream.c index 626dfa2b22..1fa742b0db 100644 --- a/block/stream.c +++ b/block/stream.c @@ -17,8 +17,10 @@ #include "block/blockjob_int.h" #include "qapi/error.h" #include "qapi/qmp/qerror.h" +#include "qapi/qmp/qdict.h" #include "qemu/ratelimit.h" #include "sysemu/block-backend.h" +#include "block/copy-on-read.h" =20 enum { /* @@ -33,11 +35,11 @@ typedef struct StreamBlockJob { BlockJob common; BlockDriverState *base_overlay; /* COW overlay (stream from this) */ BlockDriverState *above_base; /* Node directly above the base */ + BlockDriverState *cor_filter_bs; BlockDriverState *target_bs; BlockdevOnError on_error; char *backing_file_str; bool bs_read_only; - bool chain_frozen; } StreamBlockJob; =20 static int coroutine_fn stream_populate(BlockBackend *blk, @@ -45,17 +47,7 @@ static int coroutine_fn stream_populate(BlockBackend *bl= k, { assert(bytes < SIZE_MAX); =20 - return blk_co_preadv(blk, offset, bytes, NULL, - BDRV_REQ_COPY_ON_READ | BDRV_REQ_PREFETCH); -} - -static void stream_abort(Job *job) -{ - StreamBlockJob *s =3D container_of(job, StreamBlockJob, common.job); - - if (s->chain_frozen) { - bdrv_unfreeze_backing_chain(s->target_bs, s->above_base); - } + return blk_co_preadv(blk, offset, bytes, NULL, BDRV_REQ_PREFETCH); } =20 static int stream_prepare(Job *job) @@ -67,8 +59,9 @@ static int stream_prepare(Job *job) Error *local_err =3D NULL; int ret =3D 0; =20 - bdrv_unfreeze_backing_chain(s->target_bs, s->above_base); - s->chain_frozen =3D false; + /* We should drop filter at this point, as filter hold the backing cha= in */ + bdrv_cor_filter_drop(s->cor_filter_bs); + s->cor_filter_bs =3D NULL; =20 if (bdrv_cow_child(unfiltered_bs)) { const char *base_id =3D NULL, *base_fmt =3D NULL; @@ -94,6 +87,11 @@ static void stream_clean(Job *job) StreamBlockJob *s =3D container_of(job, StreamBlockJob, common.job); BlockJob *bjob =3D &s->common; =20 + if (s->cor_filter_bs) { + bdrv_cor_filter_drop(s->cor_filter_bs); + s->cor_filter_bs =3D NULL; + } + /* Reopen the image back in read-only mode if necessary */ if (s->bs_read_only) { /* Give up write permissions before making it read-only */ @@ -109,7 +107,6 @@ static int coroutine_fn stream_run(Job *job, Error **er= rp) StreamBlockJob *s =3D container_of(job, StreamBlockJob, common.job); BlockBackend *blk =3D s->common.blk; BlockDriverState *unfiltered_bs =3D bdrv_skip_filters(s->target_bs); - bool enable_cor =3D !bdrv_cow_child(s->base_overlay); int64_t len; int64_t offset =3D 0; uint64_t delay_ns =3D 0; @@ -127,15 +124,6 @@ static int coroutine_fn stream_run(Job *job, Error **e= rrp) } job_progress_set_remaining(&s->common.job, len); =20 - /* Turn on copy-on-read for the whole block device so that guest read - * requests help us make progress. Only do this when copying the enti= re - * backing chain since the copy-on-read operation does not take base i= nto - * account. - */ - if (enable_cor) { - bdrv_enable_copy_on_read(s->target_bs); - } - for ( ; offset < len; offset +=3D n) { bool copy; int ret; @@ -194,10 +182,6 @@ static int coroutine_fn stream_run(Job *job, Error **e= rrp) } } =20 - if (enable_cor) { - bdrv_disable_copy_on_read(s->target_bs); - } - /* Do not remove the backing file if an error was there but ignored. */ return error; } @@ -209,7 +193,6 @@ static const BlockJobDriver stream_job_driver =3D { .free =3D block_job_free, .run =3D stream_run, .prepare =3D stream_prepare, - .abort =3D stream_abort, .clean =3D stream_clean, .user_resume =3D block_job_user_resume, }, @@ -228,7 +211,9 @@ void stream_start(const char *job_id, BlockDriverState = *bs, bool bs_read_only; int basic_flags =3D BLK_PERM_CONSISTENT_READ | BLK_PERM_WRITE_UNCHANGE= D; BlockDriverState *base_overlay; + BlockDriverState *cor_filter_bs =3D NULL; BlockDriverState *above_base; + QDict *opts; =20 assert(!(base && bottom)); assert(!(backing_file_str && bottom)); @@ -266,30 +251,62 @@ void stream_start(const char *job_id, BlockDriverStat= e *bs, } } =20 - if (bdrv_freeze_backing_chain(bs, above_base, errp) < 0) { - return; - } - /* Make sure that the image is opened in read-write mode */ bs_read_only =3D bdrv_is_read_only(bs); if (bs_read_only) { - if (bdrv_reopen_set_read_only(bs, false, errp) !=3D 0) { - bs_read_only =3D false; - goto fail; + int ret; + /* Hold the chain during reopen */ + if (bdrv_freeze_backing_chain(bs, above_base, errp) < 0) { + return; + } + + ret =3D bdrv_reopen_set_read_only(bs, false, errp); + + /* failure, or cor-filter will hold the chain */ + bdrv_unfreeze_backing_chain(bs, above_base); + + if (ret < 0) { + return; } } =20 - /* Prevent concurrent jobs trying to modify the graph structure here, = we - * already have our own plans. Also don't allow resize as the image si= ze is - * queried only at the job start and then cached. */ - s =3D block_job_create(job_id, &stream_job_driver, NULL, bs, - basic_flags | BLK_PERM_GRAPH_MOD, + opts =3D qdict_new(); + + qdict_put_str(opts, "driver", "copy-on-read"); + qdict_put_str(opts, "file", bdrv_get_node_name(bs)); + /* Pass the base_overlay node name as 'bottom' to COR driver */ + qdict_put_str(opts, "bottom", base_overlay->node_name); + if (filter_node_name) { + qdict_put_str(opts, "node-name", filter_node_name); + } + + cor_filter_bs =3D bdrv_insert_node(bs, opts, BDRV_O_RDWR, errp); + if (!cor_filter_bs) { + goto fail; + } + + if (!filter_node_name) { + cor_filter_bs->implicit =3D true; + } + + s =3D block_job_create(job_id, &stream_job_driver, NULL, cor_filter_bs, + BLK_PERM_CONSISTENT_READ, basic_flags | BLK_PERM_WRITE, speed, creation_flags, NULL, NULL, errp); if (!s) { goto fail; } =20 + /* + * Prevent concurrent jobs trying to modify the graph structure here, = we + * already have our own plans. Also don't allow resize as the image si= ze is + * queried only at the job start and then cached. + */ + if (block_job_add_bdrv(&s->common, "active node", bs, 0, + basic_flags | BLK_PERM_WRITE, &error_abort)) { + goto fail; + } + /* Block all intermediate nodes between bs and base, because they will * disappear from the chain after this operation. The streaming job re= ads * every block only once, assuming that it doesn't change, so forbid w= rites @@ -310,9 +327,9 @@ void stream_start(const char *job_id, BlockDriverState = *bs, s->base_overlay =3D base_overlay; s->above_base =3D above_base; s->backing_file_str =3D g_strdup(backing_file_str); + s->cor_filter_bs =3D cor_filter_bs; s->target_bs =3D bs; s->bs_read_only =3D bs_read_only; - s->chain_frozen =3D true; =20 s->on_error =3D on_error; trace_stream_start(bs, base, s); @@ -320,8 +337,10 @@ void stream_start(const char *job_id, BlockDriverState= *bs, return; =20 fail: + if (cor_filter_bs) { + bdrv_cor_filter_drop(cor_filter_bs); + } if (bs_read_only) { bdrv_reopen_set_read_only(bs, true, NULL); } - bdrv_unfreeze_backing_chain(bs, above_base); } diff --git a/tests/qemu-iotests/030 b/tests/qemu-iotests/030 index bd8cf9cff7..c576d55d07 100755 --- a/tests/qemu-iotests/030 +++ b/tests/qemu-iotests/030 @@ -278,12 +278,14 @@ class TestParallelOps(iotests.QMPTestCase): self.assert_no_active_block_jobs() =20 # Set a speed limit to make sure that this job blocks the rest - result =3D self.vm.qmp('block-stream', device=3D'node4', job_id=3D= 'stream-node4', base=3Dself.imgs[1], speed=3D1024*1024) + result =3D self.vm.qmp('block-stream', device=3D'node4', + job_id=3D'stream-node4', base=3Dself.imgs[1], + filter_node_name=3D'stream-filter', speed=3D1= 024*1024) self.assert_qmp(result, 'return', {}) =20 result =3D self.vm.qmp('block-stream', device=3D'node5', job_id=3D= 'stream-node5', base=3Dself.imgs[2]) self.assert_qmp(result, 'error/desc', - "Node 'node4' is busy: block device is in use by block job: st= ream") + "Node 'stream-filter' is busy: block device is in use by block= job: stream") =20 result =3D self.vm.qmp('block-stream', device=3D'node3', job_id=3D= 'stream-node3', base=3Dself.imgs[2]) self.assert_qmp(result, 'error/desc', @@ -296,7 +298,7 @@ class TestParallelOps(iotests.QMPTestCase): # block-commit should also fail if it touches nodes used by the st= ream job result =3D self.vm.qmp('block-commit', device=3D'drive0', base=3Ds= elf.imgs[4], job_id=3D'commit-node4') self.assert_qmp(result, 'error/desc', - "Node 'node4' is busy: block device is in use by block job: st= ream") + "Node 'stream-filter' is busy: block device is in use by block= job: stream") =20 result =3D self.vm.qmp('block-commit', device=3D'drive0', base=3Ds= elf.imgs[1], top=3Dself.imgs[3], job_id=3D'commit-node1') self.assert_qmp(result, 'error/desc', diff --git a/tests/qemu-iotests/141.out b/tests/qemu-iotests/141.out index 08e0aecd65..028a16f365 100644 --- a/tests/qemu-iotests/141.out +++ b/tests/qemu-iotests/141.out @@ -99,7 +99,7 @@ wrote 1048576/1048576 bytes at offset 0 {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "job0"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "job0"}} {'execute': 'blockdev-del', 'arguments': {'node-name': 'drv0'}} -{"error": {"class": "GenericError", "desc": "Node drv0 is in use"}} +{"error": {"class": "GenericError", "desc": "Node 'drv0' is busy: block de= vice is in use by block job: stream"}} {'execute': 'block-job-cancel', 'arguments': {'device': 'job0'}} {"return": {}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "JOB_STATUS_CHANGE", "data": {"status": "aborting", "id": "job0"}} diff --git a/tests/qemu-iotests/245 b/tests/qemu-iotests/245 index e60c8326d3..432e837e6c 100755 --- a/tests/qemu-iotests/245 +++ b/tests/qemu-iotests/245 @@ -892,20 +892,24 @@ class TestBlockdevReopen(iotests.QMPTestCase): =20 # hd1 <- hd0 result =3D self.vm.qmp('block-stream', conv_keys =3D True, job_id = =3D 'stream0', - device =3D 'hd1', auto_finalize =3D False) + device =3D 'hd1', filter_node_name=3D'cor', + auto_finalize =3D False) self.assert_qmp(result, 'return', {}) =20 - # We can't reopen with the original options because that would - # make hd1 read-only and block-stream requires it to be read-write - # (Which error message appears depends on whether the stream job is - # already done with copying at this point.) + # We can't reopen with the original options because there is a fil= ter + # inserted by stream job above hd1. self.reopen(opts, {}, - ["Can't set node 'hd1' to r/o with copy-on-read enabled", - "Cannot make block node read-only, there is a writer on it"]) + "Cannot change the option 'backing.backing.file.node-n= ame'") + + # We can't reopen hd1 to read-only, as block-stream requires it to= be + # read-write + self.reopen(opts['backing'], {'read-only': True}, + "Cannot make block node read-only, there is a writer o= n it") =20 # We can't remove hd2 while the stream job is ongoing opts['backing']['backing'] =3D None - self.reopen(opts, {'backing.read-only': False}, "Cannot change 'ba= cking' link from 'hd1' to 'hd2'") + self.reopen(opts['backing'], {'read-only': False}, + "Cannot change 'backing' link from 'hd1' to 'hd2'") =20 # We can detach hd1 from hd0 because it doesn't affect the stream = job opts['backing'] =3D None --=20 2.25.4