From nobody Sun May 12 02:11:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1646336919; cv=pass; d=zohomail.com; s=zohoarc; b=WVBmgTR+ifjieAxjGjUVm5Zhi7gTIrVfHU9+XqC4ClBcR650GKfN/VZZoZ6hhCKEIJPKJDsQeestcIECU2iS9tjebuO42kqRFm5m8Ay+sQVhMg1b2dnjIMEQMtZF7FwgFIxGOzpIHZAt3vG5Cd51dTmSFDOFcIQ90u84SmwAC7k= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646336919; 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=ROBLmUnjTfEeaaULPZCviV08zafu2jajs93fHjc5LNg=; b=fuLwKXXnqr0kW9KM4mScLHJLW7FFuMeIXfxrB5wS/KxkqlQRi2HZVGuASyh+ZEpjqrnek5iifjVnNNuYLqwvva080meJitbJR3Tixx/C1p0Jm5hqfUAChncHVzzF8S/qcNMbOdjIGfqy0zvYPQGs/jX7pFGZN/ILJW+rIJyct7s= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646336919855449.8314708455431; Thu, 3 Mar 2022 11:48:39 -0800 (PST) Received: from localhost ([::1]:51108 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nPrRG-0003or-Sk for importer@patchew.org; Thu, 03 Mar 2022 14:48:38 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38944) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nPrMy-0003g2-Ll; Thu, 03 Mar 2022 14:44:12 -0500 Received: from [2a01:111:f400:7d00::72c] (port=28672 helo=EUR05-VI1-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 1nPrMw-0004Wu-S2; Thu, 03 Mar 2022 14:44:12 -0500 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by VE1PR08MB4736.eurprd08.prod.outlook.com (2603:10a6:802:a6::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.26; Thu, 3 Mar 2022 19:44:05 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::4545:8e0c:19c7:2a6d]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::4545:8e0c:19c7:2a6d%5]) with mapi id 15.20.5038.014; Thu, 3 Mar 2022 19:44:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JQbTkrb6z6b2lFwJjb+3iUB7XFCDa4alGB6JOk8nnA1hYWF6R5aYxcJb/YBnNqfPPXg3TWVyiF0G/NPvkizEiJsAs2WIEVhpYpn2zP9axsHmz9vCs6tP33/U5r3LBvzCzNZvam/Nz4oqNPkT1jPpodsKKCq01NM95fZ7KCNo1z4KoTqJHTxOdXfgz9fHvYNyp8pUVKTgHLFyGzP60u2EJEthcozV4bDSH6PPgElMpECWODloZDoRjaYy6yCyVfp0I13USjkoQg7cPnwy5VAqivvVOLmuroW8UZyxWQFNM7baXPbOCZMN9dmSak9o7aYC9v8sSHSsdBUFJV7Jx1NbRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ROBLmUnjTfEeaaULPZCviV08zafu2jajs93fHjc5LNg=; b=f0if0FrD2Rq0dNVXMxc/TbXBUrSrD0qqzqqA4Z5OroHwX7fwmwmbPBOKTA0xIWJrG/VBzGGW4JQwq1LKcJvX+k4t3LwR02mavA8idRbzPDS1aFaiISqVRIOjyB0fup4NSSKc4KT9sU3P6GYBYQQJDVRzUmwX+vb8gUIvFK+HJ8/5lbYHjFtVvT9H9ez3pGz/s725On6DJhaR/lSJXSA1cjyCrJIY57k0YzPT5KT1/9xAukzhDZAiYndu5HcB1XeojhHbHwGd+3pWaTpBvY5a3zVsKc9N5djsAmQvVl23RLX3hJ+k9C+mbwC7AMKsk8p4hA7ITeMm4N1drQQh05CMxg== 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=ROBLmUnjTfEeaaULPZCviV08zafu2jajs93fHjc5LNg=; b=BNeX4YrfPoSPfKJcnJJNxF4v9+Uk/V17IIvvKQPeBaFGFAFgzjiDz5tQA2bZRr7O0YfWoPYdjfzPHtqfP+DJl4ysM1mXKURGsmeWHEltWDv0emdc6hvjGp0ROo7aZ7NiR6oPIqGuEUjs9T6vP83iyEVXQro7+yc3UHloJ3l3UXE= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, armbru@redhat.com, fam@euphon.net, stefanha@redhat.com, eblake@redhat.com, hreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com, jsnow@redhat.com Subject: [PATCH v6 01/16] block/block-copy: move copy_bitmap initialization to block_copy_state_new() Date: Thu, 3 Mar 2022 20:43:34 +0100 Message-Id: <20220303194349.2304213-2-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220303194349.2304213-1-vsementsov@virtuozzo.com> References: <20220303194349.2304213-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: VE1PR03CA0038.eurprd03.prod.outlook.com (2603:10a6:803:118::27) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fee51d89-38a8-4d23-3407-08d9fd4e2ccb X-MS-TrafficTypeDiagnostic: VE1PR08MB4736:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Eo9u46HgJrTeJD0biXY8IEQa3uIB8JzxsWHy64g7ZvNS7Ve9J+i0W+pqigOTdjLWvYQohxUM3p0x1iYceabTAGO3R0xYr7cO8cXHpJagO8lOO3LLyi3EfZj2izlSr2HESLoUWamrBDvCNlrqHzXdCbWnp/RIBaGdRzdg/jM9CLdk9dhW19HLb0absr9YLbM+SFCy4uYIPa6tvCSP2ib/Jm4y26gBx0BwThQM00EVIoG+1d2EXRLyMZU5fDdwOIT2VF97EjFQmMstjA+A1auKE4s2hZyUTT9f31f/Cj/aoUsQz3+oNGdu0Jag4nth6LrPWwE+8E+NCWrhklbRWzbGI6cGCde66TdI717LSeaYbOYClgH1DvC2Obyzkow3ACAVrxB/RTHxMsoyIUGXi4EcC02LA7a5nFLC9aLVzKXrxMmuGk5z3xJgxAMq7b3ESGn8V3mg0P9QfT3XgnythpLyTIe3dQpl4p/glCTjjUX2aJL5Jmnm6KfAqdCkCD4j0IxjnGKxA1B/eOujXRxWurOHkgTGZTHTBiBch1qQfg2tNiCTxrv7hwZQrOO8f/buuB/zBGtdsppcwrtx0Lk2KGnvR0Z59qrEOhgHLb4fTzk4RA96rP7O7NygfFVT6lTfqZ568jVxgEqJPlT4YrNoJp5rrEQDxDf0ejpddvs1GxjGcledyf6NvQ2cdUVw/jkcDQA/+ImC34qnvYE5QIHMYSgdWQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(6506007)(6512007)(26005)(6486002)(6666004)(186003)(1076003)(2616005)(316002)(6916009)(508600001)(36756003)(4326008)(8676002)(66476007)(83380400001)(66556008)(66946007)(86362001)(8936002)(5660300002)(52116002)(38100700002)(2906002)(38350700002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?aRJ/K+i6fpiMZCyBoUvjX0wxXjOcLRPFxw9SVIm1ZBUQ0nKax7Z4VchRTemR?= =?us-ascii?Q?R36so6i/f7lNrVlDZyDNgdNf7pfl1N4LtDnMsE18o+z3BbARNyf9xHDhAGgc?= =?us-ascii?Q?Q4aVQJus8Opx4BALW9nFuYIJiPmMiKmDmz5wdc7HjYvXKouKWVkYWsf477iB?= =?us-ascii?Q?qXEIa5N4A3UGtJMocsOKWwnLbEW0SqazivfwInmHqvVoq/pqtW2CyE1KnB77?= =?us-ascii?Q?7Q+O70pIaDbTu052KJVcxD9fdwyrOQoFopTRGBrwnUyaGXhpKHoxdCXWZQk1?= =?us-ascii?Q?al9jd4t6z9NYZav/kX39MtuN8mOUssARHNcTmpPA9knSnd3w9dyk6XkLnD+j?= =?us-ascii?Q?QjSSrRF1kSypO15OX68g9SYniJvRmYqll+idZO4lfEPkqgEo4ehcVip4gN6g?= =?us-ascii?Q?WgzDA3ZZ+5T1/40l2wRBqvJLJnYY3l5IKm8WEBbrXQ/YOz4cVKoYR9bftPR7?= =?us-ascii?Q?Ua6vKnU627n7tzHxodpXaJkKSay+OZQEu6SU4ij61VUAxQxbadmuZ0Eu3DS3?= =?us-ascii?Q?XNslZhZ301s1VXIYltebvq80jBwpMoOCyEFoNUa+zepUV5zfY1W4Lr5HbWlK?= =?us-ascii?Q?ALsN5pojdXePlj2UcKzTE+7S8wz7e36mg9DwHbIqgfOBAACGxrFjfu8R+Vr8?= =?us-ascii?Q?q1M0Zf4N0vhbEMp2dJ2dCzk7qXp5i4ad8nHyncrlZUSh5nI4cmLGUo05IRjv?= =?us-ascii?Q?Xa1Iou6eEX8kzi3RLzqBS0qbIbQJROIqqojGqPM0naPO1UUKBBZEs2w5JLZ1?= =?us-ascii?Q?r6wqmWNxxGP5tS8DVAKIeD9LWKe4T56XIpyPZMHinJwUrGo7la40LrsB+Ld2?= =?us-ascii?Q?cePUpb9B1Aq6E89XEBZP7AJINXNC/G8wM9CR5Yqpt4tivopTvJgTTfW19KqT?= =?us-ascii?Q?RdNMEO1ezdiBdNalBh3tzVISDMeUUhRZEEAq1CvNr7DjJG5sva3WLGaH1GCy?= =?us-ascii?Q?EX37FrIw8Dz+qWnhwBBpEFr+g+uNazQNCCMouT4CESw/xaO3cHNJjGvQz04k?= =?us-ascii?Q?utL6OXXeIjC/GDsdA/8Wl6H/CVPymVWQNhFB8RIWpTYIaxXS+KpV8Y4rhcEN?= =?us-ascii?Q?tEwCD8jH6rT+8r9YY3XNPZTGN+P0PzXSKzGe7GE+VnjVdwwVLrQuzH5RBOL5?= =?us-ascii?Q?McJARnRQJfsPFemMLrd7A+3Lt31jA3exKFfNmd5mq2lhi0PFTURCg1cwpqUs?= =?us-ascii?Q?PelNipuEJtvLzkhSnO/CFwSsYDFDpEnzKzV40GlQPL6dsctLcLPATgssf4w5?= =?us-ascii?Q?w3KIxsYkKMiVaN5Gj2l5tR7lHKcqKB0kVAc3AKd9sytEdrs4vEAXDlUUkkUd?= =?us-ascii?Q?OhxCDHej+pr4V3TrXADyL3y0/VKwMBtcaZ0a9mgQxEfrBntF/T8DhOw3n40L?= =?us-ascii?Q?roua/anhM/+QFIBqrEELz7+/2hVQTLUq46QyJ70mE+p6dX3tim1KO8aHm/Ut?= =?us-ascii?Q?cBtz8iwIYoTnMLFBd7dqZ1YwG7a+5rnuepQJlKVAu86HAiWzszb7JGZl2M2j?= =?us-ascii?Q?RI8hhltLi0YxbEKLbo0XDTPXFbykFPklpARDS7NCILJWM/q8BHTYr28Kts55?= =?us-ascii?Q?ZNFbDCsfHoVteaBFbXRy1a+EWdsuHb15Oxn/y46htf3M2J/BVH4gupYUd+Tn?= =?us-ascii?Q?EpYeTodOqplKeDxDmyC4iE6gz7gFZLm8JVC4Np9nsiEHpK5mwznQBHcTyzAE?= =?us-ascii?Q?wppQwQ=3D=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: fee51d89-38a8-4d23-3407-08d9fd4e2ccb X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Mar 2022 19:44:05.1676 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: cKrksIFvbjfC+1Av2zdGE7js2g0iBouDpaoX29tQe+f4Gl1AOR10E5V+KbyfuN0mdvDO/DJ+dly/1pvsoHhG6xjncnc7rc2lFzLM0yCfg6I= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB4736 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a01:111:f400:7d00::72c (failed) 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=2a01:111:f400:7d00::72c; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1646336920511100001 Content-Type: text/plain; charset="utf-8" We are going to complicate bitmap initialization in the further commit. And in future, backup job will be able to work without filter (when source is immutable), so we'll need same bitmap initialization in copy-before-write filter and in backup job. So, it's reasonable to do it in block-copy. Note that for now cbw_open() is the only caller of block_copy_state_new(). Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Hanna Reitz --- block/block-copy.c | 1 + block/copy-before-write.c | 4 ---- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/block/block-copy.c b/block/block-copy.c index ce116318b5..abda7a80bd 100644 --- a/block/block-copy.c +++ b/block/block-copy.c @@ -402,6 +402,7 @@ BlockCopyState *block_copy_state_new(BdrvChild *source,= BdrvChild *target, return NULL; } bdrv_disable_dirty_bitmap(copy_bitmap); + bdrv_set_dirty_bitmap(copy_bitmap, 0, bdrv_dirty_bitmap_size(copy_bitm= ap)); =20 /* * If source is in backing chain of target assume that target is going= to be diff --git a/block/copy-before-write.c b/block/copy-before-write.c index c30a5ff8de..5bdaf0a9d9 100644 --- a/block/copy-before-write.c +++ b/block/copy-before-write.c @@ -149,7 +149,6 @@ static int cbw_open(BlockDriverState *bs, QDict *option= s, int flags, Error **errp) { BDRVCopyBeforeWriteState *s =3D bs->opaque; - BdrvDirtyBitmap *copy_bitmap; =20 bs->file =3D bdrv_open_child(NULL, options, "file", bs, &child_of_bds, BDRV_CHILD_FILTERED | BDRV_CHILD_PRIMARY, @@ -177,9 +176,6 @@ static int cbw_open(BlockDriverState *bs, QDict *option= s, int flags, return -EINVAL; } =20 - copy_bitmap =3D block_copy_dirty_bitmap(s->bcs); - bdrv_set_dirty_bitmap(copy_bitmap, 0, bdrv_dirty_bitmap_size(copy_bitm= ap)); - return 0; } =20 --=20 2.31.1 From nobody Sun May 12 02:11:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1646337110; cv=pass; d=zohomail.com; s=zohoarc; b=YU1za1VUfLzTTVP1yaeZVHMzKngZN6dCPrmju+Ncb9XDtA9bhXmCcg4928hP6rHGhXZuSYVtj40Bzzv0y0eKn+PrIn//4xzI/usNtn1Se+CZyimj1YJWBjV3GtOUC/jirfepAA0Ah22x9GKLn8A0uYUOoM640vrj1xXMLbvJtCs= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646337110; 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=rYCkIsx9+bhwl6XDNZ+n+3c2V2cwQDr4V3HIXM5vypM=; b=F5lQ43fupoKEybxfwzoo9YiaQ1srlnQ1UjCTfMQMU47GLpyrJbP7+gr/ZMIWUOt0cL67y6HjSgzVvGnPGjbwsyu3jQWQZtmyEh4NKJUaBYT97fkcHkFozeqKenBDJ+Z04NuoDFdovfqtgMvEjCsK7AxGckzs0CIsd7DGQRv/LYI= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646337110372371.06958741644735; Thu, 3 Mar 2022 11:51:50 -0800 (PST) Received: from localhost ([::1]:59602 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nPrUL-0001Ec-BD for importer@patchew.org; Thu, 03 Mar 2022 14:51:49 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38958) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nPrN0-0003jg-FK; Thu, 03 Mar 2022 14:44:14 -0500 Received: from [2a01:111:f400:7d00::72c] (port=28672 helo=EUR05-VI1-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 1nPrMy-0004Wu-Vq; Thu, 03 Mar 2022 14:44:14 -0500 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by VE1PR08MB4736.eurprd08.prod.outlook.com (2603:10a6:802:a6::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.26; Thu, 3 Mar 2022 19:44:06 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::4545:8e0c:19c7:2a6d]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::4545:8e0c:19c7:2a6d%5]) with mapi id 15.20.5038.014; Thu, 3 Mar 2022 19:44:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qs4r8XSiXb5/tuVxVTpqCPl7Ksijt3KjNOjLeqdAq8fyMD48tau/cIkmNpdHIcmkoyqSWcchKJX+m4UxtHY9DXkq+YQaNPQ7C3rUoospGETD92HadiJ3gt6aBl/V03CZ62mPYh7FxmRk5Wc4rG9K++LkxKa9e4wU+DHIzhte8ubLKDyCCjf6Z8u1BvO4jR0JMc2Cm6zieS3oU/5E9+j4vMBwIC/iu75N1MWs2DFSSwoAfFKLxH6PjKN8bhk0ACEvpBVgMl6Ow4vrWbf5NomgEqRWECuBYr/Oc4nGJ/vXBO7UzIAGLJLZ4yY998ZgqPabnaXUXZqQv96spb11kQBzgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=rYCkIsx9+bhwl6XDNZ+n+3c2V2cwQDr4V3HIXM5vypM=; b=aUhQhbKzNuYYmPJL8+RBO4S2gNb+sd7X/aJqwULU1KBSlUffCoe1ioIdYXyPStSFguJBqicJmLU0Dl/J2Q8+mpbR2+shRKTBh2zlGHFoKzHOWRKWB+Q4WQHus3ZvE+lbNxm0zRPCoHNcSFDHqRDcwddmwlEc2BDULaidz74i6Q3rVtM8Z+5RH+KpgVqtXaUjPgsMa9W1hfErvtWsPjXD0SE/e0RAF7Vj4Yh1ZaC4bHNkTPhHeR1hLYutMpbUwe6+Nh0uKgyE9V2prMLycmnFV5AP90DiR6psUoYruwJsnbxzKiOvsgRjzSe3CfLVpJsFYu+70xKXwh0Uay94Uh44QQ== 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=rYCkIsx9+bhwl6XDNZ+n+3c2V2cwQDr4V3HIXM5vypM=; b=QBPRa/rGh2JPpH4189bAvqE0xtvZeEAkBDWOocJqgMPS+l/yRz/vbrIYIaly0K6KeaSMIkGlNRFtC3oQYFu7+jAwh3hHjtHV23U+9TGYi1kq19ioCu86o8I81bEQXAO4Ip5+mtB5dMRuoeNGxMTEub38VXygMpNjiN0yGiAJcLY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, armbru@redhat.com, fam@euphon.net, stefanha@redhat.com, eblake@redhat.com, hreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com, jsnow@redhat.com Subject: [PATCH v6 02/16] block/dirty-bitmap: bdrv_merge_dirty_bitmap(): add return value Date: Thu, 3 Mar 2022 20:43:35 +0100 Message-Id: <20220303194349.2304213-3-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220303194349.2304213-1-vsementsov@virtuozzo.com> References: <20220303194349.2304213-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: VE1PR03CA0038.eurprd03.prod.outlook.com (2603:10a6:803:118::27) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f480e729-cd1c-47fc-8afb-08d9fd4e2d49 X-MS-TrafficTypeDiagnostic: VE1PR08MB4736:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qjUReXPXmtEXuj4cvS4NG2cbyK+kmTpedorHcCMqplwj76fVE8Z3szm1qN0cxscNXKOW+7/XN5O5LfmtYjxtTfE6rmlsYs/lgOYGq2KltK9PNLGiL0fhI8qadfLnIJZcEKj9np5z13mfotwR4f7UXwHoOpjWRI0CTSj2H/ZhXAYVWt7SzEF+ilHW/rgh3oNTJvRWEYjZXHr1Dg5Zg8BNvumB6QnJCMk1x56X559cW6r/Mz+FmJ9dgOT49oiIeXlpCcvEFdG5dhxmqvf9aU1SJnuIyxvhPIHWPHhJrLXd2P3byyFCyIO98547ZhNevgsyaL4ASTY+t09zS5k0wwIVtTgnG0ZxCiC7ThvUUXrZs8YC4uEotO/uDKvBdfBSqMpazr2JXh6SZ19Rry9p60XTF5tLKiDPAQkru6DGgdH0dnPobqtAtn5/YDqmFBmo24ZYb6sDhGJ9t352uOBIm7Q92FMjnQzNtLexDM2qjOskb7Xf8DquhWCpxs4IEoaIbrt93Y0qDk05R4eqybV1oYCMky89Ey/0DJby/nfOI3sY9SJJ6cAjgeSzwEWyJEVSbH0lmotLxZPC+wpBsStRs5aUeDslMaCOYL1bi/dngCttED3BDe11pCz10Eamki7qBgBarPlHH14giBTqYJ2xNOLfNXtP0tKppy2LZThyXmG+A/HdjVG8QXnvISMo2FlpnSJDK74ClNBUgrlNdJqQNNfvF751OwWLSc8swU3QbQOnC04= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(6506007)(6512007)(26005)(6486002)(6666004)(186003)(1076003)(2616005)(316002)(6916009)(508600001)(36756003)(4326008)(8676002)(66476007)(83380400001)(66556008)(66946007)(86362001)(8936002)(5660300002)(52116002)(38100700002)(2906002)(38350700002)(14143004); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?0FoPBLowm9zH5ZdbKjdhGnoGSV1ZAnh1jO2VhlZvm6pXLx2IRtNp2ZVIJCC1?= =?us-ascii?Q?Pgtsz5RQFYgHhl8RXV2VpVtLjKeb4VqGGBwAUtNAhY5QEBCAoDvwmy9QkmW3?= =?us-ascii?Q?GbNrjnnEc11i2rBVC39rOC5CMwpTPLzW4ORcLA79C7AQzpHjOwg9duodAD/F?= =?us-ascii?Q?ZMILBsVzU9oMdQMUfWUm7Fiq4dMKerta0rZ6SECg0TMvHlcQaQyJFNT4QBo0?= =?us-ascii?Q?ezgFgMByy0KKf4aaSYgSobgJ7GE7HfzaeWZdyA58YEok8Auxtit5UIEu0jpH?= =?us-ascii?Q?rDsmZGQzEvqctv0i/N8H0B1fpuBw/WUHL2JyKVfBK+C2erOK+21QIVr8iWWc?= =?us-ascii?Q?qiZ9tkBKWkC45cCd4agbslG5/4mrk8LTXCcdBfzOsmA3JaUEujxdJ0T/cK90?= =?us-ascii?Q?la4E5Org3bauCsTEYf46LZXLm70CKCA5JC7sFD+O7AaV8alGimmF247oWAiq?= =?us-ascii?Q?YlcBbj7vYtInbAwq1w6Lbf29eXuIlFASDH+5vVUy4isGS7usF9RLsGF0YboD?= =?us-ascii?Q?T7BBqPi/eiDJJwHCnEVh6pGMM7Bk+KQS+3Tthwl/LP0XYtDW3tTT9haEtL/g?= =?us-ascii?Q?bEQpmT6mSOY3OnnaZyI10LICt4g4EXCVkFL1ryN2I+QCaK8xmdW1XAZKtCY9?= =?us-ascii?Q?fCR4qaPyS7oJhkmXslhw3E9bD1QqCjFBTYxZ+tGttE0kj+htnjEZTH+jicJD?= =?us-ascii?Q?1gYKTG+VjkA3Jvbg1SK2YrORfmRsOcTIpiqMtgIc7AbqwqHri0XJnZ5hQ7l1?= =?us-ascii?Q?BeKmytLMyo2BF7utaBxmtV7KQSk6SjELcNGZ43GkLa9+ZmXJh7BgqwSslNHL?= =?us-ascii?Q?9knVpxS8GZzW9vUMjuJzqdq98Q7ka5TEvm2Mad4/1s01YHgTSPrRqzGrNMEt?= =?us-ascii?Q?mIlLknpu45lTj7wnPvtmpasMdXUcdHGkPhndtrxK/Fk4E0/9iHn/fLUUAJux?= =?us-ascii?Q?IDG+XZaTPGHWsZzf1zWvuGSHIbmpV6LrlAM7EZFbU6dag3zaIufZ+ftPcIiN?= =?us-ascii?Q?ClqOSz8z40vVsqDiI4kBpwdtuAI7iFhP/Ua7Y4cn6fguYXJnQDUic/KivSHc?= =?us-ascii?Q?LPGptvkXjM5onoOMuZQ5xiDZg4af3tsbF1AuXhpE4NJTcfjFj9VN8ubscQ4b?= =?us-ascii?Q?TzUVF8kmqo1eOhjgMC4SDS5CQ0588u2qSTnynBUr1DiAu1fDwJ5R0c1uTrjD?= =?us-ascii?Q?nUMB4a7Lce3SfvWgthEqdKvcfYkYvxqMwsJk/qEsSax6oOwlGxPGATydph5w?= =?us-ascii?Q?5l6m1DX8awUWcyebpNG6WoXukM5JLo39llxtdDMyrDWoDSYc99IVr58roRH0?= =?us-ascii?Q?eayvT2IbzYg6owWr1Q6qWip+VX/k2HVEPSFGZHxWHQsleZpZYkAMy4aZ/wEC?= =?us-ascii?Q?IQz56fqW4wfvId3IZGVT+ZgGQbh5xesqpHpx9TYqFMikytqjWr32gSmeQqY5?= =?us-ascii?Q?sPru7LP5XFxd7LKnJQ/m9yAzwHmLzHBTi8uW0eoaU/chxXDP6EVr48OsKV61?= =?us-ascii?Q?MYSHxB3XZBJdpzFSLK8kRHezCXV05t6WkaSeH3+53k0r2tKQNO2vF3pJYd/P?= =?us-ascii?Q?1iHFBX6tA6dTYfrjN0/dWbHW4sZ3zeIkRVLN1gApSu+aT4lYUySo70484ckg?= =?us-ascii?Q?ZMBiBnjRMWHr1TCCiFsLkpEOoky4Mv2qbB8/ejkKQr5A9HQC3vjRuLPsMqam?= =?us-ascii?Q?7/IvIQ=3D=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: f480e729-cd1c-47fc-8afb-08d9fd4e2d49 X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Mar 2022 19:44:06.0112 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: mDWdrNe+/2+Gn58MoUWNjRoymGWwZrfgp9SWTsH4abRaV2i3z3Asmr0NHQIcuoASNUAmpSqT4j3kMjsTxohXUcd8PtjNRgBOApucfqcxrUI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB4736 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a01:111:f400:7d00::72c (failed) 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=2a01:111:f400:7d00::72c; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1646337112255100001 Content-Type: text/plain; charset="utf-8" That simplifies handling failure in existing code and in further new usage of bdrv_merge_dirty_bitmap(). Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Hanna Reitz --- include/block/dirty-bitmap.h | 2 +- block/dirty-bitmap.c | 9 +++++++-- block/monitor/bitmap-qmp-cmds.c | 5 +---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/include/block/dirty-bitmap.h b/include/block/dirty-bitmap.h index 40950ae3d5..f95d350b70 100644 --- a/include/block/dirty-bitmap.h +++ b/include/block/dirty-bitmap.h @@ -77,7 +77,7 @@ void bdrv_dirty_bitmap_set_persistence(BdrvDirtyBitmap *b= itmap, bool persistent); void bdrv_dirty_bitmap_set_inconsistent(BdrvDirtyBitmap *bitmap); void bdrv_dirty_bitmap_set_busy(BdrvDirtyBitmap *bitmap, bool busy); -void bdrv_merge_dirty_bitmap(BdrvDirtyBitmap *dest, const BdrvDirtyBitmap = *src, +bool bdrv_merge_dirty_bitmap(BdrvDirtyBitmap *dest, const BdrvDirtyBitmap = *src, HBitmap **backup, Error **errp); void bdrv_dirty_bitmap_skip_store(BdrvDirtyBitmap *bitmap, bool skip); bool bdrv_dirty_bitmap_get(BdrvDirtyBitmap *bitmap, int64_t offset); diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c index 0ef46163e3..94a0276833 100644 --- a/block/dirty-bitmap.c +++ b/block/dirty-bitmap.c @@ -880,11 +880,14 @@ bool bdrv_dirty_bitmap_next_dirty_area(BdrvDirtyBitma= p *bitmap, * Ensures permissions on bitmaps are reasonable; use for public API. * * @backup: If provided, make a copy of dest here prior to merge. + * + * Returns true on success, false on failure. In case of failure bitmaps a= re + * untouched. */ -void bdrv_merge_dirty_bitmap(BdrvDirtyBitmap *dest, const BdrvDirtyBitmap = *src, +bool bdrv_merge_dirty_bitmap(BdrvDirtyBitmap *dest, const BdrvDirtyBitmap = *src, HBitmap **backup, Error **errp) { - bool ret; + bool ret =3D false; =20 bdrv_dirty_bitmaps_lock(dest->bs); if (src->bs !=3D dest->bs) { @@ -912,6 +915,8 @@ out: if (src->bs !=3D dest->bs) { bdrv_dirty_bitmaps_unlock(src->bs); } + + return ret; } =20 /** diff --git a/block/monitor/bitmap-qmp-cmds.c b/block/monitor/bitmap-qmp-cmd= s.c index 9f11deec64..83970b22fa 100644 --- a/block/monitor/bitmap-qmp-cmds.c +++ b/block/monitor/bitmap-qmp-cmds.c @@ -259,7 +259,6 @@ BdrvDirtyBitmap *block_dirty_bitmap_merge(const char *n= ode, const char *target, BlockDriverState *bs; BdrvDirtyBitmap *dst, *src, *anon; BlockDirtyBitmapMergeSourceList *lst; - Error *local_err =3D NULL; =20 dst =3D block_dirty_bitmap_lookup(node, target, &bs, errp); if (!dst) { @@ -297,9 +296,7 @@ BdrvDirtyBitmap *block_dirty_bitmap_merge(const char *n= ode, const char *target, abort(); } =20 - bdrv_merge_dirty_bitmap(anon, src, NULL, &local_err); - if (local_err) { - error_propagate(errp, local_err); + if (!bdrv_merge_dirty_bitmap(anon, src, NULL, errp)) { dst =3D NULL; goto out; } --=20 2.31.1 From nobody Sun May 12 02:11:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1646337275; cv=pass; d=zohomail.com; s=zohoarc; b=QQtxiOxf0mum0dLxiHVEf8f5NH0E9SVoaD/1hSgt3oLbng2TcRqKY0qxG1J4vbIkQk5Sr5ovfApF3OKHxrdWRHwqwK35SVCRI6JVa/TjznIQ6F539yAhD84ERCT/Vy6qzJgzBWkQU2Qp+6vyDBfs7DTLsJAvw0/3OEparU0jz0s= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646337275; 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=NmMZWPsXy6sCn/KTx0rcRRhgXC50lQ65Ci4s+q4S0Dk=; b=OViNe5vM1RPnpOBqWL5LlzUCuRrk7wY882yOHwkKdzu/iLko+VnGMea5pLh6ZiJPcRNhtnNjr13v8zn62XiDwlzHRUt5wpJm2QP2VU86ZyLfKFTEFeK/a312jmss8Y+vjeH5w3kSLblwtEDl1RNDGnIzJ4Sw8b5IimMHaJPsyUs= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646337275296282.96133317584054; Thu, 3 Mar 2022 11:54:35 -0800 (PST) Received: from localhost ([::1]:38318 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nPrX0-0006PH-4B for importer@patchew.org; Thu, 03 Mar 2022 14:54:34 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39002) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nPrN6-00040P-Fk; Thu, 03 Mar 2022 14:44:22 -0500 Received: from [2a01:111:f400:7d00::710] (port=7585 helo=EUR05-VI1-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 1nPrN1-0004Xj-5Y; Thu, 03 Mar 2022 14:44:20 -0500 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by VE1PR08MB4736.eurprd08.prod.outlook.com (2603:10a6:802:a6::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.26; Thu, 3 Mar 2022 19:44:07 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::4545:8e0c:19c7:2a6d]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::4545:8e0c:19c7:2a6d%5]) with mapi id 15.20.5038.014; Thu, 3 Mar 2022 19:44:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WNogrxWS0M2g0uLmbIQaFAXs63Fter1QPD0z8W2A1Joy9iXt0HYdnvaxfctwxDd9nF1i2CxYh43c89oTcLnG4/y88CyQHBlDzMnvVu4Iqs9ucU8vMahHFs5mI2E/d55D8QXl9ez+28TGMGrLz3s/pZX1E7R9tNlDXvnbO66lcG5S4C2yJh9y22YTqjdpXBE3eaUBHaSSFZFX/QBSZISf61RrtTUq5k0G68bAG4qCEFkf6xs2f21VJoHsfJ0JBPDikekOhfVVj6lIyyI2hnnFvghxQR1/YxjfIvwAomBlsJwuKcb0X2T4azQ7kO+3daNU0l1umd1tQrltmAnbad8sYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=NmMZWPsXy6sCn/KTx0rcRRhgXC50lQ65Ci4s+q4S0Dk=; b=cCjdHYSNZGU7099yIA/6wIF5lGZYWKHCDw5mpRLdOzJPC88Oe750pQX22Il1mNJpnrQVQrRktGDvWjlkIFwpuVPBFNqrUdO8QLh8ytaDw1xXmrPg2+7ZlVtZamzCAzwx5PaLb2ZwKui6k/lvbkCXsJCur2JwhJH+rIPXOqvQ4/V2iBnmQ8znaqhVOG4mx9TYo/ybSccUvUQR3w7WwSfVmAhFntaT77dTpQyqbpQyDTft33ZWGL6uDZVetpGOfS6nFk7CGl69cgQnuRG2xPQFHfm6FNKPkeOkkpYP0dfQsiR95wP+5bAT4Zf3NLCtKPGSstZTFB1BH0yeo5KdAyD0QQ== 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=NmMZWPsXy6sCn/KTx0rcRRhgXC50lQ65Ci4s+q4S0Dk=; b=ZXCtrIM32sqEwTDXrkz2oMCKsO6DAo4CRCvNAcAm8mA1HUzqjZ6JEYBif9rN3vwESF9em3uCZ7t+VTzh9Cwpc80u7t8UIYD4rxlZp05qzpczljgz2y7ca8+IGYllgzpuHyTv2hwuFEy2bR24Tiu0etlHw4pfI92JWLMZ5Ax6cZ4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, armbru@redhat.com, fam@euphon.net, stefanha@redhat.com, eblake@redhat.com, hreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com, jsnow@redhat.com Subject: [PATCH v6 03/16] block/block-copy: block_copy_state_new(): add bitmap parameter Date: Thu, 3 Mar 2022 20:43:36 +0100 Message-Id: <20220303194349.2304213-4-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220303194349.2304213-1-vsementsov@virtuozzo.com> References: <20220303194349.2304213-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: VE1PR03CA0038.eurprd03.prod.outlook.com (2603:10a6:803:118::27) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5e784927-8c28-4b6d-1ef6-08d9fd4e2dc3 X-MS-TrafficTypeDiagnostic: VE1PR08MB4736:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0z3OdpCiVODHMp+Pi8ghuFzap3nqexBjI6B/iGErSBE4pSVn0pjn+e8GjCLgc1NpXsLeUsylKORWyhfl+Kt1kk5HpMnD7fGi+lqt7WTYgmfEDLUxUd9bLN0mxzs5N/arY1aDkqHLFzZ7HC2djEhqzgGzaiiniCTEd+MsuFHcH5Cysrro7VZT4hTqwrVgwb5sHBwce5EsU0G6eDgrjmGDYjaLj62Q0oKFyIv82uzMDvLln6OFfWWA4LB/xYc5xnaepb6WPF/nVjYE+/oQcqMKtRj8/TF2nL9UKnJMTlk2YK8P7lj03oxnSome8qh402JxXjjxKubVr2Rt7ekfPLtOdq1fl4UPbkyvBjiUjkaT4VdDDzeg9RgPNaq/X1CKezBbSgCqeEXZLcAPusTTRQVX+02l89iFMCM5bbm0n8bG5rhMIsLgt6qkx9tvfrwXiibLZq95pCydxOtd5QUQ6+eNe7BriypCJH0az9fgifX1ASb9PLLFDkEE1dTkjAgxXzbuggh2vpax1ioEyRdCd7jJiJFv9ne/553w+K/sxDmx1pW6aCDSyPcBEGtTbRwkundvfD6x3xZY4OuhmFGtzm1Oxlw/TsTCPZAe2h2KCM5UtGRpAOmZ1h/IEXYj3Br19jDdDo6wMMsKQJQFkq0xUnodGAdLfLeARboSUu0g93sr6FL0HbrYKMtpHRta+UacS2KGdLGWPnf4PgQzAPkh5vZ4RQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(6506007)(6512007)(26005)(6486002)(6666004)(186003)(1076003)(2616005)(316002)(6916009)(508600001)(36756003)(4326008)(8676002)(66476007)(83380400001)(66556008)(66946007)(86362001)(8936002)(5660300002)(52116002)(38100700002)(2906002)(38350700002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?CjU+mlrkQID4Z4WXDg9b9is7GBbSrioo+1f9VK9JMacf1QRW4E77YsbroYKp?= =?us-ascii?Q?rCsHPU6LUhK+CfSI40buj7VyfDCw00g0YhvZGMoLq5MzaQWj/5aSMnUKjZL6?= =?us-ascii?Q?fJNaTooMJqhdaTl/8wewMDOrKQ6tntJBrIbJhu9ni/wKyr72U1pACwv6UAil?= =?us-ascii?Q?FNi5DwwD2roeX6FYnFWEQ0Xk2qrZ/+zX7+EZwrMQZy3CKI5GtlXb46aZvh7L?= =?us-ascii?Q?YAhTdEBspB7dMPn3HGksHi+uDxtENI74ApMePKuDF5TEvI49zgesjIEEApoF?= =?us-ascii?Q?/5J992x8BhRhAHLmNvRf5OCMOLHuVQ3BDbOTi7NqROUKDBfSFX7HAakjd/Ay?= =?us-ascii?Q?3Du4j0NRaOqa2XJMG8aiyKcLbcqDH1bVpDkEz8H+j2IwYzcB4wl2aWcBGIR0?= =?us-ascii?Q?4fPDAaK3XOLQNkIINmvJ/zCanJ0CQQiTnlkGwsHfdhuF3zi8Bp0t4U3nJ3Lj?= =?us-ascii?Q?9Ql7Sc+kyZMmvAP9XXwTaPTbtxMbBm4RdWteyBugEwlEG8STgiQr5aVPeO8p?= =?us-ascii?Q?Qe1pb/es9+uQj02o6J9NpQr4+9qV+qVkLxd10hW06HQ7k98HDwvzDdOW+QtJ?= =?us-ascii?Q?FolbD3ZdBa/41ilBW6H3fZGRjJehYCtGNFPAbOq74VoQBSrpwhXe+8bWPkCH?= =?us-ascii?Q?eybn6bpeLpYp0YdrNECQyaNkRYpoH0JuO2HBouEIazMyecbPGJYPLdR21MJb?= =?us-ascii?Q?KzKEZWM4TIgS9Y7mKziJhzK9tTB/hCBr6/zCRGZHIRnCR02dav+uXBnZDua1?= =?us-ascii?Q?ZcNl386S5c03esVLW/0t+Zh/b3qn0HKI3eel5zWcakirQbM2KQnBPrt8NGli?= =?us-ascii?Q?/K8LlFmV/mxgTgkLqaajIq3h9lMkNDOw1I3iCVpS0D/3zkn9IBXVxlHdWvBM?= =?us-ascii?Q?6wQ7+19d1LhI02JGlPnDw8FZ6SH31cyjisYaq6kou7nAaWPPYTU3WG530bZ6?= =?us-ascii?Q?OKeBy2fY1ULvdOW8Ud0srdv39fKF4H4UczR/ThpnPaQKss9DuioQWPRbxF2Q?= =?us-ascii?Q?eQdYiO3D75buNYCOQpRxELyT9Y78p6/qvZQFa+H8iTOAN8bZbBHEJ+ec9rcZ?= =?us-ascii?Q?t55Xev3RZT9EO+rbtkYUY2uc2Z9gFkaFfaVuX+Z1aRmlvT1WxIKrHTYeG1Nx?= =?us-ascii?Q?C0l33dmk5cmOS27ITT2zrcaJ8lvlWOT1RQcIfd1Pi0U4GAJBbONZnEvQyB6h?= =?us-ascii?Q?DNOf4CkhQBeCe7WuAXrU9L6VPQFfSa4Ndzv10fXjne6tZvkpXnAyeJxaLIG4?= =?us-ascii?Q?N5ya+6F8iAMjWF/nPCpaYBg/PSDBOyi4ZCghOYHYKoTvEidh4hHj+AusilOf?= =?us-ascii?Q?IbkNVQqcmVaIV/Ncr5YdchnKXqDXfFAcNWiu+K8NR2cmsyq7RGsu+9ksdw3U?= =?us-ascii?Q?689GLxtIR+70wNTSD7Kz3yBuhUSN6ZsCcRjLPtTbznq08ETRNqrqAm3QjoAd?= =?us-ascii?Q?vBOECF4e9XZXEwR400tARkWXfLq49vQPPHJaq0mgTBxQSX6gHkB1bqT42pSk?= =?us-ascii?Q?O6RgViIUxeJ1mDCAro4iW60sfyqKX/Afp8V5Zi6oiXqZLZQLGbH5h5FWFky8?= =?us-ascii?Q?XRnUcG6uTopkNpmtpl9VKMNbhnmmgTTqCX0KaGrHfannFEXG0Pu8v9+Ss4/F?= =?us-ascii?Q?S/C7LwMJTlX0SZOHiPAU1CleJs8FqmBNKVFWjW7Wi1XVHOiSPbxTMKdGDexp?= =?us-ascii?Q?t16wfg=3D=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5e784927-8c28-4b6d-1ef6-08d9fd4e2dc3 X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Mar 2022 19:44:06.8080 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: tnwqFoGd6/unmX8LUB9DsSx0n94ELLTCJ+TLyBjX717mS/TQlU0bsuSE56ovBZRYJl1PMPfu3SaMf+0pOuFWWuFlgoCmcuGGerS1pjCQWOQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB4736 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a01:111:f400:7d00::710 (failed) 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=2a01:111:f400:7d00::710; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1646337277432100001 Content-Type: text/plain; charset="utf-8" This will be used in the following commit to bring "incremental" mode to copy-before-write filter. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Hanna Reitz --- include/block/block-copy.h | 1 + block/block-copy.c | 14 +++++++++++++- block/copy-before-write.c | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/include/block/block-copy.h b/include/block/block-copy.h index 99370fa38b..b80ad02299 100644 --- a/include/block/block-copy.h +++ b/include/block/block-copy.h @@ -25,6 +25,7 @@ typedef struct BlockCopyState BlockCopyState; typedef struct BlockCopyCallState BlockCopyCallState; =20 BlockCopyState *block_copy_state_new(BdrvChild *source, BdrvChild *target, + const BdrvDirtyBitmap *bitmap, Error **errp); =20 /* Function should be called prior any actual copy request */ diff --git a/block/block-copy.c b/block/block-copy.c index abda7a80bd..8aa6ee6a5c 100644 --- a/block/block-copy.c +++ b/block/block-copy.c @@ -384,8 +384,10 @@ static int64_t block_copy_calculate_cluster_size(Block= DriverState *target, } =20 BlockCopyState *block_copy_state_new(BdrvChild *source, BdrvChild *target, + const BdrvDirtyBitmap *bitmap, Error **errp) { + ERRP_GUARD(); BlockCopyState *s; int64_t cluster_size; BdrvDirtyBitmap *copy_bitmap; @@ -402,7 +404,17 @@ BlockCopyState *block_copy_state_new(BdrvChild *source= , BdrvChild *target, return NULL; } bdrv_disable_dirty_bitmap(copy_bitmap); - bdrv_set_dirty_bitmap(copy_bitmap, 0, bdrv_dirty_bitmap_size(copy_bitm= ap)); + if (bitmap) { + if (!bdrv_merge_dirty_bitmap(copy_bitmap, bitmap, NULL, errp)) { + error_prepend(errp, "Failed to merge bitmap '%s' to internal " + "copy-bitmap: ", bdrv_dirty_bitmap_name(bitmap)); + bdrv_release_dirty_bitmap(copy_bitmap); + return NULL; + } + } else { + bdrv_set_dirty_bitmap(copy_bitmap, 0, + bdrv_dirty_bitmap_size(copy_bitmap)); + } =20 /* * If source is in backing chain of target assume that target is going= to be diff --git a/block/copy-before-write.c b/block/copy-before-write.c index 5bdaf0a9d9..799223e3fb 100644 --- a/block/copy-before-write.c +++ b/block/copy-before-write.c @@ -170,7 +170,7 @@ static int cbw_open(BlockDriverState *bs, QDict *option= s, int flags, ((BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP | BDRV_REQ_NO_FALLBACK) & bs->file->bs->supported_zero_flags); =20 - s->bcs =3D block_copy_state_new(bs->file, s->target, errp); + s->bcs =3D block_copy_state_new(bs->file, s->target, NULL, errp); if (!s->bcs) { error_prepend(errp, "Cannot create block-copy-state: "); return -EINVAL; --=20 2.31.1 From nobody Sun May 12 02:11:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1646337145; cv=pass; d=zohomail.com; s=zohoarc; b=RGCM1BT8sqrT4NguY1zB9m0FIDYnC9ZQaF737kFISK3ZmA2EkfTubkVae0WIA9mRh1vkBTcBVzwBQ+ECH4/FUG4KOVCujMmscAPvvjZ29rXgaNlV9yvHz5NJ40PC5QAcZu+G5kw8q9S6IK41o5KQyOX6hbz+BD1pJXBiU1Hvg80= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646337145; 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=nQJuR97fa6FiCUtWQahNlOBLFee18TTvSO1rbHVvPVw=; b=IOwNGQ1ptjpI7qsUKF76OBYNeuVzOMvwbY1bC2iGZg21JK2c5NAKdnnECakwf3yWWyuduTm7P4FIKorxiSh2rBxB2zEcMQ6qTTwzDzWsb59njxi2MJSGtP8cSNfjXPzIby1YOO5vShWtwOUiFwcxRxEHUuVxNQgaD9j5s45w5XE= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646337145865694.199423524701; Thu, 3 Mar 2022 11:52:25 -0800 (PST) Received: from localhost ([::1]:60476 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nPrUu-0001pQ-BH for importer@patchew.org; Thu, 03 Mar 2022 14:52:24 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39000) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nPrN6-00040O-Fr; Thu, 03 Mar 2022 14:44:22 -0500 Received: from [2a01:111:f400:7d00::72c] (port=28672 helo=EUR05-VI1-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 1nPrN1-0004Wu-3H; Thu, 03 Mar 2022 14:44:20 -0500 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by VE1PR08MB4736.eurprd08.prod.outlook.com (2603:10a6:802:a6::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.26; Thu, 3 Mar 2022 19:44:07 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::4545:8e0c:19c7:2a6d]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::4545:8e0c:19c7:2a6d%5]) with mapi id 15.20.5038.014; Thu, 3 Mar 2022 19:44:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cE+bC0DrmokZu0vp3f2Y3bCovjh8B2QVWQ14wAyVYEIzRfxODlgPb7Vy3u1f2b1bUzuFVKqGkIFSwtTf8W+8uQWM+Lyk8tjVDQEP0SBP3NGUqGfaJrcjv+r6P6iw61UaD57V8cPqJSla8MiNthg1SFEOA5sXwpB3sDbg3fQ35aOI5X0WJp1sMKkCn4XYiWYKwyi6MgH8cuZF40MoWci6qlUg021Y0VC0EW3zpom8Y3+N47yUgAkyeFMsSbXIjsHoIn6Nmv+idVEVPzIKsh+BAB0PCKGftXAb6L5aBAsxVJPZpWuKUfAxvYdCeNLg6jN10eWLl2N3+rn68mzGcj62ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=nQJuR97fa6FiCUtWQahNlOBLFee18TTvSO1rbHVvPVw=; b=LTkPpqqPhw9dsqsk0MCyuubyKQ1k5RLrooqBs2KwPqTYtNdo+3WJ3en2cPuFFTtwxN03dayfb//XD0Pj07oy2Dy6KWOBL4msHA8LFode18ocDOrQ89mpGamDcANPiiE2IoMuhAF8iWRHWS41a9PW78Zteg/rMKr+HIvjJd5xM/cZPOlnne0+VOGdP7b/F3puxaNyvD1XxUn0iVWhHOuoafFDbvXSh6G83vj+QuCElbzfs24KcgDth4thXqE5CMFJ3OM0LQfmENxEq4EkBSa+MlePIqsX8LhDEjc5A+oqlW+W5Ptjky/AVtiE57aaegrcWpw9cHBcqQ89+bdcummpFQ== 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=nQJuR97fa6FiCUtWQahNlOBLFee18TTvSO1rbHVvPVw=; b=RHfiSe8Mql1Ii1l2HFlhdn2tWsRrcdtY9uWJiitMR+sbP9+q8Eqa/5CrjDXqVaWnZEEX4S1kTDyME9DFd/YpBc00ymP9Il/cGmqTn5OkPBbe6boT1mxCn3XW+LJZf6HeQ8oNMFqtkwY4tnlfq1IXcRZjOla+a03ygPZnqTs90lE= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, armbru@redhat.com, fam@euphon.net, stefanha@redhat.com, eblake@redhat.com, hreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com, jsnow@redhat.com Subject: [PATCH v6 04/16] block/copy-before-write: add bitmap open parameter Date: Thu, 3 Mar 2022 20:43:37 +0100 Message-Id: <20220303194349.2304213-5-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220303194349.2304213-1-vsementsov@virtuozzo.com> References: <20220303194349.2304213-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: VE1PR03CA0038.eurprd03.prod.outlook.com (2603:10a6:803:118::27) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2090d477-ed9c-4ed1-4f21-08d9fd4e2e3a X-MS-TrafficTypeDiagnostic: VE1PR08MB4736:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CdIXyrhOQmu46KojViB/oDt5Qn2KuFin5+rIpQKhvSmy0+lRF5gsGOY1O8kcBEiAPOQ92uFdulAqnZfr9Ij4RU+3xmROKGOHO6qhUJ+4RX0pP485STEXDxTYKnpZSpyqfrbxuiFnYXQ3fGELwZ7hMDxy8SRzNQ+4DNCf5eglhFTKhh4jV4dOE0ydYIeMU8gZVfeQbjNutY5K10c2bHEbsl3rtLn58n94QtYADh9lWwoSxO01Ymc3AfGHKa2zetSiVVQs9sPCtMBSvYBdAyKtsIuyt6pluD6vzMx4YQUrBE5cmZFCubnLPItWDE/QNQtcp6U0l6TK9k7Ab5T5Uh/0C0zzTtUWr1G39Ak1OI96p1usCDiczJ3KsfbVlurOVp4qPAmGoB6ZcKNIw7SJOIb6JKxAtTSpMd8osMDRqvcosA7y0+7nnOJNllCVqcPcUTAc91a5OeWLoBYWecY8uHhzfFSKXykW/oeCtCU6Uo/sG/8TBjYMOGZwC8rhkyNiARCs4jks7UXSOsLKCLT1xTCVp+n9qGLx+X7JOv7bzYRwIGwtEjUe1nc5qJeFArgTNSTRr7w8/f4Hwi6IcpoATUs8lhBVK3eKeC/rMmrIbSiW5WvoZS/ajMvu7JJ320eVDjxQfc+keCpN30B6bcjnWHEU7lC4fOxrQJSm36sXFpu35LjKRAuhzpyA2ls1oiSqL5gfUyFqfztA8QqSZJ54y30s5Q== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(6506007)(6512007)(26005)(6486002)(6666004)(186003)(1076003)(2616005)(316002)(6916009)(508600001)(36756003)(4326008)(8676002)(66476007)(83380400001)(66556008)(66946007)(86362001)(8936002)(5660300002)(52116002)(38100700002)(2906002)(38350700002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?uwILKC7dfUfb6WP/WYQpx+3WkuqR6SQRAzKwQHgae5aI2ryz2T2NsF0Mstak?= =?us-ascii?Q?gDspKnjMa9WGaDERMU6VToCz1feFCU8KtZPxhfO4IEgis5Kst4UwdkSHapoW?= =?us-ascii?Q?hRP8UtEucgJaBLRbXmcMFy1ho6S5/o4oMsLPpimmQRvn9zT7Se9BxJrfE3sT?= =?us-ascii?Q?HJicGRG7nMSibFMjA3yT1yxYCgExKc5grMuj+VdQWU2oN+umR6xaxgOX0ixN?= =?us-ascii?Q?PEO6NEIyfXdGXdZPynx5eU/sO7O9ScN+DlMIyF55NMaYUlv0HV01NS8omBri?= =?us-ascii?Q?U2Rmj/l1pyc/Rr6L77GYqHJd3ka2qm+QWyq8wzW18wdaOnIyHlAXCuQdDS99?= =?us-ascii?Q?cD3cZgmxudVC7iyLH+/GmuKOM90QnZ76UMDQJ7WOEBdN3U7qEd5e94yYRByX?= =?us-ascii?Q?gLgOXqACgrwqte9JP8ipPMeSSx2RIKxVUfpLHIsj4kBUPHjAC+q0OOy8w2vw?= =?us-ascii?Q?a8faIHeEhCD9ARJn4DI6rryydU63OR7OIFSebydmMHfVFwIDy2plXKSy2nkC?= =?us-ascii?Q?4LFeZ4pDjDOtlt0KqhqgIuPH8wKZWmAfKP1JOI65W3lnnOCiduwWgLEn/79m?= =?us-ascii?Q?xk8320XtP1gMr4i21Vhlg6bICaKTBrO/BgVo00Yslucl8YgpSYRjs5LIDMYt?= =?us-ascii?Q?csWeRYZayVWfcp5XIv7C+OZanuds5INv+ExIRTxrzIjCIh3uEbLqx7vu3/ug?= =?us-ascii?Q?VlldYcUaKfdHe8wShR6MTMDq4hfsMc9gP/zsVdD2u78VXBZ+ZMQKHvc3fBuG?= =?us-ascii?Q?sgZCsRc3RYu0nM0VqjisKW1Rce6IHf/Ko3GHO1L1ekEv1R50AIe6kMSA8XZf?= =?us-ascii?Q?P5WS4OHbRR5VHycPkTwDp6WfnozHZFNwtylmJaX4T+4IrulFf9UCKClUPFvF?= =?us-ascii?Q?S0SgsMRrcSxxY4Ik/nca6xEoIHa/UCyYZ3gdPVS5khY9BydqaRV/TsI8po31?= =?us-ascii?Q?b57QRWZOAr/SJk515LYXwNGk0hiPeV6VPK5W/wXMJgfRaFsDD/Qn/rXe32IW?= =?us-ascii?Q?6ksrYA9NAybjsj2twZPRB1mOhw7BxgvTGof7vc2VraXiO9VX0VyENQ0oRsFn?= =?us-ascii?Q?YNsFM+y/6Hp67OKChleLRhLdTqBfBnAXWi0yUBknTZRySjG9kRSKogvVTNPu?= =?us-ascii?Q?64oQkwJWL2BxgR7ytkwMjodo7eoIdqywcsfFG+HR6G0xf2n1qKdgobWSz6HF?= =?us-ascii?Q?u3HXjZlYU9D1oGRr21IZiNeDwl+Les0HJPvzrteEcEdzt4XVNtKaFNCRR9/K?= =?us-ascii?Q?amSnU9uclZbqN6TQsPGP7UUQ+SM09E0n3lVPcrZwZApRhJ4vaEtGpDsA5JVm?= =?us-ascii?Q?tTP9k56QQd14R7TaWv5ic8k8uehzExAzD3LThRQovDM1/0hoeuhOszwghKua?= =?us-ascii?Q?2zdEWZldBNBhGqKXOV/6/bbtC4l+BlKlkZw/xBebFf0/DA3ochh4lSZZrN2S?= =?us-ascii?Q?0NZ2R7XXdLVFPfLemDSNJ2W9At81GHpRVYgO3KhTHxjO8+9GDTERkcZ2y8Bn?= =?us-ascii?Q?QXPRzUBiWlK8iiwrWXC5Q3ViDxvr+sRuaO5wvo5OmWnPVvI98ap3ynVQQp7x?= =?us-ascii?Q?S0BD/RKrl+l92fhPXMz7ACGoIK8Gb6Zx8YLCWWvJzGeFEs7x1YgimbaM0MpX?= =?us-ascii?Q?A9PTQjw4HhD4ad+zjol8bxVPPV5NH5wTxkPfpao309sH0pT4WG3mC/rxTVi5?= =?us-ascii?Q?KZruvw=3D=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2090d477-ed9c-4ed1-4f21-08d9fd4e2e3a X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Mar 2022 19:44:07.5891 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: norE0Ur1O5xDyaPXHDFe/py1KGO6kNNZwdrQlzWP7dVN0mcVXDxC9stLoVfoTOOLsNkG1W7kHeNvhxG506KxJBN79FW6EXv8e2+vsvZOVi4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB4736 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a01:111:f400:7d00::72c (failed) 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=2a01:111:f400:7d00::72c; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1646337146248100003 Content-Type: text/plain; charset="utf-8" This brings "incremental" mode to copy-before-write filter: user can specify bitmap so that filter will copy only "dirty" areas. Signed-off-by: Vladimir Sementsov-Ogievskiy --- qapi/block-core.json | 10 +++++++- block/copy-before-write.c | 51 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 59 insertions(+), 2 deletions(-) diff --git a/qapi/block-core.json b/qapi/block-core.json index 9a5a3641d0..ffb7aea2a5 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -4171,11 +4171,19 @@ # # @target: The target for copy-before-write operations. # +# @bitmap: If specified, copy-before-write filter will do +# copy-before-write operations only for dirty regions of the +# bitmap. Bitmap size must be equal to length of file and +# target child of the filter. Note also, that bitmap is used +# only to initialize internal bitmap of the process, so further +# modifications (or removing) of specified bitmap doesn't +# influence the filter. (Since 7.0) +# # Since: 6.2 ## { 'struct': 'BlockdevOptionsCbw', 'base': 'BlockdevOptionsGenericFormat', - 'data': { 'target': 'BlockdevRef' } } + 'data': { 'target': 'BlockdevRef', '*bitmap': 'BlockDirtyBitmap' } } =20 ## # @BlockdevOptions: diff --git a/block/copy-before-write.c b/block/copy-before-write.c index 799223e3fb..91a2288b66 100644 --- a/block/copy-before-write.c +++ b/block/copy-before-write.c @@ -34,6 +34,8 @@ =20 #include "block/copy-before-write.h" =20 +#include "qapi/qapi-visit-block-core.h" + typedef struct BDRVCopyBeforeWriteState { BlockCopyState *bcs; BdrvChild *target; @@ -145,10 +147,53 @@ static void cbw_child_perm(BlockDriverState *bs, Bdrv= Child *c, } } =20 +static bool cbw_parse_bitmap_option(QDict *options, BdrvDirtyBitmap **bitm= ap, + Error **errp) +{ + QDict *bitmap_qdict =3D NULL; + BlockDirtyBitmap *bmp_param =3D NULL; + Visitor *v =3D NULL; + bool ret =3D false; + + *bitmap =3D NULL; + + qdict_extract_subqdict(options, &bitmap_qdict, "bitmap."); + if (!qdict_size(bitmap_qdict)) { + ret =3D true; + goto out; + } + + v =3D qobject_input_visitor_new_flat_confused(bitmap_qdict, errp); + if (!v) { + goto out; + } + + visit_type_BlockDirtyBitmap(v, NULL, &bmp_param, errp); + if (!bmp_param) { + goto out; + } + + *bitmap =3D block_dirty_bitmap_lookup(bmp_param->node, bmp_param->name= , NULL, + errp); + if (!*bitmap) { + goto out; + } + + ret =3D true; + +out: + qapi_free_BlockDirtyBitmap(bmp_param); + visit_free(v); + qobject_unref(bitmap_qdict); + + return ret; +} + static int cbw_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { BDRVCopyBeforeWriteState *s =3D bs->opaque; + BdrvDirtyBitmap *bitmap =3D NULL; =20 bs->file =3D bdrv_open_child(NULL, options, "file", bs, &child_of_bds, BDRV_CHILD_FILTERED | BDRV_CHILD_PRIMARY, @@ -163,6 +208,10 @@ static int cbw_open(BlockDriverState *bs, QDict *optio= ns, int flags, return -EINVAL; } =20 + if (!cbw_parse_bitmap_option(options, &bitmap, errp)) { + return -EINVAL; + } + bs->total_sectors =3D bs->file->bs->total_sectors; bs->supported_write_flags =3D BDRV_REQ_WRITE_UNCHANGED | (BDRV_REQ_FUA & bs->file->bs->supported_write_flags); @@ -170,7 +219,7 @@ static int cbw_open(BlockDriverState *bs, QDict *option= s, int flags, ((BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP | BDRV_REQ_NO_FALLBACK) & bs->file->bs->supported_zero_flags); =20 - s->bcs =3D block_copy_state_new(bs->file, s->target, NULL, errp); + s->bcs =3D block_copy_state_new(bs->file, s->target, bitmap, errp); if (!s->bcs) { error_prepend(errp, "Cannot create block-copy-state: "); return -EINVAL; --=20 2.31.1 From nobody Sun May 12 02:11:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1646336796; cv=pass; d=zohomail.com; s=zohoarc; b=YDH20KZDBMNvpRz0UBYb1vpG7CZ5kQ0aGDgjRtAYWz0fN18Dy78g3n8BfIL6LNKt6aDmQ+L4Irc3QUpA9+m8dIpDBK1f+MBkdFSi33ImNwGO3SkxT4nBdWU9N1+x7LLUnb2mattJunRA/evuG159P3ptCZ2zctgxO2ly2oP0FNM= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646336796; 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=ca8vM/oTqjTB8b5Pi2Mz4F8t/yw948dRrpl+Gsj2CCw=; b=ZPtvn7mFtvIRJJdSsWqZFT8ShzcVS52jheGAINHV60sVflPcHOz7QUS3meNcx5cvF5RUi1+cMHNrLLgC55VJzgOC8H/UBS93Enhh2k9UHauigd+34FljyqlmS9NOcje8ecSQV9S9TLKiRhOxjb8EXUzLTXIx+KQewnZrMDqFzhs= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 164633679619684.4586216774992; Thu, 3 Mar 2022 11:46:36 -0800 (PST) Received: from localhost ([::1]:43378 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nPrPG-00074I-Tw for importer@patchew.org; Thu, 03 Mar 2022 14:46:34 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39056) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nPrN8-00042C-TB; Thu, 03 Mar 2022 14:44:23 -0500 Received: from [2a01:111:f400:7d00::701] (port=54113 helo=EUR05-VI1-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 1nPrN7-0004Yn-5T; Thu, 03 Mar 2022 14:44:22 -0500 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by VE1PR08MB4736.eurprd08.prod.outlook.com (2603:10a6:802:a6::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.26; Thu, 3 Mar 2022 19:44:08 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::4545:8e0c:19c7:2a6d]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::4545:8e0c:19c7:2a6d%5]) with mapi id 15.20.5038.014; Thu, 3 Mar 2022 19:44:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VLiiC1pec9ghapWBRfNopMAM36LMtjMrOZJqxzz/bo9L+yfmERhz4LGJ9SBG90U0NNzTTaqMAeFIk6lKUfHHLYJBx6ZW6dW286fYuAC/i+K+lamqnmWRGFFoUWRkFmjkIstkZ6KvlT7b2+ZsxnVF0toiDQvklZ91W+yM71TtP1dU1NmXb1EX0adpey5Tyxvw5qucBhZNEvStm/iJWadu7RWjA2D2UkokhuaVG6ArVGuktEKjZ/lgoRrzqrmP7YwFtCrRqfB5F8RmTxGIunxgKpL/Yb+tzgu75KxJZRpnYE6LO1onhU6mIzWdXUE4kLIrGx1YX5BgvqkNe7lZpX1uiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ca8vM/oTqjTB8b5Pi2Mz4F8t/yw948dRrpl+Gsj2CCw=; b=TLsp5D04YNDEkYgzVb9qeOVz9FSpIv6ZMF80plbMeO9Eco2HjBdWrTLrHyhxAnqxXLY8Wm1W/YpN2zde+Xy6ET8SG7ZtEmYEBEohB6jtB/Vp0xukwX+rnQHRp4ZdzJflAF17ACH61khdHUFkXiJ8/TfJMtMKUCL9lRfG084kbq+b4KV/mgZCyD0FPXwsckW+d5bgqZVdX3TaY2nDyYZJ/0ycGu4dXL4kutxwtcl5yvlK6fBFiYOdAz8j94333hTH7jYGnG8qAgO/8TmFxt6RlJ5sfws8ew9a7ymL8c6Dhlu36V9NIX61cDsm3utp64g66lM4FaA1U7Yjnl3sboZOHA== 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=ca8vM/oTqjTB8b5Pi2Mz4F8t/yw948dRrpl+Gsj2CCw=; b=jxj+LjJzwA4L9C7YG+6FyBkYIqYPkU0zjZIYEGIZLhD3C9YeN9LvOn67wDmhKt/e1yMNDbnxSRXs/2fHs2yKr+fDseBSenB1GLbh5Q+wp9d+v9orqvKngvqGfEEiSxNPbqe+3lqoUjfm1ZdmT5bEew5wOzoH/TzUvEe/XgWur9w= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, armbru@redhat.com, fam@euphon.net, stefanha@redhat.com, eblake@redhat.com, hreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com, jsnow@redhat.com Subject: [PATCH v6 05/16] block/block-copy: add block_copy_reset() Date: Thu, 3 Mar 2022 20:43:38 +0100 Message-Id: <20220303194349.2304213-6-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220303194349.2304213-1-vsementsov@virtuozzo.com> References: <20220303194349.2304213-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: VE1PR03CA0038.eurprd03.prod.outlook.com (2603:10a6:803:118::27) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: abfd5851-bbf1-448b-1171-08d9fd4e2eb4 X-MS-TrafficTypeDiagnostic: VE1PR08MB4736:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dY/Ze2MzJVrTHonPv/Qht9Aahrv2Ky2qmTzKMmtWhzLA4tcq3c6gsEds9YJc+D+MdA0KKOsChf0s36LKOj8AovBeuNEjuwEWASx8iMouAjUj/4bASjuO00NOyq7xaUDfN6LCXYrIJIoVVgoafsQ++Uqwz9hEg4Cjz/6M6AauIipvnBf0xUAvkMKkYKi77VSuJNnmJ6l+OkZ0YM0p2USIlNM7VfQkSH6VsWWqJn9L1qNa3STp5JL1Rb8fL3v5JVqH+q13w0Y6c5b/Kuh+OUOnG7PQC51Il0T+QRyPG1lVt2XuGbEu4UC5aaLRX042CknYjALTgks7R8FF8XDmEGgX9FojmPZg9rr4XhM0oEGgAK769mjAAzdWIIM/lLK+QMjbQrG7XvpB9wLm6H2SAxKz9qTX5W4DOjP2yVOUSEM6yejUyfB/L0YpBUEbcAp8SZ6GAgjjb0LHQVZvUopOzDKCvpOJmN7AVB63awW0fhOLOqwS5w7hLHioTLa3Ez2Dsey21xHmZPJC9rLFjvF3PRangEjEfzbD78Iswy3mbDdKePMq6WqmUr9M1wDA1sycluS6iLwKkE/WvmBHPPUjNy2eot5moojQEHl2Mg5Mtz7Tk9dDtDTyzD6q9x7QUM/+SfSWxFgslQTeQU2HnxiWZkKig2iIDU+9XbR9mrc5Ld/CQ8zQ8TfjgXV5QmzFSFcPii8UzvbSd2PtVTklOxNjuWiZsg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(6506007)(6512007)(26005)(6486002)(6666004)(186003)(1076003)(2616005)(316002)(6916009)(508600001)(36756003)(4326008)(8676002)(66476007)(83380400001)(66556008)(66946007)(86362001)(8936002)(5660300002)(52116002)(38100700002)(2906002)(38350700002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?+ltiz6Jrfu4T+swJ72x419oidioIn1ai/gnve0sBzoUimX1QTOLM/tmYg1Bd?= =?us-ascii?Q?8vfltOwIFKScJXzbWAa08o6CF6YSap4pKwghw0bUmITT8PQOv1e0iNBT6/MV?= =?us-ascii?Q?qM9EQhbrdBlDim1jb7oid4QEmJrMEMYKRMY3Z3d05mDxwIwB8Kr8xSCr6uga?= =?us-ascii?Q?RYxt0dqGmdDokBr3JuON7rCPwO0vA/sFyU/uTUAnbdXrW8sao6TwO3Q9ZgEZ?= =?us-ascii?Q?7D9dNSY3lJ1CKG/TLmzZXmYHtE9hAq+HDyEbM7E9S9mUHY82dx85iPysaVWn?= =?us-ascii?Q?gTfAxR4S1ltTXy1JZk5vw4PVbAhiRLpZks3cOo9qQAwwhPAOP2iDfep5fAoq?= =?us-ascii?Q?pAxIZbseVES9LhzuQ9pWxmyz33Of7i8n+EThGtpQHb5mAq7KPWEBN5kmJVRQ?= =?us-ascii?Q?jRjfYZ2CZDbu1w+kZDGw1ujrGmrVBzO9uHeCYFrgCKS2GMO7VxSs0eFHyn9G?= =?us-ascii?Q?TUnIRUOBjpfgJRdYtvBVc28d/irBJexR43nW7ke6NoHgkHkjUbE7vs0avZtx?= =?us-ascii?Q?5yC1O3G0l9mworIDVLkFHmAo0/31AlGaIJbaxpbwW2Ym7AkS5XPrAynEU5U9?= =?us-ascii?Q?mOem49uKGUQCWYZuaoLs/FpcuEXiV39JOI+fiEgR+ejTKZXiomuzpc/4P0jc?= =?us-ascii?Q?Ez56jRyzAT0ZlUB1d+6ko2ij3CRHUm5D8p5Xab4kOJxaYPEJxr5qRQuUICQD?= =?us-ascii?Q?iofUU4ml2rbst+Ojc3qtEBdLfxdBMZCm3ZpkTwysTopmw0hGtyrgTrdTX+Aj?= =?us-ascii?Q?De90iFuoARscsfup9X4PQPZyIcFwHbm3mIG+CF02gz4SpwBhgTFZMbKAd/En?= =?us-ascii?Q?y+MaNGPkOAN+1+uRdetAqHiSPBCNigGYBa/fkSQ0KkaOY8an2itWngHq542l?= =?us-ascii?Q?KQ5x3CyqkBieoLguTD6WYBmg2Vg+zbM1KM5vM2FuZnMv0bROPx42yzJvs2Z6?= =?us-ascii?Q?Eq9+DzU1SrLc/s/CQZmZmhC3+XTyX4ehZ6pe2zd5ytrIGNnIXGtThuwA3zIf?= =?us-ascii?Q?PaYOL2XS6HLVGv1gaFITtHxpmqvkjGKqTcsuTe6GdimSIYfaIqm89pFcW9VT?= =?us-ascii?Q?mgHcr3SNnSgTSfs0hCTpeo0QnVotF061bPA7lp4TyuDrKlsI1Z5Q4JcQQRYO?= =?us-ascii?Q?nAn/+zfpCR5ySwySkabcPyc9LRVK02SMxNv0OUpLKexKwb6LEcqN9IDg9Wo6?= =?us-ascii?Q?vHxuYaUu/z5Wccp3AVpXvCBs0JzA2fD04PGNRXJqx7xF8HYTct1ZCOMvSw6h?= =?us-ascii?Q?oRm6wnw7uW4sZY2Bq90r5tUl+HjFqxvDQVJyH1RxiO1VL7SQuyLdx9uaSNcF?= =?us-ascii?Q?Eps5CFRDcSpwX2K/70CqncIWK0+NPA75L64RMEAzD3Ha1WsD7vd++nLteCZw?= =?us-ascii?Q?QxnGFxq8ZNIs0MtdxbWqtsq6RooU+SKkP+JlN+44x1R9q3jv8ZKq7cVt08Jy?= =?us-ascii?Q?8KhBO6B4RuHgzht1AK4/jRSB4sri4wQ/HpNfQMK+NWKGfD9bB0jVo/gFVJ2E?= =?us-ascii?Q?r3ZuVsuA0/lX6AUO2t7Q3vfVzE+x55CklBfwhMTLubH8biPTsR1EebnH+xpe?= =?us-ascii?Q?ocg3MWh8zinZ4ktkxa4FSpOVN2LMnMFfkV/8doRkpgKxyHPaafPzZXAdRVW9?= =?us-ascii?Q?g10nuwQc2Lh0GXI8pVzR1ADB0ino4HM592RO4hxhd+AZrgZEbQt2LU8BcF8R?= =?us-ascii?Q?nlmIkA=3D=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: abfd5851-bbf1-448b-1171-08d9fd4e2eb4 X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Mar 2022 19:44:08.3402 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 8QtpAhziEnMHGF9hlOsVAvXLG2Z2jIfZLQ3/ToTWriM4o4fA4ZaZE/VaNsP5iVeCOA9dwo+g4f25MFl+YuOV070uq84ox/+EMoZDVKFgtv0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB4736 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a01:111:f400:7d00::701 (failed) 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=2a01:111:f400:7d00::701; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1646336797725100001 Content-Type: text/plain; charset="utf-8" Split block_copy_reset() out of block_copy_reset_unallocated() to be used separately later. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Hanna Reitz --- include/block/block-copy.h | 1 + block/block-copy.c | 21 +++++++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/include/block/block-copy.h b/include/block/block-copy.h index b80ad02299..68bbd344b2 100644 --- a/include/block/block-copy.h +++ b/include/block/block-copy.h @@ -35,6 +35,7 @@ void block_copy_set_progress_meter(BlockCopyState *s, Pro= gressMeter *pm); =20 void block_copy_state_free(BlockCopyState *s); =20 +void block_copy_reset(BlockCopyState *s, int64_t offset, int64_t bytes); int64_t block_copy_reset_unallocated(BlockCopyState *s, int64_t offset, int64_t *count); =20 diff --git a/block/block-copy.c b/block/block-copy.c index 8aa6ee6a5c..0834e29b6e 100644 --- a/block/block-copy.c +++ b/block/block-copy.c @@ -692,6 +692,18 @@ static int block_copy_is_cluster_allocated(BlockCopySt= ate *s, int64_t offset, } } =20 +void block_copy_reset(BlockCopyState *s, int64_t offset, int64_t bytes) +{ + QEMU_LOCK_GUARD(&s->lock); + + bdrv_reset_dirty_bitmap(s->copy_bitmap, offset, bytes); + if (s->progress) { + progress_set_remaining(s->progress, + bdrv_get_dirty_count(s->copy_bitmap) + + s->in_flight_bytes); + } +} + /* * Reset bits in copy_bitmap starting at offset if they represent unalloca= ted * data in the image. May reset subsequent contiguous bits. @@ -712,14 +724,7 @@ int64_t block_copy_reset_unallocated(BlockCopyState *s, bytes =3D clusters * s->cluster_size; =20 if (!ret) { - qemu_co_mutex_lock(&s->lock); - bdrv_reset_dirty_bitmap(s->copy_bitmap, offset, bytes); - if (s->progress) { - progress_set_remaining(s->progress, - bdrv_get_dirty_count(s->copy_bitmap) + - s->in_flight_bytes); - } - qemu_co_mutex_unlock(&s->lock); + block_copy_reset(s, offset, bytes); } =20 *count =3D bytes; --=20 2.31.1 From nobody Sun May 12 02:11:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1646336969; cv=pass; d=zohomail.com; s=zohoarc; b=bmHmSkHqFPzFG0dssGe05/rKlh+AoEYjtetzlI9OE4OQHwcSsEFGs9zydM1U9eGjAYUeBPJCxNGShTHyx+IqIkGblAYL/7Efp5vWh3k8j8NnAwpkvcGfG+Ev3dB2Sl1sMWkP5kVT6aJueSJSHYIBr+edUYuH5rAbPIFariPnCwQ= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646336969; 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=PTYxUruk2BC9BKuOqqk2NLVJaD+C49EkEw7ZvJgoBkM=; b=BDnMKjSkDj2Jy5x/tGvWzPddoX+zJHkQheaWn23s5FT2ttWmQFwbIvCsWOOsv3j7DyumvZ1GLZ8P9FWKcx6ZBd1w4LRM+FI4zCQP4/GajmRMiykBbrM9RTGxV06IEEweQ/CGYs0VAjR4tzFb42FcbMDdwnMvQxL6aXIla668oeI= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646336969471681.4722172755006; Thu, 3 Mar 2022 11:49:29 -0800 (PST) Received: from localhost ([::1]:52790 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nPrS4-0004xg-6d for importer@patchew.org; Thu, 03 Mar 2022 14:49:28 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39066) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nPrN9-00042F-Im; Thu, 03 Mar 2022 14:44:23 -0500 Received: from [2a01:111:f400:7d00::72c] (port=28672 helo=EUR05-VI1-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 1nPrN7-0004Wu-49; Thu, 03 Mar 2022 14:44:23 -0500 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by VE1PR08MB4736.eurprd08.prod.outlook.com (2603:10a6:802:a6::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.26; Thu, 3 Mar 2022 19:44:09 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::4545:8e0c:19c7:2a6d]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::4545:8e0c:19c7:2a6d%5]) with mapi id 15.20.5038.014; Thu, 3 Mar 2022 19:44:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Hdh6n1EByZo5//hsh5fj0zylEPYPPrxrlnfg72XtL04pq3Zdgxu3AUeBBPRpYTmdih9XAj8jOtyoyiJwn+iIS3Lf6cfWptQ1FodcoeoZMD9u2KK04YnrCEbMA2c2DqNvk0jbeswke3fUfztZgUeeFo6EtOVayCw73bRAYyHaSZINPUQ06d2ZXfwao3wLBS5JujNUrWsSDAtdVcBhnnZj4R6OnTjzmC2bbeZxv/4vuxFQZQB7k4j6+9S5XPQ/Tb6yf6+GQF9Gbme/Y22IHi5yOi+4FjIJan+dw09fkZf7iB1NVppDQP2skSoQae6LBBndlGvMrNaLou0oRX7zC2ev7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=PTYxUruk2BC9BKuOqqk2NLVJaD+C49EkEw7ZvJgoBkM=; b=fNkaVz5u6iMspR5WhglxtUOozEFLKwvtLluLCitNFKfMNkwdzkRQsHOyyRP6ExyiKlNKFvtwkNHSlaIVbSzCctDygedIFo9EXNgc4cHQ5fVHrFN6Z4YB3fFTtz6jgKhW4fJ1/SlXuute+bLIkSsHwXcqeWx8NWTtfV2S7J5GeC2xX42wQSAZ4tXXz3jbSbFvGfde3WV7mrzKMndCG5QZQKBdk8FyxObYC0SVcQaoPl+34R4brKJmzViQoWS9589vQjnv9h1Lgzwxz7PAkwZkusKlgg4GwiOFxi0a1PD/UOEk5twVh1yfaEVC2mpnQ0LDACnRJV1anP7vfP91L8tdMg== 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=PTYxUruk2BC9BKuOqqk2NLVJaD+C49EkEw7ZvJgoBkM=; b=h3e0hdv2ukkX96XKqIXh4VuI9FD/uFLA2lhsBx6tuyuScqJBBbib7bGeF4nWKQrU24pT+k098PrTX+MP+P1SvkXuzeQcXRDK0cxpofL0APRAnPKHWQEusE0/VWx7mhlofsVxHLINMCOkA19UwqFAhJ9PwTlFj2AXDE0zl1t5G0E= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, armbru@redhat.com, fam@euphon.net, stefanha@redhat.com, eblake@redhat.com, hreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com, jsnow@redhat.com Subject: [PATCH v6 06/16] block: intoduce reqlist Date: Thu, 3 Mar 2022 20:43:39 +0100 Message-Id: <20220303194349.2304213-7-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220303194349.2304213-1-vsementsov@virtuozzo.com> References: <20220303194349.2304213-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: VE1PR03CA0038.eurprd03.prod.outlook.com (2603:10a6:803:118::27) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 36462020-ef95-4982-1acc-08d9fd4e2f24 X-MS-TrafficTypeDiagnostic: VE1PR08MB4736:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PwV7o4hDWoV6cHsCH/OXf1tXSFNML7qznk7cGIbMNnTrfSFJINYx9cCAxDFJO02lxV1Nlfi3WFWF4IXkVzb34ZdoiCgfvLKYVzKZWgqoZ3DuIkQCg7bdFW+46T3vNthzJawytoD7CfqOWbdSYpbwTlzJVGElM7GRHL4igbr8kDCClQhuROnCdJuxN7UOCfJyv8qVGBVyOkbHG97Kso7AqbxmveW76fEg5IE5LQTQMCPeTVBFOV767QM0Hzg7aA9RRIbeOGopZ6B2uLemUEzF4rpplHxFrK9GIhZVrYgPHd5wrqzsgD7vwpguCXzasZxVxDBfCfRp7MvG1IE/4tz+3rZjPIl4Gd+YUH+taHYti9R0BfGQMyk0CBvXCn83is3ejg2QkvU+XTqviUMf+Qhhk6W1uKJL7PHICAWrHPG5H/KH/jjWVq+3Wyd3NnzhOOxZ4/MFVloic9BXmanU62C0tZIzxyGEdJVyF9BFWuyH54UwGHNha03HtkiotBk32d1+2DJqanOGXiS4febfzofBIcIMfQ9JgoBW83btn7wRFShnS/lOgeRF2rQKZh8MiI5EcP1CAUB0Stq3BhjhEWUe3upb1BcyqMq9S+yHmaMV0cYb19iTqXF0IrKtwRfRGF33PTq8rYuNmqPjRD1hPcR8/n/s1FLoYbMpBCXaCgBep7Vyt3P1n5aKkbT78FguFpCLWsJRdMLUYFnIdidSHDuVww== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(6506007)(6512007)(26005)(6486002)(6666004)(186003)(1076003)(2616005)(316002)(6916009)(508600001)(36756003)(4326008)(8676002)(66476007)(83380400001)(66556008)(66946007)(30864003)(86362001)(8936002)(5660300002)(52116002)(38100700002)(2906002)(38350700002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?y+9d617NGcBekDSEK4BRywZ1Ux/4GjCrWXX0hXYqMKCnZ96UJnigxrEs3Ro0?= =?us-ascii?Q?wxaWbcQ6v87xgpXj6sUZkkWKUqE6Ouh4zm6qe3u9Wsnt6vT/vN+8FgdLTVT8?= =?us-ascii?Q?ASPXfJVdWkS7EEahE5Ruvzv3e1Nhn6Q1s+QBWRE7g+bNzLN+84S3StEMAVWo?= =?us-ascii?Q?NFgXfIM3F5W+i5Xa96QFmQetb2rmQYRZUReekdVrYdo0K7tGMfUSNwEXeQsg?= =?us-ascii?Q?7enclKL3s3LtU4d/uPbDjTC9XXkfKrHkomT53HambG66z2cfbVFM2kkzY5so?= =?us-ascii?Q?Dum5mRbCRJ9hamzbcHIabCUfbRafXdP/+ZVjmeY9f8jwdAfs7eh1ObScBT4+?= =?us-ascii?Q?xtgrAtBgEJ3JYbbDb8BzYqNfEgMEA1ibv12pI4NnSnixOl3CcafrKnq65/Q8?= =?us-ascii?Q?UkaRLvFt5urXsMZDpIemc3ZOrPd0LnRTMOh50SOcUGiK0g84uXmaimnLYn+n?= =?us-ascii?Q?/tjX1XWYsz3lTDrZerUq+bxKOs+WnwBnBAGIYaMoV/XKLj3Z6yOO4CiuB6Ly?= =?us-ascii?Q?pQkB3tV8fEkkGHD2jil0q3XpskJZUlAU607EjZVFGYgXRghW86i3vRoW36B/?= =?us-ascii?Q?0MMlUHz9JIEdNG4cUYyljTq45zitP90apV5zRvvfQTYEMIBmPacAKvhfxXAx?= =?us-ascii?Q?lM5K0O8ldsmXZvqZPCeJj0PNyiwb0ISoCoYMPy/Dq67yLHn+bJxBtWW1FgD/?= =?us-ascii?Q?35vkQ7WEBa0SUApS8vcf+8pSP8cKnCblYoY1NC2K70fRaBhQX2skSfeKXPTf?= =?us-ascii?Q?ZQZcSC+V3tjlr3DQqJwC3OeHXoXs3EtK3AZFTcC4sMXhquqDJCdnn3I3SEGb?= =?us-ascii?Q?p56WmUyogmgoyrhLbxw3HjWYw3uT74vZA5Pypu+tbMTdtoMvRuNITeQSn4FZ?= =?us-ascii?Q?EXHYp1jQLqk85GCzqcKCn6n5jbEmSfJupjbgMaT2i4Y8kMhza5gQt0ReUqK0?= =?us-ascii?Q?aDbLBu3yN8M091kScCyas+CGQE+IlNWus4hZY08tuigKp8pDBgKtQqo7iUWj?= =?us-ascii?Q?0judNRwglWkln0ob6N4lDOS16HikOyAmnHYmXRwrYlIi4P9l0VF4RqsIfwoS?= =?us-ascii?Q?ec118NIAzap/HmJh+3c9gJpwiNSlrxi2lwTcZGvygJkAOWADvDAqSnOJ7aci?= =?us-ascii?Q?q9wOjvhEdtL+0j/u58iGg2oxqz9wYtNsTFatk+Ehtgw1Cf3OoA6xqx3znWgi?= =?us-ascii?Q?lmI6xzaO8vrFGTm+iifYxvpYbYhfDrXD6kcHFNClbPIoy1BoAosqsG9v8t/3?= =?us-ascii?Q?0QD76nf8ow33soyLUoVuc9C/IEE0J2svxU0hL94iAEqQdJTrobm9THi1cHRL?= =?us-ascii?Q?aavILqkJVGAOPYdmOoZ8FjbWneO0lrXcMYKyeRfriSlS35+JO4qRvPguYJkO?= =?us-ascii?Q?rOXkGNjrZplIkcXGvAYZ52vQDbfh8vwDnvzGfZqDZRfvFKA9q1xrU1UkHqMU?= =?us-ascii?Q?Bm2zfieA2WgkTGidk0BxHcuhrhlAv5lrfICJfEvxI912rGkY77EGs6khu/cS?= =?us-ascii?Q?IPfbJXE1nwUJCMOSX+99v3RxYXSFtg9X/jz+UrinSY3T49CYogfV/qNaVLU+?= =?us-ascii?Q?POCDoQ1WigJhVddENJherpX75h7Liu7MipH761ZUX6mSlMdvQCQsEaOpxryp?= =?us-ascii?Q?0Hu72I9NtAX4sMSvUgYtZaAAWnUIjnKUgFOMZ0nwyCuj4wnoU1G9EnoRvUf7?= =?us-ascii?Q?LaR/MA=3D=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 36462020-ef95-4982-1acc-08d9fd4e2f24 X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Mar 2022 19:44:09.0901 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ezKBSEb28lQzyR4dXiwEVXIpsHcLCcV0FR7wkhuy0C/T5LVtxwQhti3iR5xuWafhQCsp1nQ5sMhoXooCJ1fh2H1wHcMDabWxdwOrLfPfUnw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB4736 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a01:111:f400:7d00::72c (failed) 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=2a01:111:f400:7d00::72c; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1646336970959100001 Content-Type: text/plain; charset="utf-8" Split intersecting-requests functionality out of block-copy to be reused in copy-before-write filter. Note: while being here, fix tiny typo in MAINTAINERS. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Hanna Reitz --- include/block/reqlist.h | 67 +++++++++++++++++++++++ block/block-copy.c | 116 +++++++++++++--------------------------- block/reqlist.c | 76 ++++++++++++++++++++++++++ MAINTAINERS | 4 +- block/meson.build | 1 + 5 files changed, 184 insertions(+), 80 deletions(-) create mode 100644 include/block/reqlist.h create mode 100644 block/reqlist.c diff --git a/include/block/reqlist.h b/include/block/reqlist.h new file mode 100644 index 0000000000..0fa1eef259 --- /dev/null +++ b/include/block/reqlist.h @@ -0,0 +1,67 @@ +/* + * reqlist API + * + * Copyright (C) 2013 Proxmox Server Solutions + * Copyright (c) 2021 Virtuozzo International GmbH. + * + * Authors: + * Dietmar Maurer (dietmar@proxmox.com) + * Vladimir Sementsov-Ogievskiy + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ + +#ifndef REQLIST_H +#define REQLIST_H + +#include "qemu/coroutine.h" + +/* + * The API is not thread-safe and shouldn't be. The struct is public to be= part + * of other structures and protected by third-party locks, see + * block/block-copy.c for example. + */ + +typedef struct BlockReq { + int64_t offset; + int64_t bytes; + + CoQueue wait_queue; /* coroutines blocked on this req */ + QLIST_ENTRY(BlockReq) list; +} BlockReq; + +typedef QLIST_HEAD(, BlockReq) BlockReqList; + +/* + * Initialize new request and add it to the list. Caller must be sure that + * there are no conflicting requests in the list. + */ +void reqlist_init_req(BlockReqList *reqs, BlockReq *req, int64_t offset, + int64_t bytes); +/* Search for request in the list intersecting with @offset/@bytes area. */ +BlockReq *reqlist_find_conflict(BlockReqList *reqs, int64_t offset, + int64_t bytes); + +/* + * If there are no intersecting requests return false. Otherwise, wait for= the + * first found intersecting request to finish and return true. + * + * @lock is passed to qemu_co_queue_wait() + * False return value proves that lock was released at no point. + */ +bool coroutine_fn reqlist_wait_one(BlockReqList *reqs, int64_t offset, + int64_t bytes, CoMutex *lock); + +/* + * Shrink request and wake all waiting coroutines (maybe some of them are = not + * intersecting with shrunk request). + */ +void coroutine_fn reqlist_shrink_req(BlockReq *req, int64_t new_bytes); + +/* + * Remove request and wake all waiting coroutines. Do not release any memo= ry. + */ +void coroutine_fn reqlist_remove_req(BlockReq *req); + +#endif /* REQLIST_H */ diff --git a/block/block-copy.c b/block/block-copy.c index 0834e29b6e..ef948dccec 100644 --- a/block/block-copy.c +++ b/block/block-copy.c @@ -17,6 +17,7 @@ #include "trace.h" #include "qapi/error.h" #include "block/block-copy.h" +#include "block/reqlist.h" #include "sysemu/block-backend.h" #include "qemu/units.h" #include "qemu/coroutine.h" @@ -83,7 +84,6 @@ typedef struct BlockCopyTask { */ BlockCopyState *s; BlockCopyCallState *call_state; - int64_t offset; /* * @method can also be set again in the while loop of * block_copy_dirty_clusters(), but it is never accessed concurrently @@ -94,21 +94,17 @@ typedef struct BlockCopyTask { BlockCopyMethod method; =20 /* - * Fields whose state changes throughout the execution - * Protected by lock in BlockCopyState. + * Generally, req is protected by lock in BlockCopyState, Still req.of= fset + * is only set on task creation, so may be read concurrently after cre= ation. + * req.bytes is changed at most once, and need only protecting the cas= e of + * parallel read while updating @bytes value in block_copy_task_shrink= (). */ - CoQueue wait_queue; /* coroutines blocked on this task */ - /* - * Only protect the case of parallel read while updating @bytes - * value in block_copy_task_shrink(). - */ - int64_t bytes; - QLIST_ENTRY(BlockCopyTask) list; + BlockReq req; } BlockCopyTask; =20 static int64_t task_end(BlockCopyTask *task) { - return task->offset + task->bytes; + return task->req.offset + task->req.bytes; } =20 typedef struct BlockCopyState { @@ -136,7 +132,7 @@ typedef struct BlockCopyState { CoMutex lock; int64_t in_flight_bytes; BlockCopyMethod method; - QLIST_HEAD(, BlockCopyTask) tasks; /* All tasks from all block-copy ca= lls */ + BlockReqList reqs; QLIST_HEAD(, BlockCopyCallState) calls; /* * skip_unallocated: @@ -160,42 +156,6 @@ typedef struct BlockCopyState { RateLimit rate_limit; } BlockCopyState; =20 -/* Called with lock held */ -static BlockCopyTask *find_conflicting_task(BlockCopyState *s, - int64_t offset, int64_t bytes) -{ - BlockCopyTask *t; - - QLIST_FOREACH(t, &s->tasks, list) { - if (offset + bytes > t->offset && offset < t->offset + t->bytes) { - return t; - } - } - - return NULL; -} - -/* - * If there are no intersecting tasks return false. Otherwise, wait for the - * first found intersecting tasks to finish and return true. - * - * Called with lock held. May temporary release the lock. - * Return value of 0 proves that lock was NOT released. - */ -static bool coroutine_fn block_copy_wait_one(BlockCopyState *s, int64_t of= fset, - int64_t bytes) -{ - BlockCopyTask *task =3D find_conflicting_task(s, offset, bytes); - - if (!task) { - return false; - } - - qemu_co_queue_wait(&task->wait_queue, &s->lock); - - return true; -} - /* Called with lock held */ static int64_t block_copy_chunk_size(BlockCopyState *s) { @@ -239,7 +199,7 @@ block_copy_task_create(BlockCopyState *s, BlockCopyCall= State *call_state, bytes =3D QEMU_ALIGN_UP(bytes, s->cluster_size); =20 /* region is dirty, so no existent tasks possible in it */ - assert(!find_conflicting_task(s, offset, bytes)); + assert(!reqlist_find_conflict(&s->reqs, offset, bytes)); =20 bdrv_reset_dirty_bitmap(s->copy_bitmap, offset, bytes); s->in_flight_bytes +=3D bytes; @@ -249,12 +209,9 @@ block_copy_task_create(BlockCopyState *s, BlockCopyCal= lState *call_state, .task.func =3D block_copy_task_entry, .s =3D s, .call_state =3D call_state, - .offset =3D offset, - .bytes =3D bytes, .method =3D s->method, }; - qemu_co_queue_init(&task->wait_queue); - QLIST_INSERT_HEAD(&s->tasks, task, list); + reqlist_init_req(&s->reqs, &task->req, offset, bytes); =20 return task; } @@ -270,34 +227,34 @@ static void coroutine_fn block_copy_task_shrink(Block= CopyTask *task, int64_t new_bytes) { QEMU_LOCK_GUARD(&task->s->lock); - if (new_bytes =3D=3D task->bytes) { + if (new_bytes =3D=3D task->req.bytes) { return; } =20 - assert(new_bytes > 0 && new_bytes < task->bytes); + assert(new_bytes > 0 && new_bytes < task->req.bytes); =20 - task->s->in_flight_bytes -=3D task->bytes - new_bytes; + task->s->in_flight_bytes -=3D task->req.bytes - new_bytes; bdrv_set_dirty_bitmap(task->s->copy_bitmap, - task->offset + new_bytes, task->bytes - new_byte= s); + task->req.offset + new_bytes, + task->req.bytes - new_bytes); =20 - task->bytes =3D new_bytes; - qemu_co_queue_restart_all(&task->wait_queue); + reqlist_shrink_req(&task->req, new_bytes); } =20 static void coroutine_fn block_copy_task_end(BlockCopyTask *task, int ret) { QEMU_LOCK_GUARD(&task->s->lock); - task->s->in_flight_bytes -=3D task->bytes; + task->s->in_flight_bytes -=3D task->req.bytes; if (ret < 0) { - bdrv_set_dirty_bitmap(task->s->copy_bitmap, task->offset, task->by= tes); + bdrv_set_dirty_bitmap(task->s->copy_bitmap, task->req.offset, + task->req.bytes); } - QLIST_REMOVE(task, list); if (task->s->progress) { progress_set_remaining(task->s->progress, bdrv_get_dirty_count(task->s->copy_bitmap) + task->s->in_flight_bytes); } - qemu_co_queue_restart_all(&task->wait_queue); + reqlist_remove_req(&task->req); } =20 void block_copy_state_free(BlockCopyState *s) @@ -450,7 +407,7 @@ BlockCopyState *block_copy_state_new(BdrvChild *source,= BdrvChild *target, =20 ratelimit_init(&s->rate_limit); qemu_co_mutex_init(&s->lock); - QLIST_INIT(&s->tasks); + QLIST_INIT(&s->reqs); QLIST_INIT(&s->calls); =20 return s; @@ -483,7 +440,7 @@ static coroutine_fn int block_copy_task_run(AioTaskPool= *pool, =20 aio_task_pool_wait_slot(pool); if (aio_task_pool_status(pool) < 0) { - co_put_to_shres(task->s->mem, task->bytes); + co_put_to_shres(task->s->mem, task->req.bytes); block_copy_task_end(task, -ECANCELED); g_free(task); return -ECANCELED; @@ -596,7 +553,8 @@ static coroutine_fn int block_copy_task_entry(AioTask *= task) BlockCopyMethod method =3D t->method; int ret; =20 - ret =3D block_copy_do_copy(s, t->offset, t->bytes, &method, &error_is_= read); + ret =3D block_copy_do_copy(s, t->req.offset, t->req.bytes, &method, + &error_is_read); =20 WITH_QEMU_LOCK_GUARD(&s->lock) { if (s->method =3D=3D t->method) { @@ -609,10 +567,10 @@ static coroutine_fn int block_copy_task_entry(AioTask= *task) t->call_state->error_is_read =3D error_is_read; } } else if (s->progress) { - progress_work_done(s->progress, t->bytes); + progress_work_done(s->progress, t->req.bytes); } } - co_put_to_shres(s->mem, t->bytes); + co_put_to_shres(s->mem, t->req.bytes); block_copy_task_end(t, ret); =20 return ret; @@ -771,22 +729,22 @@ block_copy_dirty_clusters(BlockCopyCallState *call_st= ate) trace_block_copy_skip_range(s, offset, bytes); break; } - if (task->offset > offset) { - trace_block_copy_skip_range(s, offset, task->offset - offset); + if (task->req.offset > offset) { + trace_block_copy_skip_range(s, offset, task->req.offset - offs= et); } =20 found_dirty =3D true; =20 - ret =3D block_copy_block_status(s, task->offset, task->bytes, + ret =3D block_copy_block_status(s, task->req.offset, task->req.byt= es, &status_bytes); assert(ret >=3D 0); /* never fail */ - if (status_bytes < task->bytes) { + if (status_bytes < task->req.bytes) { block_copy_task_shrink(task, status_bytes); } if (qatomic_read(&s->skip_unallocated) && !(ret & BDRV_BLOCK_ALLOCATED)) { block_copy_task_end(task, 0); - trace_block_copy_skip_range(s, task->offset, task->bytes); + trace_block_copy_skip_range(s, task->req.offset, task->req.byt= es); offset =3D task_end(task); bytes =3D end - offset; g_free(task); @@ -807,11 +765,11 @@ block_copy_dirty_clusters(BlockCopyCallState *call_st= ate) } } =20 - ratelimit_calculate_delay(&s->rate_limit, task->bytes); + ratelimit_calculate_delay(&s->rate_limit, task->req.bytes); =20 - trace_block_copy_process(s, task->offset); + trace_block_copy_process(s, task->req.offset); =20 - co_get_from_shres(s->mem, task->bytes); + co_get_from_shres(s->mem, task->req.bytes); =20 offset =3D task_end(task); bytes =3D end - offset; @@ -879,8 +837,8 @@ static int coroutine_fn block_copy_common(BlockCopyCall= State *call_state) * Check that there is no task we still need to * wait to complete */ - ret =3D block_copy_wait_one(s, call_state->offset, - call_state->bytes); + ret =3D reqlist_wait_one(&s->reqs, call_state->offset, + call_state->bytes, &s->lock); if (ret =3D=3D 0) { /* * No pending tasks, but check again the bitmap in this @@ -888,7 +846,7 @@ static int coroutine_fn block_copy_common(BlockCopyCall= State *call_state) * between this and the critical section in * block_copy_dirty_clusters(). * - * block_copy_wait_one return value 0 also means that = it + * reqlist_wait_one return value 0 also means that it * didn't release the lock. So, we are still in the sa= me * critical section, not interrupted by any concurrent * access to state. diff --git a/block/reqlist.c b/block/reqlist.c new file mode 100644 index 0000000000..5e320ba649 --- /dev/null +++ b/block/reqlist.c @@ -0,0 +1,76 @@ +/* + * reqlist API + * + * Copyright (C) 2013 Proxmox Server Solutions + * Copyright (c) 2021 Virtuozzo International GmbH. + * + * Authors: + * Dietmar Maurer (dietmar@proxmox.com) + * Vladimir Sementsov-Ogievskiy + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" + +#include "block/reqlist.h" + +void reqlist_init_req(BlockReqList *reqs, BlockReq *req, int64_t offset, + int64_t bytes) +{ + assert(!reqlist_find_conflict(reqs, offset, bytes)); + + *req =3D (BlockReq) { + .offset =3D offset, + .bytes =3D bytes, + }; + qemu_co_queue_init(&req->wait_queue); + QLIST_INSERT_HEAD(reqs, req, list); +} + +BlockReq *reqlist_find_conflict(BlockReqList *reqs, int64_t offset, + int64_t bytes) +{ + BlockReq *r; + + QLIST_FOREACH(r, reqs, list) { + if (offset + bytes > r->offset && offset < r->offset + r->bytes) { + return r; + } + } + + return NULL; +} + +bool coroutine_fn reqlist_wait_one(BlockReqList *reqs, int64_t offset, + int64_t bytes, CoMutex *lock) +{ + BlockReq *r =3D reqlist_find_conflict(reqs, offset, bytes); + + if (!r) { + return false; + } + + qemu_co_queue_wait(&r->wait_queue, lock); + + return true; +} + +void coroutine_fn reqlist_shrink_req(BlockReq *req, int64_t new_bytes) +{ + if (new_bytes =3D=3D req->bytes) { + return; + } + + assert(new_bytes > 0 && new_bytes < req->bytes); + + req->bytes =3D new_bytes; + qemu_co_queue_restart_all(&req->wait_queue); +} + +void coroutine_fn reqlist_remove_req(BlockReq *req) +{ + QLIST_REMOVE(req, list); + qemu_co_queue_restart_all(&req->wait_queue); +} diff --git a/MAINTAINERS b/MAINTAINERS index 68adaac373..101eb50619 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2515,7 +2515,9 @@ F: block/stream.c F: block/mirror.c F: qapi/job.json F: block/block-copy.c -F: include/block/block-copy.c +F: include/block/block-copy.h +F: block/reqlist.c +F: include/block/reqlist.h F: block/copy-before-write.h F: block/copy-before-write.c F: include/block/aio_task.h diff --git a/block/meson.build b/block/meson.build index 8a1ce58c9c..41e9cc5dc3 100644 --- a/block/meson.build +++ b/block/meson.build @@ -32,6 +32,7 @@ block_ss.add(files( 'qcow2.c', 'quorum.c', 'raw-format.c', + 'reqlist.c', 'snapshot.c', 'throttle-groups.c', 'throttle.c', --=20 2.31.1 From nobody Sun May 12 02:11:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1646337036; cv=pass; d=zohomail.com; s=zohoarc; b=WfkCRJYRhvhPMO1JK2FMBWBDAYYJ8a5sXQdhWS+ZbrxnqA7qALC/r/SShC9t+44bpGhhaKgzuIsi1WYz5EILvmfWyZrpuLEzLthALrDKtCSfwslLrhDcvdMt+Yjc53U7N8Z4KO9eGbPneO64fd97RbrFmP0Wwfugvs7978JVn4k= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646337036; 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=hfaHUhbRyFa1HNmcSpumz+kghFfvZXfWDVh7vE8MydY=; b=YIhgtcQP7uoXTZrGUi6ByLe0Itp9rM8GUCmm4EgFyER5o+FMsq7Lv9d4HvYafeZf6HcgkHYRKPAFPprsVahBt/Bte/jz3z39sP1nNNTEqXq2/EvxcGBRmSA4B9lLL254AwgPD0j7nX622wBX59Tn+2cTEnZvswBv/vT5dRJMbyE= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646337036587356.2419072868431; Thu, 3 Mar 2022 11:50:36 -0800 (PST) Received: from localhost ([::1]:55050 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nPrTA-0006UZ-49 for importer@patchew.org; Thu, 03 Mar 2022 14:50:36 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39052) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nPrN8-00042A-Lp; Thu, 03 Mar 2022 14:44:23 -0500 Received: from [2a01:111:f400:7d00::710] (port=7585 helo=EUR05-VI1-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 1nPrN7-0004Xj-4e; Thu, 03 Mar 2022 14:44:22 -0500 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by VE1PR08MB4736.eurprd08.prod.outlook.com (2603:10a6:802:a6::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.26; Thu, 3 Mar 2022 19:44:10 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::4545:8e0c:19c7:2a6d]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::4545:8e0c:19c7:2a6d%5]) with mapi id 15.20.5038.014; Thu, 3 Mar 2022 19:44:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cd6UOBthZ+wMoXe2/0Z3WJ6P5ZWvbKbqtZ5a9JwO+vfNAz/8CYcYGPZD371BYYNQ4U+ZGXSPvbhk0ba7qLZSHz9DToLUYUOABp2vf5GYgwQFbd7Wq96enwu2bgD/m2U7+uBvvTg3IhwAW30J0sEYHLmQjzWHF22ufTNTX4Xz1dDSZZjkhIhxAG7mwJBtKPVJwoKhZC860XSGJZHfaJZQ+N15Gy4O+ZfjJgaIH+OXvH+RK/LUEZoAhmIBlTVSRw4vSs85WMeU5xaY4dWKkWoJQ1HxjzsVF4CH962Cop7Q+gvclDuM/iwjnykh+5bXKAasxjqbfbJAOXPNz1N9i7XuZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=hfaHUhbRyFa1HNmcSpumz+kghFfvZXfWDVh7vE8MydY=; b=iZvveBAQ61vsxsRzXit86fCZwu2ubUf2eZXlTWhQoBxSvPPVs1KHaFb9R7DsJnRzvI2K6TX1RpSRYGsCGJ9tOPpcWG+WaDUgi/Ylor/v1+y5AD+VI3pcsHe0OapIEpDBtUkUcFcfpQqdDk9pXjRUvQciWbw1yP0N53chax2tn+YwhT7jS7e/fwehoujg2UabF/HP/wCSk2cveWdK1bUicFUfBbxhrXz9tUvTmV9BWb1WFWJMayvbIJoP7EiHFTyObf6mSeIt/T7LDi0mNjugWl0I9+zFNg8FFeU3ijkTzjlTEwjpNknsqzPK9BcK2K0TZVXT5OFkW63/6n5sB6J/1Q== 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=hfaHUhbRyFa1HNmcSpumz+kghFfvZXfWDVh7vE8MydY=; b=i2LG+FQfnD/4rvTHceUaOYaKLgIm7rwdOL9GRUByi5CtrkEDs/y30FVEE9SRybESzbo++AYIjoDd+Y8w2GsmYZvM/dCH2grADNRpGzVf63wUWXUKWabakjB5nd4k9mLVD+M6Yf7IMUyo93d42auFvluqNB9tnrLAcrnFXwuXwac= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, armbru@redhat.com, fam@euphon.net, stefanha@redhat.com, eblake@redhat.com, hreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com, jsnow@redhat.com Subject: [PATCH v6 07/16] block/reqlist: reqlist_find_conflict(): use ranges_overlap() Date: Thu, 3 Mar 2022 20:43:40 +0100 Message-Id: <20220303194349.2304213-8-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220303194349.2304213-1-vsementsov@virtuozzo.com> References: <20220303194349.2304213-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: VE1PR03CA0038.eurprd03.prod.outlook.com (2603:10a6:803:118::27) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b655ecd5-f2de-4e60-e8a5-08d9fd4e2f98 X-MS-TrafficTypeDiagnostic: VE1PR08MB4736:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IWFMXbDEAuMdRsjrmZVhm4oGzyvG2RO7VeENwo8k9pVKI5rY9rwcthEWmxhWqicxpCO08eJNjZrzS8RnMALb05PWSIGT4qbCUGt7EIzKVbuznkdlNAi9K6EfaPHX1CdMa0gMg8R1+jfHzkiDN7XUQ1g6gIGRvYGHXP+gyR4J+fOf45yoeibyEpM7yerHoqr0qjLJY/LyYmozZJGUiCGLzaRy8GDEL+MStWRfxChcMB+vwE0gwXPgEzRblPNt6zRyCcO9z6hv2NnYP2TFVgbergyBdfMEOLoekdw+xL88pvvT/wbe3lpyfUyCDbS75xpOOSRxWPjlFYPg6JA6PI0tslrQUg5dPlIy0Hr6s2rC6FL4dD6tt5L/9R8RGWaFU3kD2ekZgK/wN5In0qqPF/Q/YM6mr5TpndUKv3EYyC61gGJG3guQetypL83dp6HnrvcELeZ99DRgAFh22GHrULmh83fWB9b7bRgDBk8WNLd8aYU/mPagI2994t/g/VKsT9pB7G6KEbzq1UEHkH+zvFOPGcBwKuF2L6pBnpQNFAhYY6nKBPY7xBVmCofIL571nD6oZJ8gXWXarm5XsL4vrx8iqmoLTC/9BDrsCKJv5skyqfe57Wo4a49KUgsa160JWHgtfHy9zmGxmNwMA6Va+x1bsJy8U9bf79mlAYvXnQy8tq155AwuGc/3Co3w9POg1A48uXCVE+/dbki2S1KwBdgPPA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(6506007)(6512007)(26005)(6486002)(6666004)(186003)(1076003)(2616005)(316002)(6916009)(508600001)(36756003)(4326008)(8676002)(66476007)(83380400001)(66556008)(66946007)(4744005)(86362001)(8936002)(5660300002)(52116002)(38100700002)(2906002)(38350700002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?+abzVjYIvRxZObYbsJ5PtqOOlfZi8V6eEVdcnfSklhGgD2J6LVXjZVTmq9Kh?= =?us-ascii?Q?lr/LjAUyPgsz8lknFnAP17eGNAzjTXCnmN4S/cAX00vi/QYdYiZFJ6pI5+K5?= =?us-ascii?Q?H9vdzQ7Sx/wChtqsnHs6pH2bczSLUIhFxfZ9Z2Dn7a1fUr/9owDMufhZjosh?= =?us-ascii?Q?l1M8VFIa2JcyHFATAZ0kpu3Cn3JK5tXCxheWUWz/eaLzxrDxe0vX2ZpE4N1z?= =?us-ascii?Q?dRWNjZegmPYdN6yrml+JKSKztNDVbOUE3CGeZHyZ7kyIXIkQtLZKiehnuV4M?= =?us-ascii?Q?07bEHWKz0dE5m+CC6Lx+3DvvCERteqT8LtSpw4HfLd34faxHAFMJgFnqeDV3?= =?us-ascii?Q?o6bX23y+SnLHrfTp+chyYpGvu2bzq7MDJCSKL+p9uT+qRk2sF/hrHXPWcjAV?= =?us-ascii?Q?zyK8X+GFY/RsKyXq+IV8/OZ+RQ3G0iCtcbw8/lYgSaZHYEFQNn3sxO0TaMf9?= =?us-ascii?Q?8rFuB3Wg2ZJtBKFMShsDKbd8llD+T58puVcKv8PYkfgsoa1ycV5Pj8X+hZj7?= =?us-ascii?Q?Lt9NcXgN+bdnbhysRK7Hf1rkioSKfd4rEXcmO4Rwo8lC1/aHa5R5r4z+02Dl?= =?us-ascii?Q?hTPwu+oqht7gXCtK41IHS6bf/4LTCpHlxOLUxUxyjHfV+71mD37s8MFZ4IlP?= =?us-ascii?Q?DaUmhEe8oJ9zIyIb92d6Cp6/dOvRTXUGegFUhCOUNZRQ27Vq9r2zgrlNXXqg?= =?us-ascii?Q?b4XpoSELfTOxA9kHZPhfohW8H4gzyO+ob1C688soRIsEvjolnLY8i7Hw7qV6?= =?us-ascii?Q?vxce7BMvyKA2ysCSDh2HVr6Gy2uoRZeQ+l5lhLegJNgIt4PkPYoFxJMZOOaK?= =?us-ascii?Q?7rZ2Cqp2oVCVN2J2+EsLDTD7gK7POY0a4AFItICwEi+yFnc26ABvOT6PJxYB?= =?us-ascii?Q?EMXIPnQ3h9L9wlNavpuqqdrDnYZWPY04SaqRh1JNwaKWO0dfZQ6IqRfpsUIP?= =?us-ascii?Q?H3zrnV8DHtTTGLr9BQllQKBLYHqZVio75tdlOlibFtnBFxww/weAg7EQW0ke?= =?us-ascii?Q?mIALEtN9fE7ebg2ugBM8s/uxxdOFww6d33zig+1USruIYigiV66hcO3mwJV8?= =?us-ascii?Q?aTEibpgEm1iq6ie/Jqnh8lsIVoUw8bnbTXk2UKGr1cmZmr/RW5CRSo30qZpS?= =?us-ascii?Q?3E0cvgRRAMFKUnKmGoinYbHbNaxGUkjGf4HLyf1apb+6X0cqs13JLTYXYdWt?= =?us-ascii?Q?4UqfWzzyJalX+u8j3T1b6pOEfPCqXsJYvSUiBVsF1+XfCloliyFs+QydiVAv?= =?us-ascii?Q?D6yRxxX/mA0sUHGoTp/QZfW/k0H5cY1xhr47RjHou010VLKJZU5TUI60+QEP?= =?us-ascii?Q?T/zBdevbrGoXEfZRfqLnh4MD55bENBNdmutF76CI4OYVIeWiaa8NnmbgNzSG?= =?us-ascii?Q?hMpVHrvuYv6gNqf8caCN+Lz87pPdCzZVTdXYnrAaOxk/3tmuIOcyKoBMsnin?= =?us-ascii?Q?AdXyALlfGA5tqnaD0HobBiPC0Bt2uVqbMPHq91SJ4Qfsi1KJ3AkrQVmUi/Oc?= =?us-ascii?Q?nBlBkUf0NmoXQux+DyiGKocG+EnzFaHNp7iFg8UyhVVWtJv2EM8wTZdDhcqa?= =?us-ascii?Q?Kk530HS1FER+vGjWBWYHtwTFVBbI6CAxbL0jL3xfTCoApcv0ad3oxVVyqGxS?= =?us-ascii?Q?0sY3WF2KOJbjcTnafTRI0bGlSIdOI5Iy4ujQ/pLK14Vzb3nP9yJD9neShQHk?= =?us-ascii?Q?spTdDw=3D=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: b655ecd5-f2de-4e60-e8a5-08d9fd4e2f98 X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Mar 2022 19:44:09.9024 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: qV3yE9YA7BnR3ApAhQ/cz6+zQKJoXcuChffSQMVCtaK6VneizEEJVeiKQbdac/I/Jqxv1zwhvHtZIBBClGZlVpmS86BiNqbxv/05okgxeHY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB4736 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a01:111:f400:7d00::710 (failed) 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=2a01:111:f400:7d00::710; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1646337067136100001 Content-Type: text/plain; charset="utf-8" Let's reuse convenient helper. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Hanna Reitz --- block/reqlist.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/block/reqlist.c b/block/reqlist.c index 5e320ba649..09fecbd48c 100644 --- a/block/reqlist.c +++ b/block/reqlist.c @@ -13,6 +13,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/range.h" =20 #include "block/reqlist.h" =20 @@ -35,7 +36,7 @@ BlockReq *reqlist_find_conflict(BlockReqList *reqs, int64= _t offset, BlockReq *r; =20 QLIST_FOREACH(r, reqs, list) { - if (offset + bytes > r->offset && offset < r->offset + r->bytes) { + if (ranges_overlap(offset, bytes, r->offset, r->bytes)) { return r; } } --=20 2.31.1 From nobody Sun May 12 02:11:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1646336939; cv=pass; d=zohomail.com; s=zohoarc; b=fNBAqSQ4tnZ7z6poKpVxB9D9BeNm3ti8dTP5ftr3s+z2Lg6xXfyJGDyAt/pBdAcbnODYdDvukQdZ08PJ/Mxt7jMY4oDnJKiaJckM4BP4huqTqW2t48GsuiLPidU5bq+UdkI7xyustDrrDEJqh8jGb8n/P9XQt/eL2K5VQz4HFic= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646336939; 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=ZwcI7D71CBJ848rjRlKBiBn8VxIYRQiF2qTE9/or4IU=; b=Pn49xk/tSM9NENqbZkHBPrPL0OiMr57s45hVBRWjRUClZ9MlVU/1nYBipMxL0+9rAkZ916oWmOhILri3BT3S9Yi0uaUIARYY/jt7+VJduPOEu4kc6zJpiELW/Ax03FTmQpAB1q7VKW6jAWlslnvRL3TNXgB7ZY6zFItG/v9B4j4= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646336939230333.7708929599146; Thu, 3 Mar 2022 11:48:59 -0800 (PST) Received: from localhost ([::1]:51924 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nPrRa-0004MW-Oo for importer@patchew.org; Thu, 03 Mar 2022 14:48:58 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39112) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nPrNA-00042n-U1; Thu, 03 Mar 2022 14:44:25 -0500 Received: from [2a01:111:f400:7d00::710] (port=7585 helo=EUR05-VI1-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 1nPrN9-0004Xj-9I; Thu, 03 Mar 2022 14:44:24 -0500 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by VE1PR08MB4736.eurprd08.prod.outlook.com (2603:10a6:802:a6::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.26; Thu, 3 Mar 2022 19:44:10 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::4545:8e0c:19c7:2a6d]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::4545:8e0c:19c7:2a6d%5]) with mapi id 15.20.5038.014; Thu, 3 Mar 2022 19:44:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fFthBNjgUs3IN3zwTrSo7ZJhTOb9kiJe/HIqnV/PZoXHpNBcrtPsr7SAmvgm4D3549qh9BDT8UeV7Fmv5FOxFY+As9+uNUqbCRlYJSudqYcDoU73SvGhjgTUpgDCzPWxWsjA+9vdcE/eCT6mwLlSivUlEtJYvVDWfRFmz1xXoq6Wvv10DgTjyE1l5lOaRE/PiYFwXaZMTJoGsY0XhfhNXSJ1g/x2oMvWlEMpHNJk7LMyZQ0g5M5t7L4Msbcrd8EnWL/h0aINznp1wam6XLnu5IBs22LxaMq2dEuM757/zNl90dQRexUqF37XfC62OacgxjdnO1kqBSvAJjTb4wJpFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ZwcI7D71CBJ848rjRlKBiBn8VxIYRQiF2qTE9/or4IU=; b=oTOzsyMuvXGbBa9uwosxXfyZpUQeU+5Gvtl5LekpEkAMGGnmVX37B+rrCW4eEkzAhGj2ndyq0FrVjw5BZDt4FoWrYxhiGWKXZiJ1DCJnw4YAba4bRabsGvfQHgtSLBRCYVq7bI+WAhkUgpyUMksjGYZ86w1E1+ez6nOpaShsBZ/3SRTwwYwtklJbD5hjPCybA0wnCls0Nv1iyduS6E6TSoerpV1idtt5Ol7jVrMJoqcP32a+6WEmhYSgBTEQXXDthnV8CAZrRULyc6Yfo61SBMR/hErDGGs8889NEnfDxNxnigvj4buEL1+jBp0vo4KI3r70wUHbY/aqzDcCAbZyRw== 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=ZwcI7D71CBJ848rjRlKBiBn8VxIYRQiF2qTE9/or4IU=; b=NOmlevVr2p2AKOe9kTQOnnGM8eI41U0FReB1w08qelGPH3QPccvJrN10tgID+Q2WHBwvzuXY/r36jnZwokFqf0G0GS0KiS+NXWj2of5ti3YQSIgBvUPodkne4394Tl4lmjtfef7QfLbf0rjuBp695VckGXwgrR6YOHgdesVK4e8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, armbru@redhat.com, fam@euphon.net, stefanha@redhat.com, eblake@redhat.com, hreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com, jsnow@redhat.com Subject: [PATCH v6 08/16] block/dirty-bitmap: introduce bdrv_dirty_bitmap_status() Date: Thu, 3 Mar 2022 20:43:41 +0100 Message-Id: <20220303194349.2304213-9-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220303194349.2304213-1-vsementsov@virtuozzo.com> References: <20220303194349.2304213-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: VE1PR03CA0038.eurprd03.prod.outlook.com (2603:10a6:803:118::27) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: efd4a457-088e-445a-73a3-08d9fd4e3017 X-MS-TrafficTypeDiagnostic: VE1PR08MB4736:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nGf0XPgMSldWnjl2CYifDkG3CZ9kOLTb9O455vN7KAhSiiGg5xsQhJ0qBbGjnMPkYpnr/BGOMIddD4a5XeMSjc+G3W4A8CtIT6tIgIRioH8+x30axJbBIwt+ja0wx51QV00vyLB4b/cWgfbfOnMCWWIVDxod6DTgUMYe9nNDUfS5k3cvy5XSfFO1P74r2Ip9HN3VB9v5iSgyD38yrchbfeoX8KiyH70opdqAssq0p/jIOTxMmtkNJAwUqsw4KNP/7z1QbmrkwYkL9QOt47J34XyhVQ0s/qzj/d4MTJyuzNga8s37ZaKQMVzmLQ43DyZdfBh4/jyadgcUmgjIipDP/fIGU4oOJKRUqwZQr0+aYx974inxxmKj0DZpiBsqh2AuEEq37zQfjCmNEnhCvl/t8FAUb57Tm8v8RvlE/wT1DvNYDWuDDqKQSo3FWt/p0xamy0bo7U61l2CB/qMvkAAGmutv1KQzgcV7RgjuvbWATSsgttxdOWEDr6CBdND2XJQ/boYgodWhwCJSxWpO8N8JkjMiwcRVETH7r2k+BzLsqsGLpxWatlVR3nVmS07yAWNpMxCvPcinzGcWAV8fvUoLYUrzAcY/gVRU4S37+TL250tbnhGa2l/Ogb4HeWSY+YLMukxzvflq45XjEnwFNlE3480Ndm+zyBfXPqAMCYeda/ac8uawk5lWxci2AIkb0ngjW6jF3XTxFkS4H8usomRuUX+XLOpurcZD096KMxviAG0= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(6506007)(6512007)(26005)(6486002)(6666004)(186003)(1076003)(2616005)(316002)(6916009)(508600001)(36756003)(4326008)(8676002)(66476007)(83380400001)(66556008)(66946007)(86362001)(8936002)(5660300002)(52116002)(38100700002)(2906002)(38350700002)(14143004); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?JGqQM26wfLLeCj4eJPxoPoI/Ry+l+bAVyKo2qsXKUAaIE/mgQSr77tpO5vaP?= =?us-ascii?Q?UKxNinfienprAiJM4YQHwrTSs7KywTsmirzhOZp2Ud5avla7cnUv4QoTv/xN?= =?us-ascii?Q?BlUBD7PRtgQpzTYmbIEBgsamvnxFMAagTtOQ2jowJqrJTIW/52XJDra51k1a?= =?us-ascii?Q?HycpoolTW9xmtK6s8NOreRBtSXK7ryHww9vKMhp/LShGazv+mBudjoMnq8xx?= =?us-ascii?Q?vNwhx60et4faYUwzixP5cGjOZlxurBxBMDMSzCajp/i0ZyjAPjscDGHJ+Vmm?= =?us-ascii?Q?tLcPlCKaDxISQ0mcvzO2WuCdavtQq4NdR3+F+N/BcUhNIaAOC2nhrg6tT55E?= =?us-ascii?Q?Z780IVhJYt8jgpqbV9YqvXsxIYnZV6snUEls9W9/nuGCiC8OTc22H/bhNeMh?= =?us-ascii?Q?F5vxP7yjyUfuymc2YjQmBLtsC0keh0c0M1elscdiTShn/+/4/m7FYg7aFK5j?= =?us-ascii?Q?FCzFPepTG1k9J5Oep0BD3hU33qkhobSJ2P+u2nT3LoDTggmRfXTBPDM33YPs?= =?us-ascii?Q?xtGIwbylOd3h6DjLdhQZsOhs5O138z8xuJISVrmvmy58Ef+n2e8+OxSESQ1V?= =?us-ascii?Q?huX3MzyFK5X1UFFG0V15kUHftLVkJIEYtp2EBEF4U46w6wHmkGkZg77zgF/d?= =?us-ascii?Q?mAu4sMczdGsVOtprq20jZ0/HLFBYK+5ShlP+XzCfaE/8/Rj2tPBvpwZscU5w?= =?us-ascii?Q?Bxvl3cAJ5jBmKnbjT06NjQSroOTRETEihCvJf6HAZM2bW+MgwLjt8HuIasDL?= =?us-ascii?Q?pVheZRRGo9OgumZVqXXSYqkadgN/zap2JMM/ZUCS/fEe1mAyi9JKOgxa8qVq?= =?us-ascii?Q?E1LB9sle4qXCz3wCovx9T4Ih5RbIbIG8SZnPH7ZE2zV8xc6MMdhUiobfTLdq?= =?us-ascii?Q?HNN88aesV2GHjWY2PTY+4ia0ah2mUuP9/7WRvCSfBCv2XcXsfwCZ8ekPqzU+?= =?us-ascii?Q?YZelPvhtwaT/KcloMP9S4uyceIUVZoaTF/eU5vByHskLH6Gjxl37AMmw64pC?= =?us-ascii?Q?sq76MaJkBlnJTWy1xGh/7YY2lqQ5oc/NXm+Gj4j/jnu7IGkZQRaM+8jaRF2p?= =?us-ascii?Q?XowcQjG/xKf0hEmtgyOtbyrqaNcTDai130PavvAMmkqzuffwKSNyXEiYrd/8?= =?us-ascii?Q?YY1DAcFT60xAk8iLCGOiQeJmI4k06CMyMK67tLYGrsZPU/zm3AnQVdfBsiSj?= =?us-ascii?Q?UhtU3SxfdQJAdoJytcl3s0lA+0Tj4pabZx4tXS/dFIEIsSjaXKsOfgjibnYZ?= =?us-ascii?Q?i3EeFIazSRip1DOCDCIeqDC1OggfDfISO7/mbWBeWTDDz3f2YSPdse9p0AuS?= =?us-ascii?Q?svrS5Khbl9psA+D5awNaCSiS5oBaB5yIKVM+Cwz5iN8NqrLf7ayGLHcUEtW0?= =?us-ascii?Q?UWabP4TFCjBpRU0Se3TelLBn2yGzfZ4/it2hb1UGhAoJ215zH4Wzpo7y+NnD?= =?us-ascii?Q?eWfebAaPOZLw0ujWWQAP2aLZG3pLJSFGQcjozMn+Bh4OqImHkEJpGgyp50CA?= =?us-ascii?Q?Gep++sNQoVmq9OrihvtJiVZ1VNGDNxuF/NdAifplBNpDdgwIPvNHwXorPE/4?= =?us-ascii?Q?Dyb3EXUoYDnmNYJR1GBDQ/5aAVo0tRO2sH6zj7t4AEaMZhN93lDYhhVHM0gB?= =?us-ascii?Q?vaHT6OyzkgTFUsMEgL2LNwqpRyFGG3XvH4V8dIKe9moZp/Ap6UoYcBSexSwx?= =?us-ascii?Q?QGDsDQ=3D=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: efd4a457-088e-445a-73a3-08d9fd4e3017 X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Mar 2022 19:44:10.7017 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: WvDN1I28Fqjj1Dw63VUdLPEahVw5EX177hE8zAIM+Aak9d8BQa0hLfmlwtDXboM5p4GUDJV6IQVvtBr/etjje0UEa9A+CKtunCUCumCjPQM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB4736 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a01:111:f400:7d00::710 (failed) 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=2a01:111:f400:7d00::710; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1646336940814100001 Content-Type: text/plain; charset="utf-8" Add a convenient function similar with bdrv_block_status() to get status of dirty bitmap. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Hanna Reitz --- include/block/dirty-bitmap.h | 2 ++ include/qemu/hbitmap.h | 12 ++++++++++++ block/dirty-bitmap.c | 6 ++++++ util/hbitmap.c | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 53 insertions(+) diff --git a/include/block/dirty-bitmap.h b/include/block/dirty-bitmap.h index f95d350b70..6528336c4c 100644 --- a/include/block/dirty-bitmap.h +++ b/include/block/dirty-bitmap.h @@ -115,6 +115,8 @@ int64_t bdrv_dirty_bitmap_next_zero(BdrvDirtyBitmap *bi= tmap, int64_t offset, bool bdrv_dirty_bitmap_next_dirty_area(BdrvDirtyBitmap *bitmap, int64_t start, int64_t end, int64_t max_dirty_count, int64_t *dirty_start, int64_t *dirty_count); +bool bdrv_dirty_bitmap_status(BdrvDirtyBitmap *bitmap, int64_t offset, + int64_t bytes, int64_t *count); BdrvDirtyBitmap *bdrv_reclaim_dirty_bitmap_locked(BdrvDirtyBitmap *bitmap, Error **errp); =20 diff --git a/include/qemu/hbitmap.h b/include/qemu/hbitmap.h index 5e71b6d6f7..5bd986aa44 100644 --- a/include/qemu/hbitmap.h +++ b/include/qemu/hbitmap.h @@ -340,6 +340,18 @@ bool hbitmap_next_dirty_area(const HBitmap *hb, int64_= t start, int64_t end, int64_t max_dirty_count, int64_t *dirty_start, int64_t *dirty_count); =20 +/* + * bdrv_dirty_bitmap_status: + * @hb: The HBitmap to operate on + * @start: The bit to start from + * @count: Number of bits to proceed + * @pnum: Out-parameter. How many bits has same value starting from @start + * + * Returns true if bitmap is dirty at @start, false otherwise. + */ +bool hbitmap_status(const HBitmap *hb, int64_t start, int64_t count, + int64_t *pnum); + /** * hbitmap_iter_next: * @hbi: HBitmapIter to operate on. diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c index 94a0276833..08d56845ad 100644 --- a/block/dirty-bitmap.c +++ b/block/dirty-bitmap.c @@ -875,6 +875,12 @@ bool bdrv_dirty_bitmap_next_dirty_area(BdrvDirtyBitmap= *bitmap, dirty_start, dirty_count); } =20 +bool bdrv_dirty_bitmap_status(BdrvDirtyBitmap *bitmap, int64_t offset, + int64_t bytes, int64_t *count) +{ + return hbitmap_status(bitmap->bitmap, offset, bytes, count); +} + /** * bdrv_merge_dirty_bitmap: merge src into dest. * Ensures permissions on bitmaps are reasonable; use for public API. diff --git a/util/hbitmap.c b/util/hbitmap.c index 305b894a63..dd0501d9a7 100644 --- a/util/hbitmap.c +++ b/util/hbitmap.c @@ -301,6 +301,39 @@ bool hbitmap_next_dirty_area(const HBitmap *hb, int64_= t start, int64_t end, return true; } =20 +bool hbitmap_status(const HBitmap *hb, int64_t start, int64_t count, + int64_t *pnum) +{ + int64_t next_dirty, next_zero; + + assert(start >=3D 0); + assert(count > 0); + assert(start + count <=3D hb->orig_size); + + next_dirty =3D hbitmap_next_dirty(hb, start, count); + if (next_dirty =3D=3D -1) { + *pnum =3D count; + return false; + } + + if (next_dirty > start) { + *pnum =3D next_dirty - start; + return false; + } + + assert(next_dirty =3D=3D start); + + next_zero =3D hbitmap_next_zero(hb, start, count); + if (next_zero =3D=3D -1) { + *pnum =3D count; + return true; + } + + assert(next_zero > start); + *pnum =3D next_zero - start; + return false; +} + bool hbitmap_empty(const HBitmap *hb) { return hb->count =3D=3D 0; --=20 2.31.1 From nobody Sun May 12 02:11:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1646336803; cv=pass; d=zohomail.com; s=zohoarc; b=YLqxF2sC03sG69lbh7FxdvjL0c8++grkcv+SKCG1J3zErgQlhgqXuKxVMsKsucYQvRVl4r+9peZOsxN7OTNvqBIFPmgkM8prsns2gTpYuSF+gkkrw5FRvcM5rMzhXuZkfMVlmzNJ93eNLHkOAXJfB4S86/jQu7JLvQc8F8CAKAc= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646336803; 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=HwtkRFZsupCHj5xg46xDbUv6v3iJOt4sHv5qvsVGsLU=; b=g0YcgMF0Tsbq4JfSbLR9uduaUqt94bxCMo3EgVJ9TZlwOGqtObuy3MNyW8KBCeWVGoUrnWdv4Qjh2Ii2M6i2ZkO4bOfBpu9Bfh6gAgyxkt/xA+z/MuXMLpiuLYvgaMTMT9btoeLDNbnr/gjmeSve01+VnfZwxEbNthO6xZBcp9M= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646336803639714.5628709521307; Thu, 3 Mar 2022 11:46:43 -0800 (PST) Received: from localhost ([::1]:44148 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nPrPO-0007bw-4p for importer@patchew.org; Thu, 03 Mar 2022 14:46:42 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39114) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nPrNA-00042o-V4; Thu, 03 Mar 2022 14:44:25 -0500 Received: from [2a01:111:f400:7d00::701] (port=54113 helo=EUR05-VI1-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 1nPrN9-0004Yn-FN; Thu, 03 Mar 2022 14:44:24 -0500 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by VE1PR08MB4736.eurprd08.prod.outlook.com (2603:10a6:802:a6::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.26; Thu, 3 Mar 2022 19:44:11 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::4545:8e0c:19c7:2a6d]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::4545:8e0c:19c7:2a6d%5]) with mapi id 15.20.5038.014; Thu, 3 Mar 2022 19:44:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qo+F+D+37A5pPjR7JRWX0umf5CqEDeS8yBzvJ8GWwBJVXDoZV5PVijUdlqfveXzsjkle8+y6+84EboVjX5ugYZD7hgewUCt6HS/7kVuej8ErOdwSn+iNcIi67HWV/CodtlhvspRDeDR1PVH9vsPfvTmFKOkLEpGiQpol5eWHe2YVsZ8VySzp6cXgIntTPKdnWixEOfLVrhwfQi5Mlrtw25SXWsH47MiWiO5CgdLv7tCNL0KJ0/m9Dk/0jUU6U+3PQF9HsncHmkt2pBNtU1JE89z81oG6TdDUN/bKGLjpswvvDwazWbDriSqLT8C8IMX7WBzZOkCNNOGup2SQLojuhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=HwtkRFZsupCHj5xg46xDbUv6v3iJOt4sHv5qvsVGsLU=; b=PLtKk3LPVk0wPi3VPg+ZXvFQ0fOeGrI/drhAOs1JIwbhsKMmLtJETj0x5AJ/RUcIkBViXIJ/hK4Fpn7tV+IyRLuddUzBbMNRBiGMKww8eCrdkezVdJah1QdiGcE4PSvDr0613b8b1MRPyof9SL6BsMd+snocvKRQZuAoFnWPftOvNvHJwcJMbsJsyuIDsioAezzvMnNfGrUrMpaMMVK8slnsal6XkBDqP+junQa+f777OWgH6FoxOFiGse6rBEuO+a6xwwLb80AyOWqBTdM9YNs7BuraudjP82HTMt33/VscKQIbKwCyoID3O4NYK8zSFANh/4M4JyYfzLNkOWdK9w== 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=HwtkRFZsupCHj5xg46xDbUv6v3iJOt4sHv5qvsVGsLU=; b=sDa9XfecpTH8qux/8qRryoZmO3wG4gFsC/dJ8s5XdV5rrx5B5EetTgsq+spxdBIvymdrQ6cng9qAGTMBT06ijm5UeQkhf+VMUuAyx7hjwNfjaeA4B2TDgDVCKe8PxoFzHykIFcYtsI4kKyYVccHhe/DiRDDDuCzZITt39xsYD48= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, armbru@redhat.com, fam@euphon.net, stefanha@redhat.com, eblake@redhat.com, hreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com, jsnow@redhat.com, Nikita Lapshin Subject: [PATCH v6 09/16] block/reqlist: add reqlist_wait_all() Date: Thu, 3 Mar 2022 20:43:42 +0100 Message-Id: <20220303194349.2304213-10-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220303194349.2304213-1-vsementsov@virtuozzo.com> References: <20220303194349.2304213-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: VE1PR03CA0038.eurprd03.prod.outlook.com (2603:10a6:803:118::27) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 97405140-2de6-4ce9-caa9-08d9fd4e3095 X-MS-TrafficTypeDiagnostic: VE1PR08MB4736:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: s2B1+j4dLC3xGzRXBy/tqJ+AOsI417bUuXioiNExpa+6ssSVW8WHgFmZgG4BH9NTJz4reUvSDMlqMgGw3lVBtXJeITHnQ9TrS4bXygSKfIGElRJk2N7ZQfO4yXkPE6YFal09BWUn7Jg1s/QveQd6Vvl1Su8ogrSR269Q3Gohnc1tQ5k4c3kHnZ0KW7CcS8JgJqaIrWrMAYNkGGOCMK0FUvG2s/VO+y6uHu7aY/Bu/ob8Hjt2EIyphmJSD2D4dZxHUk5q5wBpPqVXA+CTFhC4GnaRZvXONTrx0eBtjg9mGUeP8ATlMshw7/yw+ZFC3tKUW6jyqCqzi1TmSljBlS5LxnpqARc135DzciqcRtS+WI1b0F2jdHnwmoS3WtKy/glVgqFWTnyF+JgeWMFePmvTqFFVE3wL4NS9GN+zR7IqXnRqxMooMDdkpjWTbEHDqn9BJ4RG/pDP2hemVvdudYE8ucO45P/cWMhSCFM67l3qnZZeOeRDNw7R0+otR9aDF+O4pnjnZJ71F7WoAF9jbRmsk4vQDUBRgHl4pPSD+f4HgduP16i84989Bm3yaxOKoVEOZctvXkJ93jHu8b6XZFBnO56/xyGMyZNOPobUqDhdgXoxopiARKynO5BCnJ+i2FD32dLsNTOyEqUYVQKcUM/bIry6fFaL/bqnDjQ/DT/DbwRzowHqKEjluWQkPKkePnQtpo+HnU4qyErhW3qXsIsdYw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(6506007)(6512007)(26005)(6486002)(6666004)(186003)(1076003)(2616005)(316002)(6916009)(508600001)(36756003)(4326008)(8676002)(66476007)(83380400001)(66556008)(66946007)(86362001)(8936002)(107886003)(5660300002)(52116002)(38100700002)(2906002)(38350700002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?1dP0KBwCRi36gch+2LeGLwKSMH01Ghsys59U0qcqt5YX1IyCQj0ilqujo1jZ?= =?us-ascii?Q?DELZ3xY8HbhBzAHen7pPmi3FBAAT/LIh1REvsfQiCmnWGY47zdj/75r8is4W?= =?us-ascii?Q?034rWAutVNl5hC060DnZIeXztI1reFmEIuZX6uCrRAcM5uw7qHqE6fCzfjRA?= =?us-ascii?Q?pkTFBn/x137knPh2isJC0bS8+wQt60t9413EGfLZCwkfEwHdFfGJchb0x2xi?= =?us-ascii?Q?3L2jzumegpgc7BovHlai6QMdbsUpbI1tWyWikl8qq0miP0p7DzQR0wqVPjPH?= =?us-ascii?Q?zPii/ZX/l6eROhj9cdjyPQLlQ3mO7NolSR+udSWkZQi/uf/3qgWtl9iSW+88?= =?us-ascii?Q?bDmk9c/1Thgt6pXdajvvW/1j+jtrU7vVKXX4QTV1mFbHXrqfKvbFAGYUv7dS?= =?us-ascii?Q?U8dghiV+24pVINUIPeIzd2VjoDQLZ5SI5Ors1tObIZlvLpQ8gZR8wmKj4jft?= =?us-ascii?Q?TwWcTH8lY1QPfe28A5baQEZY6BqemWcFh0xWfjrGpO69fO4sopJ3B8XQHlLN?= =?us-ascii?Q?0syP6zQyccH7pVYWKMOHd8CUZFYfaALW9r/t+r/ap4y57ui5djg6xWo4SrOz?= =?us-ascii?Q?EM3PZLgs2t6nsAsIZZhCe4D/gnMp/0gcKHDBeTZgKgVNHhe7fRugliZvBljD?= =?us-ascii?Q?kR3b3+HOQ/WyxUD/HeIVZK24yJasCVZcSFXAChYNET6WFSnL4RR6Ij1MVoNl?= =?us-ascii?Q?WUMrZKeRKYaPlYFGi5wA5qRmel9XorIM/Y8A+0rkcXGngne+c1o0b1tEH+YH?= =?us-ascii?Q?//o0XZTEot4g3moGmwCnVB4lXHixsnsqrg896AqMgDdZbZSrvj8N3wOCFBKt?= =?us-ascii?Q?TnRSCPl+Sgw7qeif/1kmXYwKz2JYlog2MhUGd+QAcAJ23dRo+yMCtn1a/+sk?= =?us-ascii?Q?ppwP6ZSTefF3LYmo+RzQgrrxr+FU35HqE51/b1tNnik+zLOIKQNZJ1SII4Xz?= =?us-ascii?Q?gCY4dBaJD++gM29wGpDCgDtFoNZMurMcUO495O2kd0uKLUt0eOJ7bfqJocAi?= =?us-ascii?Q?jyu2yutg6ft//jhsTa0UIMVs89mu9bYx/YAvq8IjuQcNJgc9UgdpGmf/WKkT?= =?us-ascii?Q?gp0oDNfSz/jIeKmUvSZR3xz/f9BrTLW3lRex5x5ZNub0kGqotHUWrUKPPs38?= =?us-ascii?Q?E0HNIRICjQgH1eSwZbfIni1+kzrspVsYx2KUD8eXZi8qsnxe1bq69doZmoEU?= =?us-ascii?Q?Ie01w/5r8rJuOm2oSu037/K7ckqv8OFrVgyr/2jyydsDI62DQ965oi4O5Ka7?= =?us-ascii?Q?Ebzwz8btMZy1Df/GQ12sxHjnfxyj47fLM8S52IqlzuPXlA7VqBtDb8tTvrW0?= =?us-ascii?Q?TDK5qCGsIsAYf1fKzZjyXGqBN8cMPHlD6nMP1I79OWMI/iFncbOTfZyv7A3H?= =?us-ascii?Q?oN2Fy5QaiG7F/ageW6U/N570BinIgIv9AYWuV2b0ePNMeIkGEBO3mZi6o0wh?= =?us-ascii?Q?Yc3bgVYgCnvKpignmp6PLvaQRm+giL5TwZv9Qy8nMA45IUKX1J8tM8qwDXov?= =?us-ascii?Q?payXBYZfBTcKnzxkMUpMz6fDrJ3nahqU6CQUUgR9ifAPMOVToAmOFy00KV67?= =?us-ascii?Q?JhR7vmviGty5FYQVDCyiz0pmClS2KjvELiM3038kmln5DY/M8mmBWCw/TslF?= =?us-ascii?Q?DNEWZ1RpSXHCnNgbh9DiDNg9LMJleCryP1KBuoZHhbOoG5tyLZoGBYznYp+P?= =?us-ascii?Q?7hAQnA=3D=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 97405140-2de6-4ce9-caa9-08d9fd4e3095 X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Mar 2022 19:44:11.4816 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: l4AiKJSBvmjT0/RAzJY+O+RPpLBNj8qQxKEEzvbllAE6qoTqP4qd8SaiEy2Ov7LHri91Mb5Rpwqf8VclYbj0uKvE4kYJXjwdGHEYp87dU2E= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB4736 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a01:111:f400:7d00::701 (failed) 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=2a01:111:f400:7d00::701; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1646336805780100001 Content-Type: text/plain; charset="utf-8" Add function to wait for all intersecting requests. To be used in the further commit. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Nikita Lapshin Reviewed-by: Hanna Reitz --- include/block/reqlist.h | 8 ++++++++ block/reqlist.c | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/include/block/reqlist.h b/include/block/reqlist.h index 0fa1eef259..5253497bae 100644 --- a/include/block/reqlist.h +++ b/include/block/reqlist.h @@ -53,6 +53,14 @@ BlockReq *reqlist_find_conflict(BlockReqList *reqs, int6= 4_t offset, bool coroutine_fn reqlist_wait_one(BlockReqList *reqs, int64_t offset, int64_t bytes, CoMutex *lock); =20 +/* + * Wait for all intersecting requests. It just calls reqlist_wait_one() in= a + * loop, caller is responsible to stop producing new requests in this regi= on + * in parallel, otherwise reqlist_wait_all() may never return. + */ +void coroutine_fn reqlist_wait_all(BlockReqList *reqs, int64_t offset, + int64_t bytes, CoMutex *lock); + /* * Shrink request and wake all waiting coroutines (maybe some of them are = not * intersecting with shrunk request). diff --git a/block/reqlist.c b/block/reqlist.c index 09fecbd48c..08cb57cfa4 100644 --- a/block/reqlist.c +++ b/block/reqlist.c @@ -58,6 +58,14 @@ bool coroutine_fn reqlist_wait_one(BlockReqList *reqs, i= nt64_t offset, return true; } =20 +void coroutine_fn reqlist_wait_all(BlockReqList *reqs, int64_t offset, + int64_t bytes, CoMutex *lock) +{ + while (reqlist_wait_one(reqs, offset, bytes, lock)) { + /* continue */ + } +} + void coroutine_fn reqlist_shrink_req(BlockReq *req, int64_t new_bytes) { if (new_bytes =3D=3D req->bytes) { --=20 2.31.1 From nobody Sun May 12 02:11:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1646336845; cv=pass; d=zohomail.com; s=zohoarc; b=K4gkBU5RZ7NwGDHmuJFq1rM8YZhOTEIr5g7Vl7zC2pP0CDIeaJRG+3xyskCkIE08URBTmRJOUwtPCZFSPKzF9NLv6OMYVNlM31svytPTA3tVbGDye+gvdyZPJExHI2TpeoPXm4rFMqSuODA/dCV0Rqj2vVZnTgqwAPCfUCzFfso= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646336845; 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=Wk0CPYEsGMCibsoooULP+lClkB+WEx4/8kGPfI0xzIg=; b=g2UvqCxX5eUqruqlQbl5gvJPSFIJpsFGKo7meCVsOErcipE6401lybZy4FR0cCwbS8mtKmonZZQpJJ94rFNdPc/6EDotrw3gCI8K00o4UtuQakwrJzIrBEWhyaTnVMcO9ugMuz41bIMn2kbEvKoLqJfIVkK5Gfeso+ZdVeus2lY= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646336845474447.6559617926389; Thu, 3 Mar 2022 11:47:25 -0800 (PST) Received: from localhost ([::1]:45770 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nPrQ4-0000Fu-Ub for importer@patchew.org; Thu, 03 Mar 2022 14:47:24 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39150) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nPrNC-00043x-DD; Thu, 03 Mar 2022 14:44:27 -0500 Received: from [2a01:111:f400:7d00::72c] (port=28672 helo=EUR05-VI1-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 1nPrNA-0004Wu-4q; Thu, 03 Mar 2022 14:44:26 -0500 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by VE1PR08MB4736.eurprd08.prod.outlook.com (2603:10a6:802:a6::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.26; Thu, 3 Mar 2022 19:44:12 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::4545:8e0c:19c7:2a6d]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::4545:8e0c:19c7:2a6d%5]) with mapi id 15.20.5038.014; Thu, 3 Mar 2022 19:44:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BRAiqGuRRU7V3VtG6lYfox94ePjtZhB2RE0S1OBnG3AJFNe9xBz8HkrkT0tCn8U5pJJ1sQA9mOQRSxUPPp1CgnKT1vXKu0gDTNRqp4ONxt+nJ+KNhw3jEj1qjlaeUFWePSXLe2xE8pBbdtlYAY4wbIG94qJUeHK3HWkWhaPRmY1x+Fi+C5pQVLA7m0DXfa59ZIwhV5KEqXmh6llotGEYNo2lsInfkubMN+yoRv86YpSBEWY2cKcDR60UZ7v9LHw+xFTqWGJSwhbOgvEpy+V8jRatEjkPqZj2NVI2JbGqlI9RRvE2IUCZjrCvY4D4G7WSuWzALaJqL5MWG8swW1FlEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Wk0CPYEsGMCibsoooULP+lClkB+WEx4/8kGPfI0xzIg=; b=alFmtYkN2qdR7d99kaG6z784QpfNKja6QINaADOal2wL50NWBP02iVMILF6MlEvLK8dT6S6KWdpXewHuM84fvjjvTAvtxnRx/dyJgwGKcOKd7d81+z5d1niwGN7OPTuMvwhVzobVKkLZ8zz7ry+SWavLNcsbGqIGwjFM6wJmFFGkdlnj/lw4UrFYVZHL1dlm+VXvNqUuFbbNTLylQBvcUQkB1F0eOvYIRrfAnsgt1waKIKEH77qXVvGcVstL9RV3wSDres0ONi7y/DbgfkPDyDvWIiU+bTJrDviLmT4k/yz4YpXuPtm7fS5RlgvCzLHiAcEwtYghIcKLIfIHzCYu3Q== 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=Wk0CPYEsGMCibsoooULP+lClkB+WEx4/8kGPfI0xzIg=; b=ZizVFDRvHuw+nU+yO92e91NHIrkUtCmevRSdFfv0OZe8+XnBg6GOzYnxYvtIA7l7qhy8S3f0jyo5eJ4kCvUks4CSWlAbLcpUyb0J7MCaBQdxLEiddpkpWkLglJ0zsVOXTH5DInM7cMYL0YGtlRYIiLe4ZPi3Baiy9jasGp2SQFg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, armbru@redhat.com, fam@euphon.net, stefanha@redhat.com, eblake@redhat.com, hreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com, jsnow@redhat.com Subject: [PATCH v6 10/16] block/io: introduce block driver snapshot-access API Date: Thu, 3 Mar 2022 20:43:43 +0100 Message-Id: <20220303194349.2304213-11-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220303194349.2304213-1-vsementsov@virtuozzo.com> References: <20220303194349.2304213-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: VE1PR03CA0038.eurprd03.prod.outlook.com (2603:10a6:803:118::27) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5bfe365e-f716-41b2-4175-08d9fd4e3101 X-MS-TrafficTypeDiagnostic: VE1PR08MB4736:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eeJNGSYBi1b/8z8L1Ixq0rOtLaxRbEh+RTTvRm1n5Al+wnn5XszUhscgnRqwalpx/J+bvuAA5XbCPzSRmzw43u0uJpDuow7nnIz+BuAGlgJdwNthbvU1PtYFNTwO3z1j3V2GvEwDbqcXxKQCVUvn2j8VuHN87eClF9ty/+xi5f5dklXwPNOnCdXsclTctfeyZBIuqKYF5R93aoU99oXF7wTnCP7vNw2TfNF8v/TZk0VL4c8WUhHLZ2Lub4omciXWntZWeU3CeqCAU/om4sdB6Dl3ZCCJJMc9BnrBvsTFIk34LrFQvEgK0nEaCtsjDfDJ6IwFnJICRXiaqmsCTIZVnO5gyu75bYrseOTI1UX9pxsp/jCdXmOfOahciEWAf5FOUmQnowgdh9SAl3zfPZVtTDQtwZM8ahPuya4lJkPMLNe9bmIQNdXsrhRpaWSfV5GXrw5BScSowwNfKReFFBqKApCMocgBrcuGBYz+Y32TvwM5JEbp5lItrwOvuiYQS/XJ0jYBuaiqLf0rO1FHJf3idrLBB7hQBXhEJ0s3E9v8BQ8q2HcLMWw2NFMF9lobS4gHyIuJ3+Sl7/IH7xX4eymAhaRHJn7bcFcB8X6eRb9J2HBA+N/XKcocacf+67LEhXTeWvpqGM8+vaWXg8ILanHG4cqIq94E4azGRAjTOUe4nVaGBMgmUZuW6lAsyYyuQKBxIixDqUV/+eebzJQHBGdmTQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(6506007)(6512007)(26005)(6486002)(6666004)(186003)(1076003)(2616005)(316002)(6916009)(508600001)(36756003)(4326008)(8676002)(66476007)(83380400001)(66556008)(66946007)(86362001)(8936002)(5660300002)(52116002)(38100700002)(2906002)(38350700002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?h5vZ0n7+mDcXS3CvbGOYjVcf5n03JDA0+aGmXQDZJv1jgOgAJINiC3M5k9GG?= =?us-ascii?Q?R+WVeaqEjSjldjGD7EZxTX4om07LePCJMRHDgJrBvEOhEwwDzmh1PVTarEXp?= =?us-ascii?Q?GgqDcxszhAX6j73MBxZC6Q1QGGVqQjIDFb2oNM1UQWMuoJ6kzl3OtVOgcR2k?= =?us-ascii?Q?LWKsINEVh/vWqM5b0Tz099HNQ+pK4TGN6yW1WHxdT++l7rcHDYECksIvtmSy?= =?us-ascii?Q?A2JXBC3b/YWJFt5Lt9xGPp7Wdif35UHqS4ILG8+pMqhPT/WK9Jmj+J27EqJB?= =?us-ascii?Q?VlroJ+lU4e4hfW/IpznmjSUqnJ14tTb7m2jagwuBrRZ1qf3ByHUHfTYnpEu7?= =?us-ascii?Q?umdrAf3G4rrbLbnisqP/9dqU/Yn6adD+7S4DCjfitxdvkmVqomXFU3bGRmg9?= =?us-ascii?Q?tURVvsizv6EFVbTiaYc2p8zAwuWNb1Fl0rmn/5AMXtKo2tb+5NamUeXlKllA?= =?us-ascii?Q?HH1yaTlo5uF1pdBH9NW5SOD1nZx7TcqEAb6C+Bm6O2jYIqme6IbhqgqBZvGd?= =?us-ascii?Q?cWQtXttcc1rB7jYvutk8NS902p0nyl54r+7nG19bU9VkMEQRoIqGEbMRRG8W?= =?us-ascii?Q?/pe9uCv3PJ/tLLJ8Gt6K3kXYoKfXzpIetRKwJK5Ey8AKSBzR700O1W/osrTR?= =?us-ascii?Q?ciIUT6j/AsEfqplSb+08XtFhVSuna3oNn8fGxZ7NNE9y5T8bP3BOduhhBM0v?= =?us-ascii?Q?0U5Z79w26e9fd0VurnLd8Syz43cA8m2Mk6QWhZk1tcENuNlPPwKd6fTi07+9?= =?us-ascii?Q?ixmqGC4YCuDL2sIEtDjTY//siRfJdBJ6JBcT+Axj3a2CZE4LSRy0FgJplPeF?= =?us-ascii?Q?VIMt0a4uwG0ABLnRJJs0+4hVc8SC/zBhjIpRFJyAyqE8rnI9PtDLnHIkIihe?= =?us-ascii?Q?w2eVlL6Cfn/B9Am80nIttdiU6XzOky6UP4DbwyrB6YGUJkk+YLjviSsRfhJS?= =?us-ascii?Q?LbpOVI6aI0ZCb+bnnMeMhgL/5q++Y30o6tuCOeuEZ9RF7FFRR9a5YTuVenAt?= =?us-ascii?Q?SdrG9ImkPTbtGQEQhiuBF7X4wLxooe+OtrCPPWP0DAwS1gdKpb54bVkKdJGI?= =?us-ascii?Q?xNkT+lnrEnIHvukeLdWEzsEGqpK/RXFTLv79DuXrKqYo5S0w3u8sZEzO7bsU?= =?us-ascii?Q?+zKlNTdtRb15pJJzx/uujUM6/M1MDdJ0QUIr97LFdy8x111aPnNGrxyaBh+b?= =?us-ascii?Q?HqOvbGOHTG4AwzzDiC3yEjqnfM3Uw+f4SodGmV1kXgAu/ccjSJp467jyxtjy?= =?us-ascii?Q?ONrfD0S+zGlSqbAWbWGO7J1N6KHAJ/3UaxCR8CV0zgJOmiJ8VtcfMiySFp7G?= =?us-ascii?Q?X95Cq1m1ukrcWePut5CAP/xMLb+wwxLif2bkVdbxjmPN+Fho7VnuvdfpkrEN?= =?us-ascii?Q?RROan8cJ0j/Y4It8wffFrbIOUM64L2xmxV2DX0U5CarByMjrDmSyqTn72dZq?= =?us-ascii?Q?NgZN/RcRFvVgLo+Wdf8XxdV6/2tT4UfvTTT4FJB2csaLwXN84zu5CXvKkPOk?= =?us-ascii?Q?13CU9QlwqO+LEHwOEDcP68FCw01RHBN4XRFbzlFYcPAFJgcZUkarG+pIQMq+?= =?us-ascii?Q?hR7QJTZer8BuNe/Vw3f663yNOhGtljhbzowa6zdsa0wi2/nYtRdJVe93dQuq?= =?us-ascii?Q?S8wLZr5pTe8l9hXbWabtgxce/KWwjznzVT2Fo52Yk5NXVBSmkc4Dj+5RG/VH?= =?us-ascii?Q?lefNJg=3D=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5bfe365e-f716-41b2-4175-08d9fd4e3101 X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Mar 2022 19:44:12.2484 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 9TLFypu0IP8KWb4XAY3pGFnGiA2dQe8zZl292+eLsDuyRBPkSOkgacWr6O6EgNHa7/4RU5xOyHvtn0VIeYP7ygiETvjge3f7hLHRHULlo+8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB4736 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a01:111:f400:7d00::72c (failed) 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=2a01:111:f400:7d00::72c; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1646336847917100001 Content-Type: text/plain; charset="utf-8" Add new block driver handlers and corresponding generic wrappers. It will be used to allow copy-before-write filter to provide reach fleecing interface in further commit. In future this approach may be used to allow reading qcow2 internal snapshots, for example to export them through NBD. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Hanna Reitz --- include/block/block_int.h | 27 +++++++++++++++ block/io.c | 69 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+) diff --git a/include/block/block_int.h b/include/block/block_int.h index 27008cfb22..c43315ae6e 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -376,6 +376,24 @@ struct BlockDriver { */ void (*bdrv_cancel_in_flight)(BlockDriverState *bs); =20 + /* + * Snapshot-access API. + * + * Block-driver may provide snapshot-access API: special functions to = access + * some internal "snapshot". The functions are similar with normal + * read/block_status/discard handler, but don't have any specific hand= ling + * in generic block-layer: no serializing, no alignment, no tracked + * requests. So, block-driver that realizes these APIs is fully respon= sible + * for synchronization between snapshot-access API and normal IO reque= sts. + */ + int coroutine_fn (*bdrv_co_preadv_snapshot)(BlockDriverState *bs, + int64_t offset, int64_t bytes, QEMUIOVector *qiov, size_t qiov_off= set); + int coroutine_fn (*bdrv_co_snapshot_block_status)(BlockDriverState *bs, + bool want_zero, int64_t offset, int64_t bytes, int64_t *pnum, + int64_t *map, BlockDriverState **file); + int coroutine_fn (*bdrv_co_pdiscard_snapshot)(BlockDriverState *bs, + int64_t offset, int64_t bytes); + /* * Invalidate any cached meta-data. */ @@ -1078,6 +1096,15 @@ extern BlockDriver bdrv_file; extern BlockDriver bdrv_raw; extern BlockDriver bdrv_qcow2; =20 +int coroutine_fn bdrv_co_preadv_snapshot(BdrvChild *child, + int64_t offset, int64_t bytes, QEMUIOVector *qiov, size_t qiov_offset); +int coroutine_fn bdrv_co_snapshot_block_status(BlockDriverState *bs, + bool want_zero, int64_t offset, int64_t bytes, int64_t *pnum, + int64_t *map, BlockDriverState **file); +int coroutine_fn bdrv_co_pdiscard_snapshot(BlockDriverState *bs, + int64_t offset, int64_t bytes); + + int coroutine_fn bdrv_co_preadv(BdrvChild *child, int64_t offset, int64_t bytes, QEMUIOVector *qiov, BdrvRequestFlags flags); diff --git a/block/io.c b/block/io.c index 4e4cb556c5..0bcf09a491 100644 --- a/block/io.c +++ b/block/io.c @@ -3587,3 +3587,72 @@ void bdrv_cancel_in_flight(BlockDriverState *bs) bs->drv->bdrv_cancel_in_flight(bs); } } + +int coroutine_fn +bdrv_co_preadv_snapshot(BdrvChild *child, int64_t offset, int64_t bytes, + QEMUIOVector *qiov, size_t qiov_offset) +{ + BlockDriverState *bs =3D child->bs; + BlockDriver *drv =3D bs->drv; + int ret; + + if (!drv) { + return -ENOMEDIUM; + } + + if (!drv->bdrv_co_preadv_snapshot) { + return -ENOTSUP; + } + + bdrv_inc_in_flight(bs); + ret =3D drv->bdrv_co_preadv_snapshot(bs, offset, bytes, qiov, qiov_off= set); + bdrv_dec_in_flight(bs); + + return ret; +} + +int coroutine_fn +bdrv_co_snapshot_block_status(BlockDriverState *bs, + bool want_zero, int64_t offset, int64_t byte= s, + int64_t *pnum, int64_t *map, + BlockDriverState **file) +{ + BlockDriver *drv =3D bs->drv; + int ret; + + if (!drv) { + return -ENOMEDIUM; + } + + if (!drv->bdrv_co_snapshot_block_status) { + return -ENOTSUP; + } + + bdrv_inc_in_flight(bs); + ret =3D drv->bdrv_co_snapshot_block_status(bs, want_zero, offset, byte= s, + pnum, map, file); + bdrv_dec_in_flight(bs); + + return ret; +} + +int coroutine_fn +bdrv_co_pdiscard_snapshot(BlockDriverState *bs, int64_t offset, int64_t by= tes) +{ + BlockDriver *drv =3D bs->drv; + int ret; + + if (!drv) { + return -ENOMEDIUM; + } + + if (!drv->bdrv_co_pdiscard_snapshot) { + return -ENOTSUP; + } + + bdrv_inc_in_flight(bs); + ret =3D drv->bdrv_co_pdiscard_snapshot(bs, offset, bytes); + bdrv_dec_in_flight(bs); + + return ret; +} --=20 2.31.1 From nobody Sun May 12 02:11:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1646337320; cv=pass; d=zohomail.com; s=zohoarc; b=Z87HYrjsD9IGcigew6L9SVcTsa6vE/AYfaAGEOAHIcDb9OB6MahVe0DgxnuDcxC/d6l/MAa3gUR3VagIAkQXu6S6SY99nqC4tUeYe78uudP+6U42NLgUkra4CkKymrcje3sRcDKZX3ROsvUML0aSTlTCSAyAoNYiGCdbLGF3mRc= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646337320; 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=0HtyEbIetknDkkiwoMp7l6ByM0scW5D5ktNgrms1+XI=; b=bd/hPq1gjOWbfUqSFx+MbXxhYHu8SAh0tx0XuHjNVVAhG3WnojcSmK3/vEDKD34vO2ri2P7nyV9nlAiVgqK/3yMFlRIswEruIzshfBt6Uxlty0h5eJdh5CP7c7THhMb6P/7rS6lXDkHnJl3F/J34gGQda4zqr/zXNTRlBhYHSJQ= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646337320640645.7389349049447; Thu, 3 Mar 2022 11:55:20 -0800 (PST) Received: from localhost ([::1]:40704 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nPrXj-00085V-HL for importer@patchew.org; Thu, 03 Mar 2022 14:55:19 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39184) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nPrND-00045V-VN; Thu, 03 Mar 2022 14:44:29 -0500 Received: from [2a01:111:f400:7d00::710] (port=7585 helo=EUR05-VI1-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 1nPrNB-0004Xj-Hz; Thu, 03 Mar 2022 14:44:27 -0500 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by VE1PR08MB4736.eurprd08.prod.outlook.com (2603:10a6:802:a6::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.26; Thu, 3 Mar 2022 19:44:13 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::4545:8e0c:19c7:2a6d]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::4545:8e0c:19c7:2a6d%5]) with mapi id 15.20.5038.014; Thu, 3 Mar 2022 19:44:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SWjeKkVmi5KjgiWZVIa7gxRn1Kp7a8iRzSUC9XjUEO2seMAGTT+q/ZwGUtWBTPglvAF6vkfFBQNWDhJ8e4pSqaWf1pSvHMkPz3BVTDEbefiyyCjcTqWGLaX9bygByTMLb/ggzJYvjKYeRWh1q0VZG5BUEI9GGbv9UV0qCCNuorVgPuDEN5FKXY1rjGthEeqI3ACZM5EmL+uFLI/7fGwut7A94OrhhwSKwI4bz1JmFGpvT0mxD3iAEOZRaJ1jQuZpwLEQpe1vmXl99H0ZxLlLcmNx+VmJZEI+3M6aGIxwAull7mL3FU5eFjgw371E0W2Z+Qrz5PzZyP8KrUHjRtBUhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=0HtyEbIetknDkkiwoMp7l6ByM0scW5D5ktNgrms1+XI=; b=DtPjjku0v748tWqHzHbIAOOIrjxbCi8W6Lm+SFlvk6mQEjTwJlSejIuZCm/RPT6BqxlAe5zS2n/z6Ql7DsPqcfNOHRgpl+4oJs/IV7RGuD7SQ/F7p0GlUzm2hdr0Wty2SzwZhqmD8xyTBeuIVgzVp83RbPtWsHB7vDNoNLE1w0sOUUSISGP3D7niWVp8mdrCS6NAfwdjhWE/FO1igIx9JlfJr+x4E6n79tLv3bvGKjQMuHncA9PGvNFEvMEJTCJhc/O/EmXr2hh+s9A4enaJec/jfp+OIwkkLXK1lI59xSeMLJ5AGiA17ptt5A2xF/FPrLL5Nkc2i508MOiY6p2YDA== 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=0HtyEbIetknDkkiwoMp7l6ByM0scW5D5ktNgrms1+XI=; b=ZXaeSq7zw8URoSUvUmDK1i4RrRg+VeGlHvRpis8TUdhQX/qmcMBHbXTDnFtrHtf7tLBchWwfgcMWhY1bDZZQ0pnI1GZGz6SJCyUHejz3IDxohWjmcW7f52+hNpr/0QQCDypRH9771ebYIg0NW2GyKYvK1LbYzbF9jIBudcHCUAE= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, armbru@redhat.com, fam@euphon.net, stefanha@redhat.com, eblake@redhat.com, hreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com, jsnow@redhat.com Subject: [PATCH v6 11/16] block: introduce snapshot-access block driver Date: Thu, 3 Mar 2022 20:43:44 +0100 Message-Id: <20220303194349.2304213-12-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220303194349.2304213-1-vsementsov@virtuozzo.com> References: <20220303194349.2304213-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: VE1PR03CA0038.eurprd03.prod.outlook.com (2603:10a6:803:118::27) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cc61fa07-81f3-4be5-983f-08d9fd4e317f X-MS-TrafficTypeDiagnostic: VE1PR08MB4736:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pkzMhn1bNde2B+lQAyg1ZxtL51iQTfTIjcmE6gy8h3SzTrVsNEbbmj610zHA6vXdDHJDQ82BwqSqw4EwnMYcPT+B/9Lbcql94lbdTkIH5JA+fIIg9RsjUHqJ+xyayxXYnQcTpLA9AObuw9i60POJAmAXRwSwOTfvF5rxSvwKITfU0ZvaKQuLnbkxg39JJhJu0j0KHSloOwC4VXDmO+CRvUKEKRb9WPGGQjvipANq/fweYMN4O3Iq4G/41DmtTPZH0bPJQMfMGhhcAIW3uY5rOOYJzsRwdhU5d3Z72efgHInyjfQK5yuZ6cLMi1/Yl1khYvOEIhpOJlQcPwwYG5FGLVvogBvcfqMQf1zJL6/AujQwdseBrlxtp/Kq+V766a6Jwwuh3QGkh8b64nmTZi+TF6tMDv/Hu7mBrswzFaoOI8SeHlOJ5ABb8qGPAezEEpSc2Lqs/yE8f+5PVsT5a5MB5szd5JgCqzb0Af32njrLNYN1dzHxTjkD9jNhsCMp24U2TGuIDt8ViSUrOfLWA5eElJNvglUJQVUzukGR6F/asvErSh/8HfftoFGGMrSXDsm2iKjzKke+ftXRTNBEVAbFP3DK7Swti4nC/I7B8/H2F3d9TrzRFIpPrw2Uq7wqxdf6XvG1hkV8O1fniWDbMVOr6dRvuRmLaxoB4ICsEhpfNcUIt39q1ogar+HbKZVVh+wAdK9qswFYIoDDeBJCd6CWAZRc02Xv0b01yOwrF/3Cua0yXLwyznptAp7dmpmcZTnQRb8YuCUoP1LYg7o2vMSrqFbCdbQlGpNBs/TqbznTmCashGwqo8FePt8t9RKKK11r X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(6506007)(6512007)(26005)(6486002)(6666004)(186003)(1076003)(2616005)(316002)(6916009)(508600001)(36756003)(4326008)(8676002)(66476007)(83380400001)(66556008)(66946007)(86362001)(8936002)(5660300002)(52116002)(38100700002)(2906002)(38350700002)(2004002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?fZcffdD/yp+ktLcOcQu5m//RkZRl7t/s/iWBzXigSUzQaV5xZaSK0j2G1FXm?= =?us-ascii?Q?+nSVNBg2fZJqDUkuVsQs5/Xx3BVh1i2HtdLeYVqM5vshvZE/RHtWvz1buP85?= =?us-ascii?Q?qiIT7uvQJlkLiURFc2Qdwa7fV/nW2Lwa3CHVGCAdwEHNUkv9DOOU2N/Foxkg?= =?us-ascii?Q?Yhv+6Fs0lGyD9YIzAroUwTrRvZwhPei9WjFcocQJk8G777WwVbuLbLT+BXcA?= =?us-ascii?Q?W1IK2OcMHf5BixkhsHRTZw+gCmlHOIYfY61mHIkZ8BR0Q5cz5NOgWkSB3uKR?= =?us-ascii?Q?N+TfPl1JZOYUaD467x16AtP5b9gGfqGDJgL4VR576HD04RUn+G+Ia4iu6zrb?= =?us-ascii?Q?+H9ckqwfBRApyr+WD519eFcV6qZRdrQb4nR4m+2D2iVBWNHo0q0EaCZK9rDe?= =?us-ascii?Q?1KRgWp9XPtv6Qyi09AV/rrV5Pe0lpUFqjnMnL2OXxGCbI1VR+pru5jijRxcX?= =?us-ascii?Q?1bZY+H22E0gLpohah7mwO1P3JYHWtwnZQc380kdQxPK8JPJsslcAiPNmG28N?= =?us-ascii?Q?+FZ/XCQtl2T3pv4f95B8NvC9EC/sBFTCMMTZqNAO7jdg011jJRuJ8hC3tu/d?= =?us-ascii?Q?eiveQ0Jm6nGV0w8U6RkC1tDJpTs9oa/Oes7DUJAUex/+I58hno77/1lOsTIk?= =?us-ascii?Q?M7g9Kb74VTVSBTfsJ0Li3j3v6a4HQFtlkJvS9rezSNsAeDNlFn7zPm13RhnZ?= =?us-ascii?Q?kC6Ja8v2q1w2OScStYMf8ZzDFOlF6I+eywvsP0lxfntjUoCRIV7WrrP+xxkY?= =?us-ascii?Q?TnMVLUSGC8jh1BmCl6ccHFLgrN9UQX3eF5XrW7DgBsEJuU2DaG4lqYa9QfkO?= =?us-ascii?Q?2yoJGTcT9dBE/UyoNOYhW0SeKVR8DdGvUtEGQreUaH/WXx13lFgPCwLOnXPS?= =?us-ascii?Q?5aVUMsGkeZMinCebaRoOqit0KTLaItvwFn2OGaRANsc3oiDIRwFLpDEMfK2g?= =?us-ascii?Q?yLmrr9QtVonC/QAq9crKwgM+iIsA2osASSEpI32yMBW4Fbg4AzHOqhgTwvTH?= =?us-ascii?Q?IFoK+euCjz7buyltgxzi3dGx16WjKGUt1Po70n/hEqL0j3cimD6ndCVISpBP?= =?us-ascii?Q?2FxcHcOORfa3mfHvV8GpJNhFxmoWnjtfFFNOJTfFKxK1DOLS9fe6IXfIEkBD?= =?us-ascii?Q?jxAJxUtLEIBlmCckTQUriL0rlcLqk/tl4h7X2lu/dRPoO3C5geI4IoCdWlhc?= =?us-ascii?Q?eBl7EedHVG5Cb5AMZS8UE+j9UXh2vuaaRDCCHOgInn5YNUGtSXCCcr53HBRf?= =?us-ascii?Q?1UakK9aIMDqu+cpwn2iQi24wwUu8RjIgkHzDxFl22bt3sVPZpPc2OG1ZgNGI?= =?us-ascii?Q?p8788fuUcodX5f/jWdAckcrLMXG2d4Z83E4J276kRTqO1HXke6EIPo5vPYyB?= =?us-ascii?Q?fAMAMZxpU9nA4yToSa9ZWrfwzhx2sRUctKoYfzfYNMH38O3h9b2IX278Q6Up?= =?us-ascii?Q?FWIMVD+wS2/iJdrWFh1AjfAo8csq3w0ycbboZobv+h0CfIOmxRIBzEmIvrBZ?= =?us-ascii?Q?qpCXNN99jJ+Xf77AESjXUqpv2Wrb+pKgscnING9pCeJ/+8TYk0vDgsNXmgBA?= =?us-ascii?Q?jbgbc9GQFu30AW9IHYaATxMj3xRkpdIA2jyhMssriVCLMa8NIqyVh3xsn15i?= =?us-ascii?Q?L+nvfAV7KYEs23jzjo041QdLF9abAbNJxynnox73GfbrImlxFcXcdqs5FTX4?= =?us-ascii?Q?fvIPOA=3D=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: cc61fa07-81f3-4be5-983f-08d9fd4e317f X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Mar 2022 19:44:13.1701 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ddfeGpbhnDAMem93U8WTfVuIlVa3roIvlc1Otp3EPRNAqmLbAyPjqYRP9urJM6gDmrXnVgj0vW3L/9aG5ix5ApjE8FYPU6MFsc5JbWsC7cc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB4736 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a01:111:f400:7d00::710 (failed) 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=2a01:111:f400:7d00::710; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1646337321529100001 Content-Type: text/plain; charset="utf-8" The new block driver simply utilizes snapshot-access API of underlying block node. In further patches we want to use it like this: [guest] [NBD export] | | | root | root v file v [copy-before-write]<------[snapshot-access] | | | file | target v v [active-disk] [temp.img] This way, NBD client will be able to read snapshotted state of active disk, when active disk is continued to be written by guest. This is known as "fleecing", and currently uses another scheme based on qcow2 temporary image which backing file is active-disk. New scheme comes with benefits - see next commit. The other possible application is exporting internal snapshots of qcow2, like this: [guest] [NBD export] | | | root | root v file v [qcow2]<---------[snapshot-access] For this, we'll need to implement snapshot-access API handlers in qcow2 driver, and improve snapshot-access block driver (and API) to make it possible to select snapshot by name. Another thing to improve is size of snapshot. Now for simplicity we just use size of bs->file, which is OK for backup, but for qcow2 snapshots export we'll need to imporve snapshot-access API to get size of snapshot. Signed-off-by: Vladimir Sementsov-Ogievskiy --- qapi/block-core.json | 4 +- include/block/block_int.h | 6 ++ block/snapshot-access.c | 132 ++++++++++++++++++++++++++++++++++++++ MAINTAINERS | 1 + block/meson.build | 1 + 5 files changed, 143 insertions(+), 1 deletion(-) create mode 100644 block/snapshot-access.c diff --git a/qapi/block-core.json b/qapi/block-core.json index ffb7aea2a5..f13b5ff942 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -2914,13 +2914,14 @@ # @blkreplay: Since 4.2 # @compress: Since 5.0 # @copy-before-write: Since 6.2 +# @snapshot-access: Since 7.0 # # Since: 2.9 ## { 'enum': 'BlockdevDriver', 'data': [ 'blkdebug', 'blklogwrites', 'blkreplay', 'blkverify', 'bochs', 'cloop', 'compress', 'copy-before-write', 'copy-on-read', 'dmg= ', - 'file', 'ftp', 'ftps', 'gluster', + 'file', 'snapshot-access', 'ftp', 'ftps', 'gluster', {'name': 'host_cdrom', 'if': 'HAVE_HOST_BLOCK_DEVICE' }, {'name': 'host_device', 'if': 'HAVE_HOST_BLOCK_DEVICE' }, 'http', 'https', 'iscsi', @@ -4267,6 +4268,7 @@ 'rbd': 'BlockdevOptionsRbd', 'replication': { 'type': 'BlockdevOptionsReplication', 'if': 'CONFIG_REPLICATION' }, + 'snapshot-access': 'BlockdevOptionsGenericFormat', 'ssh': 'BlockdevOptionsSsh', 'throttle': 'BlockdevOptionsThrottle', 'vdi': 'BlockdevOptionsGenericFormat', diff --git a/include/block/block_int.h b/include/block/block_int.h index c43315ae6e..5c8ad9ed78 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -385,6 +385,12 @@ struct BlockDriver { * in generic block-layer: no serializing, no alignment, no tracked * requests. So, block-driver that realizes these APIs is fully respon= sible * for synchronization between snapshot-access API and normal IO reque= sts. + * + * TODO: To be able to support qcow2's internal snapshots, this API wi= ll + * need to be extended to: + * - be able to select a specific snapshot + * - receive the snapshot's actual length (which may differ from bs's + * length) */ int coroutine_fn (*bdrv_co_preadv_snapshot)(BlockDriverState *bs, int64_t offset, int64_t bytes, QEMUIOVector *qiov, size_t qiov_off= set); diff --git a/block/snapshot-access.c b/block/snapshot-access.c new file mode 100644 index 0000000000..77b87c1946 --- /dev/null +++ b/block/snapshot-access.c @@ -0,0 +1,132 @@ +/* + * snapshot_access block driver + * + * Copyright (c) 2022 Virtuozzo International GmbH. + * + * Author: + * Sementsov-Ogievskiy Vladimir + * + * 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 . + */ + +#include "qemu/osdep.h" + +#include "sysemu/block-backend.h" +#include "qemu/cutils.h" +#include "block/block_int.h" + +static coroutine_fn int +snapshot_access_co_preadv_part(BlockDriverState *bs, + int64_t offset, int64_t bytes, + QEMUIOVector *qiov, size_t qiov_offset, + BdrvRequestFlags flags) +{ + if (flags) { + return -ENOTSUP; + } + + return bdrv_co_preadv_snapshot(bs->file, offset, bytes, qiov, qiov_off= set); +} + +static int coroutine_fn +snapshot_access_co_block_status(BlockDriverState *bs, + bool want_zero, int64_t offset, + int64_t bytes, int64_t *pnum, + int64_t *map, BlockDriverState **file) +{ + return bdrv_co_snapshot_block_status(bs->file->bs, want_zero, offset, + bytes, pnum, map, file); +} + +static int coroutine_fn snapshot_access_co_pdiscard(BlockDriverState *bs, + int64_t offset, int64_t bytes) +{ + return bdrv_co_pdiscard_snapshot(bs->file->bs, offset, bytes); +} + +static int coroutine_fn +snapshot_access_co_pwrite_zeroes(BlockDriverState *bs, + int64_t offset, int64_t bytes, + BdrvRequestFlags flags) +{ + return -ENOTSUP; +} + +static coroutine_fn int +snapshot_access_co_pwritev_part(BlockDriverState *bs, + int64_t offset, int64_t bytes, + QEMUIOVector *qiov, size_t qiov_offset, + BdrvRequestFlags flags) +{ + return -ENOTSUP; +} + + +static void snapshot_access_refresh_filename(BlockDriverState *bs) +{ + pstrcpy(bs->exact_filename, sizeof(bs->exact_filename), + bs->file->bs->filename); +} + +static int snapshot_access_open(BlockDriverState *bs, QDict *options, int = flags, + Error **errp) +{ + bs->file =3D bdrv_open_child(NULL, options, "file", bs, &child_of_bds, + BDRV_CHILD_DATA | BDRV_CHILD_PRIMARY, + false, errp); + if (!bs->file) { + return -EINVAL; + } + + bs->total_sectors =3D bs->file->bs->total_sectors; + + return 0; +} + +static void snapshot_access_child_perm(BlockDriverState *bs, BdrvChild *c, + BdrvChildRole role, + BlockReopenQueue *reopen_queue, + uint64_t perm, uint64_t shared, + uint64_t *nperm, uint64_t *nshared) +{ + /* + * Currently, we don't need any permissions. If bs->file provides + * snapshot-access API, we can use it. + */ + *nperm =3D 0; + *nshared =3D BLK_PERM_ALL; +} + +BlockDriver bdrv_snapshot_access_drv =3D { + .format_name =3D "snapshot-access", + + .bdrv_open =3D snapshot_access_open, + + .bdrv_co_preadv_part =3D snapshot_access_co_preadv_part, + .bdrv_co_pwritev_part =3D snapshot_access_co_pwritev_part, + .bdrv_co_pwrite_zeroes =3D snapshot_access_co_pwrite_zeroes, + .bdrv_co_pdiscard =3D snapshot_access_co_pdiscard, + .bdrv_co_block_status =3D snapshot_access_co_block_status, + + .bdrv_refresh_filename =3D snapshot_access_refresh_filename, + + .bdrv_child_perm =3D snapshot_access_child_perm, +}; + +static void snapshot_access_init(void) +{ + bdrv_register(&bdrv_snapshot_access_drv); +} + +block_init(snapshot_access_init); diff --git a/MAINTAINERS b/MAINTAINERS index 101eb50619..4f0cc1e448 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2520,6 +2520,7 @@ F: block/reqlist.c F: include/block/reqlist.h F: block/copy-before-write.h F: block/copy-before-write.c +F: block/snapshot-access.c F: include/block/aio_task.h F: block/aio_task.c F: util/qemu-co-shared-resource.c diff --git a/block/meson.build b/block/meson.build index 41e9cc5dc3..038a95689b 100644 --- a/block/meson.build +++ b/block/meson.build @@ -34,6 +34,7 @@ block_ss.add(files( 'raw-format.c', 'reqlist.c', 'snapshot.c', + 'snapshot-access.c', 'throttle-groups.c', 'throttle.c', 'vhdx-endian.c', --=20 2.31.1 From nobody Sun May 12 02:11:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1646337186; cv=pass; d=zohomail.com; s=zohoarc; b=mqAt5AxEVG9i60k+sR4htXFTyRyUtvuGsLqU9pyAGvM/Bm/fbAlTPs9xLCmi6Colp4NV5XOd1vWifJhva2Yr4FecbrVGMfE1SCA7AtXGSv+nymR73KwxUm6oNFZvhiaUfnvHzdU+KWQzYfxnv1TEvqgmikgJtpohIe4fJy7DMoc= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646337186; 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=a8qT6l4df7zH8Odw5sbvg5lpWLiA1hTk9zOAAnhZZLA=; b=lotMkibr9fTDHF5JdviAA+Ju7T2uQVahGtjBQWrij5wv1o4VzZBSE1379lVI2ZCH2hm/fCFG7/VFy1kWd1wexWNKz4tOkmKWX0aZmg07kqchi7YLLMbHRrgTyUOlgpTTmZm9NGxIZLIqIzoGaFtTBjX7A6kosWvD5dp32pycurY= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646337185883861.8848783134825; Thu, 3 Mar 2022 11:53:05 -0800 (PST) Received: from localhost ([::1]:34074 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nPrVY-00036L-PQ for importer@patchew.org; Thu, 03 Mar 2022 14:53:04 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39192) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nPrNE-00045q-PN; Thu, 03 Mar 2022 14:44:29 -0500 Received: from [2a01:111:f400:7d00::701] (port=54113 helo=EUR05-VI1-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 1nPrNB-0004Yn-Ja; Thu, 03 Mar 2022 14:44:27 -0500 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by VE1PR08MB4736.eurprd08.prod.outlook.com (2603:10a6:802:a6::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.26; Thu, 3 Mar 2022 19:44:14 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::4545:8e0c:19c7:2a6d]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::4545:8e0c:19c7:2a6d%5]) with mapi id 15.20.5038.014; Thu, 3 Mar 2022 19:44:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cajdnQR14wHtWv8XE9DjS+g3QMIvp2gJD5U70PQfaSK3jJfqNjAZYS3M2I6sNnghZyrBXeOpLB+yZu24HuZQWra5Yd+qdPaEPRWoznjA5VW3I+n5fVP7aMPComCTDls6Gb8mrxss6qGzZYF06QPBwv74bWj+SEibVLdqALGVI2knjDEhnyAZihpjpFYAKD+huJSCzzHr+zi+q5iO4OMUZJXR5U81/BXKg8MO544ab32P/3Hllh/vfDyy6lzSc46eDIXLqOJHdp+qv0er2ETRei2Hl/FME9RQcNR27AAA/Cx+4pcflcpspXVtum7htPLBHLefedgjh+L2ihWL4F4dDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=a8qT6l4df7zH8Odw5sbvg5lpWLiA1hTk9zOAAnhZZLA=; b=TPkbPQ0fcZc6Y078vRGxZ7ZBALYDCUx2PMr4vIjqV7HzfcEg8Srj9wezi7grGJS38Com8Aq8541J3Cdcg6j4uYLS+K8YW+9LtTFfayUwq0RWilP30t5KSEgAFJF43yXj1mJgTCSISpU6VF7XqWVNKWlUhFs6IJNBJ6/cIxCH5RgjTb4ZeAjMbfse4hiXmKtkby5wDiU3BEHbFaUJSWtZIwouG7T65uG56P5PfPjGrurPS18O84Di6pDcjJQ/a7A6Zjq5rS7PzkUXXnPpqJkV3aCRdcd2d9YvRXrKbYlrgSkdH/XCgxUcHuQ5QYeTXYjp/jdC93Ojry1P6mWaNcbf4Q== 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=a8qT6l4df7zH8Odw5sbvg5lpWLiA1hTk9zOAAnhZZLA=; b=VCm4DuXE0DWn4tIgB229t9kX8t1BFtHOXIf8oLGj3cpiJyCc/C+rTt9WbKeb2P0cEl9FKo+o0JE0D55vuf4+kpTI7DpcR3K3LsO/5oG+rs6HTIY4qnsGcC9daSfc4bP9ddLkzlgLsbiuHy2ksDVDRAYF/OFdpTN2yVRJsQfyo6E= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, armbru@redhat.com, fam@euphon.net, stefanha@redhat.com, eblake@redhat.com, hreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com, jsnow@redhat.com Subject: [PATCH v6 12/16] block: copy-before-write: realize snapshot-access API Date: Thu, 3 Mar 2022 20:43:45 +0100 Message-Id: <20220303194349.2304213-13-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220303194349.2304213-1-vsementsov@virtuozzo.com> References: <20220303194349.2304213-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: VE1PR03CA0038.eurprd03.prod.outlook.com (2603:10a6:803:118::27) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e55ae214-7262-45c7-3c87-08d9fd4e320c X-MS-TrafficTypeDiagnostic: VE1PR08MB4736:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Db5YMJ2JMNpuUGn5IruDDCNmGgu/j6Xy4za2RmTuZ7u6CUgre6VnamdnOc8ZNEWRHUeXs3dxYg9nqrlJuQR/13+gMezhAqtSdJEmQrLKqFWGIq1Cw/4IVVh1h68ArUqQG+ieNCTCA6qQWPMXbdDOJt0p74wmaUzVaI2IdtutewSbgNe+nOROT0P2nn3cyY9hgIft+c+zg34uG2NL5Dqt/wh7f/uf9o2yFyojalZEP88a/7hm1qASlXrT7qSGp2YvxH4DRH0Cy2PxNd5+9sedj0SiSJtVDfDoZaRmiE/RVHw9Plavhy2QiHIxO88t5atXbGyTCGyWHuml/4KagOfDAWURsszeckhuju+qbITrX5T+Q734vECI7hk038ySeayJPry+j9vGdB+hO3EzPb8wHQ2fdZCEt8xRc77QWXkWnLqcniv/pCmrYFZMe/PzCCYR9PGaqggPxEHUZhy+IkvRYCfBb08cnJLDZ9j1v6+ffF5Gu5E2Ljn9EQ01nNiQ2C8ne9dxL4Ze4u2M33mItPVESLzlj2yshV1gq764NvnJ9Zp6JXQLKyDnJJfQTij8MtMXrkF4PMXlOTrzufox1SETvK0fDgx9l8HE4a8WYgX5j4zuZ9M/FN2iWY4RBF3ccRBQspfK0z3HXGP6DjHvXAF06mIDvSx3xKnKoF+iTYW4BIqYMjB/S5GzP73O4BAH/dM4Gju63a9+xMd8sAbzEM7CPQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(6506007)(6512007)(26005)(6486002)(6666004)(186003)(1076003)(2616005)(316002)(6916009)(508600001)(36756003)(4326008)(8676002)(66476007)(83380400001)(66556008)(66946007)(30864003)(86362001)(8936002)(5660300002)(52116002)(38100700002)(2906002)(38350700002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?5KK//0amId0oY5/IjcxAJV413c7r1hy+UwhnyUQj06+25mLXixcnAOVNGEoK?= =?us-ascii?Q?aM8oyrbN0zu3uO+JTwk4O+7AHgLn718UAkp8deVI76fFxPTNL/Ct8EL17uDL?= =?us-ascii?Q?XePiYZGeRpdS/4cvqXQ56xig/9FtCRvyHEr6MAg/JvJto+xi0lXblBfJSIxf?= =?us-ascii?Q?bfFsdp4Dk8VfapUBJm0JyZ3I7iNYci/WkSB+rekwyq7G63ZKuTi5XbifZf6+?= =?us-ascii?Q?//ogAsKgLkwn/cTDnePgYQmw0jAzboAYKyI6wlqioE2BYwl47KF5zUl7QAOj?= =?us-ascii?Q?98r3k/nfhea/UwNxeqL52cgRwHnb7rY1QD0JJNSGL+yEFw2PcEGoDKen5VJs?= =?us-ascii?Q?bHvAg1BSKoj0UUMoOVw/W5xZi5mVY9HbF6j44zpAv2Iz+QrvCihVgoTVOPwf?= =?us-ascii?Q?aV9dvxERzHMZI3ZG7nUVci2MaBlME/iyisYMkFiBqjaHH9UDPkI5We/KFkiU?= =?us-ascii?Q?VekY5zhMizWBHyhBVa0TBmJH7zjJRX+jgWhr85qc1gU8VZmEGpQMRYhxErjt?= =?us-ascii?Q?yeRVGtag0jxfh5P/DBEuO0Jr2hSQsPyRqBDdCerKvTVl1pFlFwrqGrbW1klv?= =?us-ascii?Q?S8RBbH5AsjEIRs1IEGDVG60ezzQ8Rxe6Hct5GZFlhi+7EkebIgsXt7v2femU?= =?us-ascii?Q?D+H/Rtp/3gXxgEes44TmgD/D9RsWHaw+xFuOhdU+aGl1w+IqGTOU3RQkVein?= =?us-ascii?Q?tJ84iKAYkg/5bFyDoZsO0rIdG0OOJ618Tu534pg6n+CdUdpS7s0cZt9F+yf3?= =?us-ascii?Q?xIyMiAIQRYrUSWOD+595Z33FIHcGwouCpBwXeifWR9S3JpukuAH5iqC5Pu9H?= =?us-ascii?Q?bh7CCYsKyTeQotmfqq3tz7zJROKvmxmLFBVP3ca4crn+SB1cy17Tkw1mwrfB?= =?us-ascii?Q?TVAKUyNTmcULt0K2quWCkvg8HCpxcxvUAUrqofLLZcLA7kaAM0g8yYUZxQph?= =?us-ascii?Q?D/hp/lOIRuZiyI59zhRGeRD3xo7EgJQGAvgLh+HV9LUXJ6KA8fo/nnIB+DQc?= =?us-ascii?Q?PhFi83CaZDyo/NqP7icF+mG+ZQGmGDx84jlCdfGy/1lc4iRhPqBuq0ybXqYy?= =?us-ascii?Q?/FN3QslwutRRFSU8735JYwFEri7jkmeRp63Xzgo2l4Oiy5mr+74YTPRiND4s?= =?us-ascii?Q?nzdsCJFldQRlIONUj8GhbkuGT8Hp5Iad128KhqHYYkhIVi4OvP+e/4w2fA91?= =?us-ascii?Q?bEjmPlKUj6xIU5j1GQaILpLBxx9xNdu5viBBpbbHSNQBLsQo3FkkLU/OJsaQ?= =?us-ascii?Q?BQQ1R6JiSJnFrlVjD+Jv9wwS/SBPMGQqApC0B+PDah6He1FcQ7JDNC63ADyC?= =?us-ascii?Q?YaVF3DkOHB9busKoz0VORccz6RvNou2a2uzYaHG9LbJInfyN7Afs6lmFfdAV?= =?us-ascii?Q?tgW4H7nFLCBywykFtv+LVsd3NTxXz1/Bjtqdd0eA38dc7Sp8ZiISRFMOGLel?= =?us-ascii?Q?ByEAcNXPbLcaSwyVoSdJ4SRZaWJYb/OYGot52s4L5Ffm6/YtOrYwqOfNOtKH?= =?us-ascii?Q?EkPNpl/t0snX4TxB6AtXJwDv0kUDUQgEJJ8twOqfneU1CZj4ZwIQ8PqRcY+8?= =?us-ascii?Q?6Wl4VjW8y6UuQuVf40pVuNzNn+d4ezb/2q58eJFRRaxMmkQYjqz7J0JkEn4U?= =?us-ascii?Q?yXTEA0AM6vwYv0shml3PgBDUVItpkJGEdFQa9Uw2Cs4BaW3Y7OoeJA5qxY6G?= =?us-ascii?Q?564yXw=3D=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: e55ae214-7262-45c7-3c87-08d9fd4e320c X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Mar 2022 19:44:13.9824 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: uCWGf6gxP0vM/r04XpfhmFc4TWK48o2UiPdZr7tdP3YgjSSHg/d/DmyagGmaG7p3t8ZQftlVyJgFqXIvj4gpqBqFZrc1S8brQAmtDL96IrE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB4736 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a01:111:f400:7d00::701 (failed) 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=2a01:111:f400:7d00::701; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1646337186625100001 Content-Type: text/plain; charset="utf-8" Current scheme of image fleecing looks like this: [guest] [NBD export] | | |root | root v v [copy-before-write] -----> [temp.qcow2] | target | |file |backing v | [active disk] <-------------+ - On guest writes copy-before-write filter copies old data from active disk to temp.qcow2. So fleecing client (NBD export) when reads changed regions from temp.qcow2 image and unchanged from active disk through backing link. This patch makes possible new image fleecing scheme: [guest] [NBD export] | | | root | root v file v [copy-before-write]<------[snapshot-access] | | | file | target v v [active-disk] [temp.img] - copy-before-write does CBW operations and also provides snapshot-access API. The API may be accessed through snapshot-access driver. Benefits of new scheme: 1. Access control: if remote client try to read data that not covered by original dirty bitmap used on copy-before-write open, client gets -EACCES. 2. Discard support: if remote client do DISCARD, this additionally to discarding data in temp.img informs block-copy process to not copy these clusters. Next read from discarded area will return -EACCES. This is significant thing: when fleecing user reads data that was not yet copied to temp.img, we can avoid copying it on further guest write. 3. Synchronisation between client reads and block-copy write is more efficient. In old scheme we just rely on BDRV_REQ_SERIALISING flag used for writes to temp.qcow2. New scheme is less blocking: - fleecing reads are never blocked: if data region is untouched or in-flight, we just read from active-disk, otherwise we read from temp.img - writes to temp.img are not blocked by fleecing reads - still, guest writes of-course are blocked by in-flight fleecing reads, that currently read from active-disk - it's the minimum necessary blocking 4. Temporary image may be of any format, as we don't rely on backing feature. 5. Permission relation are simplified. With old scheme we have to share write permission on target child of copy-before-write, otherwise backing link conflicts with copy-before-write file child write permissions. With new scheme we don't have backing link, and copy-before-write node may have unshared access to temporary node. (Not realized in this commit, will be in future). 6. Having control on fleecing reads we'll be able to implement alternative behavior on failed copy-before-write operations. Currently we just break guest request (that's a historical behavior of backup). But in some scenarios it's a bad behavior: better is to drop the backup as failed but don't break guest request. With new scheme we can simply unset some bits in a bitmap on CBW failure and further fleecing reads will -EACCES, or something like this. (Not implemented in this commit, will be in future) Additional application for this is implementing timeout for CBW operations. Iotest 257 output is updated, as two more bitmaps now live in copy-before-write filter. Signed-off-by: Vladimir Sementsov-Ogievskiy --- block/copy-before-write.c | 212 ++++++++++++++++++++++++++++++++++- tests/qemu-iotests/257.out | 224 +++++++++++++++++++++++++++++++++++++ 2 files changed, 435 insertions(+), 1 deletion(-) diff --git a/block/copy-before-write.c b/block/copy-before-write.c index 91a2288b66..0b6d26605c 100644 --- a/block/copy-before-write.c +++ b/block/copy-before-write.c @@ -33,12 +33,37 @@ #include "block/block-copy.h" =20 #include "block/copy-before-write.h" +#include "block/reqlist.h" =20 #include "qapi/qapi-visit-block-core.h" =20 typedef struct BDRVCopyBeforeWriteState { BlockCopyState *bcs; BdrvChild *target; + + /* + * @lock: protects access to @access_bitmap, @done_bitmap and + * @frozen_read_reqs + */ + CoMutex lock; + + /* + * @access_bitmap: represents areas allowed for reading by fleecing us= er. + * Reading from non-dirty areas leads to -EACCES. + */ + BdrvDirtyBitmap *access_bitmap; + + /* + * @done_bitmap: represents areas that was successfully copied to @tar= get by + * copy-before-write operations. + */ + BdrvDirtyBitmap *done_bitmap; + + /* + * @frozen_read_reqs: current read requests for fleecing user in bs->f= ile + * node. These areas must not be rewritten by guest. + */ + BlockReqList frozen_read_reqs; } BDRVCopyBeforeWriteState; =20 static coroutine_fn int cbw_co_preadv( @@ -48,10 +73,20 @@ static coroutine_fn int cbw_co_preadv( return bdrv_co_preadv(bs->file, offset, bytes, qiov, flags); } =20 +/* + * Do copy-before-write operation. + * + * On failure guest request must be failed too. + * + * On success, we also wait for all in-flight fleecing read requests in so= urce + * node, and it's guaranteed that after cbw_do_copy_before_write() success= ful + * return there are no such requests and they will never appear. + */ static coroutine_fn int cbw_do_copy_before_write(BlockDriverState *bs, uint64_t offset, uint64_t bytes, BdrvRequestFlags flags) { BDRVCopyBeforeWriteState *s =3D bs->opaque; + int ret; uint64_t off, end; int64_t cluster_size =3D block_copy_cluster_size(s->bcs); =20 @@ -62,7 +97,17 @@ static coroutine_fn int cbw_do_copy_before_write(BlockDr= iverState *bs, off =3D QEMU_ALIGN_DOWN(offset, cluster_size); end =3D QEMU_ALIGN_UP(offset + bytes, cluster_size); =20 - return block_copy(s->bcs, off, end - off, true); + ret =3D block_copy(s->bcs, off, end - off, true); + if (ret < 0) { + return ret; + } + + WITH_QEMU_LOCK_GUARD(&s->lock) { + bdrv_set_dirty_bitmap(s->done_bitmap, off, end - off); + reqlist_wait_all(&s->frozen_read_reqs, off, end - off, &s->lock); + } + + return 0; } =20 static int coroutine_fn cbw_co_pdiscard(BlockDriverState *bs, @@ -110,6 +155,142 @@ static int coroutine_fn cbw_co_flush(BlockDriverState= *bs) return bdrv_co_flush(bs->file->bs); } =20 +/* + * If @offset not accessible - return NULL. + * + * Otherwise, set @pnum to some bytes that accessible from @file (@file is= set + * to bs->file or to s->target). Return newly allocated BlockReq object th= at + * should be than passed to cbw_snapshot_read_unlock(). + * + * It's guaranteed that guest writes will not interact in the region until + * cbw_snapshot_read_unlock() called. + */ +static BlockReq *cbw_snapshot_read_lock(BlockDriverState *bs, + int64_t offset, int64_t bytes, + int64_t *pnum, BdrvChild **file) +{ + BDRVCopyBeforeWriteState *s =3D bs->opaque; + BlockReq *req =3D g_new(BlockReq, 1); + bool done; + + QEMU_LOCK_GUARD(&s->lock); + + if (bdrv_dirty_bitmap_next_zero(s->access_bitmap, offset, bytes) !=3D = -1) { + g_free(req); + return NULL; + } + + done =3D bdrv_dirty_bitmap_status(s->done_bitmap, offset, bytes, pnum); + if (done) { + /* + * Special invalid BlockReq, that is handled in + * cbw_snapshot_read_unlock(). We don't need to lock something to = read + * from s->target. + */ + *req =3D (BlockReq) {.offset =3D -1, .bytes =3D -1}; + *file =3D s->target; + } else { + reqlist_init_req(&s->frozen_read_reqs, req, offset, bytes); + *file =3D bs->file; + } + + return req; +} + +static void cbw_snapshot_read_unlock(BlockDriverState *bs, BlockReq *req) +{ + BDRVCopyBeforeWriteState *s =3D bs->opaque; + + if (req->offset =3D=3D -1 && req->bytes =3D=3D -1) { + g_free(req); + return; + } + + QEMU_LOCK_GUARD(&s->lock); + + reqlist_remove_req(req); + g_free(req); +} + +static coroutine_fn int +cbw_co_preadv_snapshot(BlockDriverState *bs, int64_t offset, int64_t bytes, + QEMUIOVector *qiov, size_t qiov_offset) +{ + BlockReq *req; + BdrvChild *file; + int ret; + + /* TODO: upgrade to async loop using AioTask */ + while (bytes) { + int64_t cur_bytes; + + req =3D cbw_snapshot_read_lock(bs, offset, bytes, &cur_bytes, &fil= e); + if (!req) { + return -EACCES; + } + + ret =3D bdrv_co_preadv_part(file, offset, cur_bytes, + qiov, qiov_offset, 0); + cbw_snapshot_read_unlock(bs, req); + if (ret < 0) { + return ret; + } + + bytes -=3D cur_bytes; + offset +=3D cur_bytes; + qiov_offset +=3D cur_bytes; + } + + return 0; +} + +static int coroutine_fn +cbw_co_snapshot_block_status(BlockDriverState *bs, + bool want_zero, int64_t offset, int64_t bytes, + int64_t *pnum, int64_t *map, + BlockDriverState **file) +{ + BDRVCopyBeforeWriteState *s =3D bs->opaque; + BlockReq *req; + int ret; + int64_t cur_bytes; + BdrvChild *child; + + req =3D cbw_snapshot_read_lock(bs, offset, bytes, &cur_bytes, &child); + if (!req) { + return -EACCES; + } + + ret =3D bdrv_block_status(child->bs, offset, cur_bytes, pnum, map, fil= e); + if (child =3D=3D s->target) { + /* + * We refer to s->target only for areas that we've written to it. + * And we can not report unallocated blocks in s->target: this will + * break generic block-status-above logic, that will go to + * copy-before-write filtered child in this case. + */ + assert(ret & BDRV_BLOCK_ALLOCATED); + } + + cbw_snapshot_read_unlock(bs, req); + + return ret; +} + +static int coroutine_fn cbw_co_pdiscard_snapshot(BlockDriverState *bs, + int64_t offset, int64_t b= ytes) +{ + BDRVCopyBeforeWriteState *s =3D bs->opaque; + + WITH_QEMU_LOCK_GUARD(&s->lock) { + bdrv_reset_dirty_bitmap(s->access_bitmap, offset, bytes); + } + + block_copy_reset(s->bcs, offset, bytes); + + return bdrv_co_pdiscard(s->target, offset, bytes); +} + static void cbw_refresh_filename(BlockDriverState *bs) { pstrcpy(bs->exact_filename, sizeof(bs->exact_filename), @@ -194,6 +375,7 @@ static int cbw_open(BlockDriverState *bs, QDict *option= s, int flags, { BDRVCopyBeforeWriteState *s =3D bs->opaque; BdrvDirtyBitmap *bitmap =3D NULL; + int64_t cluster_size; =20 bs->file =3D bdrv_open_child(NULL, options, "file", bs, &child_of_bds, BDRV_CHILD_FILTERED | BDRV_CHILD_PRIMARY, @@ -225,6 +407,27 @@ static int cbw_open(BlockDriverState *bs, QDict *optio= ns, int flags, return -EINVAL; } =20 + cluster_size =3D block_copy_cluster_size(s->bcs); + + s->done_bitmap =3D bdrv_create_dirty_bitmap(bs, cluster_size, NULL, er= rp); + if (!s->done_bitmap) { + return -EINVAL; + } + bdrv_disable_dirty_bitmap(s->done_bitmap); + + /* s->access_bitmap starts equal to bcs bitmap */ + s->access_bitmap =3D bdrv_create_dirty_bitmap(bs, cluster_size, NULL, = errp); + if (!s->access_bitmap) { + return -EINVAL; + } + bdrv_disable_dirty_bitmap(s->access_bitmap); + bdrv_dirty_bitmap_merge_internal(s->access_bitmap, + block_copy_dirty_bitmap(s->bcs), NULL, + true); + + qemu_co_mutex_init(&s->lock); + QLIST_INIT(&s->frozen_read_reqs); + return 0; } =20 @@ -232,6 +435,9 @@ static void cbw_close(BlockDriverState *bs) { BDRVCopyBeforeWriteState *s =3D bs->opaque; =20 + bdrv_release_dirty_bitmap(s->access_bitmap); + bdrv_release_dirty_bitmap(s->done_bitmap); + block_copy_state_free(s->bcs); s->bcs =3D NULL; } @@ -249,6 +455,10 @@ BlockDriver bdrv_cbw_filter =3D { .bdrv_co_pdiscard =3D cbw_co_pdiscard, .bdrv_co_flush =3D cbw_co_flush, =20 + .bdrv_co_preadv_snapshot =3D cbw_co_preadv_snapshot, + .bdrv_co_pdiscard_snapshot =3D cbw_co_pdiscard_snapshot, + .bdrv_co_snapshot_block_status =3D cbw_co_snapshot_block_status, + .bdrv_refresh_filename =3D cbw_refresh_filename, =20 .bdrv_child_perm =3D cbw_child_perm, diff --git a/tests/qemu-iotests/257.out b/tests/qemu-iotests/257.out index 50cbd8e882..aa76131ca9 100644 --- a/tests/qemu-iotests/257.out +++ b/tests/qemu-iotests/257.out @@ -106,6 +106,22 @@ write -P0x67 0x3fe0000 0x20000 {"return": ""} { "bitmaps": { + "backup-top": [ + { + "busy": false, + "count": 67108864, + "granularity": 65536, + "persistent": false, + "recording": false + }, + { + "busy": false, + "count": 458752, + "granularity": 65536, + "persistent": false, + "recording": false + } + ], "drive0": [ { "busy": false, @@ -566,6 +582,22 @@ write -P0x67 0x3fe0000 0x20000 {"return": ""} { "bitmaps": { + "backup-top": [ + { + "busy": false, + "count": 67108864, + "granularity": 65536, + "persistent": false, + "recording": false + }, + { + "busy": false, + "count": 458752, + "granularity": 65536, + "persistent": false, + "recording": false + } + ], "drive0": [ { "busy": false, @@ -819,6 +851,22 @@ write -P0x67 0x3fe0000 0x20000 {"return": ""} { "bitmaps": { + "backup-top": [ + { + "busy": false, + "count": 67108864, + "granularity": 65536, + "persistent": false, + "recording": false + }, + { + "busy": false, + "count": 458752, + "granularity": 65536, + "persistent": false, + "recording": false + } + ], "drive0": [ { "busy": false, @@ -1279,6 +1327,22 @@ write -P0x67 0x3fe0000 0x20000 {"return": ""} { "bitmaps": { + "backup-top": [ + { + "busy": false, + "count": 67108864, + "granularity": 65536, + "persistent": false, + "recording": false + }, + { + "busy": false, + "count": 458752, + "granularity": 65536, + "persistent": false, + "recording": false + } + ], "drive0": [ { "busy": false, @@ -1532,6 +1596,22 @@ write -P0x67 0x3fe0000 0x20000 {"return": ""} { "bitmaps": { + "backup-top": [ + { + "busy": false, + "count": 67108864, + "granularity": 65536, + "persistent": false, + "recording": false + }, + { + "busy": false, + "count": 458752, + "granularity": 65536, + "persistent": false, + "recording": false + } + ], "drive0": [ { "busy": false, @@ -1992,6 +2072,22 @@ write -P0x67 0x3fe0000 0x20000 {"return": ""} { "bitmaps": { + "backup-top": [ + { + "busy": false, + "count": 67108864, + "granularity": 65536, + "persistent": false, + "recording": false + }, + { + "busy": false, + "count": 458752, + "granularity": 65536, + "persistent": false, + "recording": false + } + ], "drive0": [ { "busy": false, @@ -2245,6 +2341,22 @@ write -P0x67 0x3fe0000 0x20000 {"return": ""} { "bitmaps": { + "backup-top": [ + { + "busy": false, + "count": 67108864, + "granularity": 65536, + "persistent": false, + "recording": false + }, + { + "busy": false, + "count": 458752, + "granularity": 65536, + "persistent": false, + "recording": false + } + ], "drive0": [ { "busy": false, @@ -2705,6 +2817,22 @@ write -P0x67 0x3fe0000 0x20000 {"return": ""} { "bitmaps": { + "backup-top": [ + { + "busy": false, + "count": 67108864, + "granularity": 65536, + "persistent": false, + "recording": false + }, + { + "busy": false, + "count": 458752, + "granularity": 65536, + "persistent": false, + "recording": false + } + ], "drive0": [ { "busy": false, @@ -2958,6 +3086,22 @@ write -P0x67 0x3fe0000 0x20000 {"return": ""} { "bitmaps": { + "backup-top": [ + { + "busy": false, + "count": 67108864, + "granularity": 65536, + "persistent": false, + "recording": false + }, + { + "busy": false, + "count": 458752, + "granularity": 65536, + "persistent": false, + "recording": false + } + ], "drive0": [ { "busy": false, @@ -3418,6 +3562,22 @@ write -P0x67 0x3fe0000 0x20000 {"return": ""} { "bitmaps": { + "backup-top": [ + { + "busy": false, + "count": 67108864, + "granularity": 65536, + "persistent": false, + "recording": false + }, + { + "busy": false, + "count": 458752, + "granularity": 65536, + "persistent": false, + "recording": false + } + ], "drive0": [ { "busy": false, @@ -3671,6 +3831,22 @@ write -P0x67 0x3fe0000 0x20000 {"return": ""} { "bitmaps": { + "backup-top": [ + { + "busy": false, + "count": 67108864, + "granularity": 65536, + "persistent": false, + "recording": false + }, + { + "busy": false, + "count": 458752, + "granularity": 65536, + "persistent": false, + "recording": false + } + ], "drive0": [ { "busy": false, @@ -4131,6 +4307,22 @@ write -P0x67 0x3fe0000 0x20000 {"return": ""} { "bitmaps": { + "backup-top": [ + { + "busy": false, + "count": 67108864, + "granularity": 65536, + "persistent": false, + "recording": false + }, + { + "busy": false, + "count": 458752, + "granularity": 65536, + "persistent": false, + "recording": false + } + ], "drive0": [ { "busy": false, @@ -4384,6 +4576,22 @@ write -P0x67 0x3fe0000 0x20000 {"return": ""} { "bitmaps": { + "backup-top": [ + { + "busy": false, + "count": 67108864, + "granularity": 65536, + "persistent": false, + "recording": false + }, + { + "busy": false, + "count": 458752, + "granularity": 65536, + "persistent": false, + "recording": false + } + ], "drive0": [ { "busy": false, @@ -4844,6 +5052,22 @@ write -P0x67 0x3fe0000 0x20000 {"return": ""} { "bitmaps": { + "backup-top": [ + { + "busy": false, + "count": 67108864, + "granularity": 65536, + "persistent": false, + "recording": false + }, + { + "busy": false, + "count": 458752, + "granularity": 65536, + "persistent": false, + "recording": false + } + ], "drive0": [ { "busy": false, --=20 2.31.1 From nobody Sun May 12 02:11:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1646337455; cv=pass; d=zohomail.com; s=zohoarc; b=fvOoeabN7ZnS70H1Abq8gV/oYNfKR8SPwkqI3yH3D89zk/eeRxv2ydcsxxYuQPkmQzSa9DJaM3lfobFs60de8t94vL1Otx4STPEbcB4XZ65HacACVtQkoXu5jpbyyyk8/KPh1lF6GcBmYf07a/e1xWi3mrBXNFM6PSa8RrCnbHY= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646337455; 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=wEpH+HIzXiDTHUzHBNTB3tdUmabNgivX1ETxG6gdcEw=; b=n64hFTpOi9LFPVLCoUSzfbOyC83MXo0j5vWiqXZvQNYUEqWCeIcqwha2NrqKxiaBupgEXWhokVYRxjHhRUF2azvdrszlzzr+DDiBCd9TN/tpAIAMfp3GwgZU+bvVS+EqOEhasWm2kdO2sqdM6nDISsQLRZVyncIhgQewFRT4avg= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646337455547729.5165159857127; Thu, 3 Mar 2022 11:57:35 -0800 (PST) Received: from localhost ([::1]:47184 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nPrZu-0004D3-B6 for importer@patchew.org; Thu, 03 Mar 2022 14:57:34 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39194) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nPrNE-00045r-PR; Thu, 03 Mar 2022 14:44:29 -0500 Received: from [2a01:111:f400:7d00::72c] (port=28672 helo=EUR05-VI1-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 1nPrNC-0004Wu-Vz; Thu, 03 Mar 2022 14:44:28 -0500 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by VE1PR08MB4736.eurprd08.prod.outlook.com (2603:10a6:802:a6::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.26; Thu, 3 Mar 2022 19:44:14 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::4545:8e0c:19c7:2a6d]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::4545:8e0c:19c7:2a6d%5]) with mapi id 15.20.5038.014; Thu, 3 Mar 2022 19:44:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Lg00l2rU6dShmaEj3zR6udgfWJ3FE4TAidXwHD/kwQLPYXa1NXhGiVsSQtaWJ/yMxiw6chHd5IxW5jQKf0eOsSn6IbP/FooAPb0Eg+szeDj02FBkFao572Tcmfv/wNyF5s0+BBSzajn8BJ/51emqX17Q0I4Gul0VlwtLf6grw87l37b7I4LjZk3fc44XMJHXIW/YQTVR5rWUh9IEmVvn237rzR6qeMN/DllqVWM956pXAoRHGsOmcspzE3F8vjl028ZtV72JSwOx8guRySz1vCsqfgSzonbr0iwLqECI2aMStrBaDAKGEerMnGGTgM1hczDCb9NlAzVz0JaffWr4NQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wEpH+HIzXiDTHUzHBNTB3tdUmabNgivX1ETxG6gdcEw=; b=VQsMDkUmeYLFXQBlNmvk6W94XGJv0D2QZ2V7rAfE+SCs0sq2Qs34MKEFY6LQsmOi5UsNQ8zNlQ2yW8ZFr56k8cSI8KYxtXj1NAj9wNdWEVQJrXL7i+qUsWJyJefTnz8dD1ETojsfyip1KtUP0F2yW4fhA4LT6oyWx6yT3L/dr2R5FdD74ezsfMHj26uJmwFRSk/eO1QjpFZC3rky69C4PRvJbAR7aUOmiH6I22rJ0t3AJ7DLJBgeSZVIoPDXFt/ydIbKsmBSXvAcdmL4PXSo2LAdnUbSrdLoO/1i2+RrivZC1HL4kOOtusDqn4Uax1kSQwwORpTzgxmrVtPjw/BCVA== 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=wEpH+HIzXiDTHUzHBNTB3tdUmabNgivX1ETxG6gdcEw=; b=TMcyXtT4uIUgrpxlY0heRqVZWTmMJPpU6oYHnT395cqIj8q/hQhZ76rWfRp1WV95EZqooYQAQQwzlzxnjlrqWBy06VDgiIM5ivj2PNNatB9pU9OYr+huncY/FXqHFe41pBtn+xAI6O5QDjBDTDxUEqJjBLRRqfVJ1+LfnVKNVhI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, armbru@redhat.com, fam@euphon.net, stefanha@redhat.com, eblake@redhat.com, hreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com, jsnow@redhat.com Subject: [PATCH v6 13/16] iotests/image-fleecing: add test-case for fleecing format node Date: Thu, 3 Mar 2022 20:43:46 +0100 Message-Id: <20220303194349.2304213-14-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220303194349.2304213-1-vsementsov@virtuozzo.com> References: <20220303194349.2304213-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: VE1PR03CA0038.eurprd03.prod.outlook.com (2603:10a6:803:118::27) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a97ebf38-da6c-40f1-db17-08d9fd4e327e X-MS-TrafficTypeDiagnostic: VE1PR08MB4736:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1sZLUEyyfKP0Vjf1gozzwe2uSrjRA4Zl/mao1AqMis4tum5PttQMw0vqK4Rf4SPwoM3cQWwdoLgrvobrWeGO3gqu3GZuxjQ2c9iHzzL1U5S3Wf6QIAFiAhA9GmKik4PHLNHUmRS+FIrhI7TLTnJxu9tbntGqa6Q6Nv4GOF8DuaBQKcsCRWzoCwSvhFuYJOkeLdkB9FJ+HCcHNxQS4TrVhXVtCeqOXLqSwxweeJ33BdJGI2LaitbPTyhQVWkgj/hbXqJ6x9GCbwp5MdP9yzJkBQRNJBYVkJBaZRrmGkCf4QZjcOOAJT+C3SFG2KOjlY2Q+5enr9x4f5I6Khz2ZUXBQ1nJxTjrHIFcc+W3XFrfxovPLje1mafrXGvFdQgpen/i2ePiKY2oUAR8fgt2SqhS5gopLjKhuYwTvwESacM+Hj7pEZi69eTSenBlCTATVHUxcXF/OUrQ2VA4w2e3bje5ohjbFwAoILfWu2Nr66GMuSxU9X/yziQnR8o5DAcDaZaVKslDT1YgrXMt4+Pxe/CoTRQO2uAG+2SeSyGtSNYGwNL89vjTYU8aniiBrQLqkGMAVUP8BQ+nFlFGFpkagDoxrlodd7Jgqql8o0YuoHncINs8oyP8D4ZnWKy55XmN1RXTW5qTpgPL3VU8qjPmRvc6lg0GE3LK+G37v0VvbDcYhB58E2CnZBRBoy663/Czk6eZbktwi5pjBpaZk3QBGAIGew== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(6506007)(6512007)(26005)(6486002)(6666004)(186003)(1076003)(2616005)(316002)(6916009)(508600001)(36756003)(4326008)(8676002)(66476007)(83380400001)(66556008)(66946007)(86362001)(8936002)(5660300002)(52116002)(38100700002)(2906002)(38350700002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?LK5TLASZgIuXbfI0bt1pO3qflLj3U0WH99RHqQX4YItGC/orXCMqAz6cG2ta?= =?us-ascii?Q?R7pX88yfyeCKNW9GgJ9Zn1Xe47NRU9/e0ZnkQ9/9a0mn753DAkhTj6bAYYOO?= =?us-ascii?Q?XDsPSmFr8nOulcqdcjh2u2OQxiwf5PrbtW/O7b7QiFKYwrwgT/yKGgu98RGg?= =?us-ascii?Q?fsI09AQjUQUYgxtJOR1iKqo504aBpH6JejyIhD9Dti0FiBKCitMna1SOWCfP?= =?us-ascii?Q?yA4YPDfHf0f2rJ7rYzekz6UeGRv1C6NtEEVLGpu71oM87Fylby1IA7EJvkC8?= =?us-ascii?Q?cnzZMPXXXk7HOTOG/tBEnAAJNI8IcSSrMi0PHo8TQyI30Pnooq8WoCtCr/QU?= =?us-ascii?Q?ch8SaZAARBhzlJXtDzWqKqLjR3P4btHBaPSQ4YdFjynXtVijC4FRIq9gJF70?= =?us-ascii?Q?lKBonqdmj6BGC1ywpl0YJ6FruNxIElW15mWWdakAmWwjAsip2Hx9cA1ryz/U?= =?us-ascii?Q?vBy9gKYTQu/Pw2nJDcM/UitZtCS6qVGr3jiJLHoj0epODrceWwSWhaYg8HGl?= =?us-ascii?Q?THig9y3SFtRBgYHVszravjvkPaRGnGpSMWwbda8BZH37PrNhwfgQ9WGG+Vbg?= =?us-ascii?Q?79KKEtinvJgIyorl7BPciHhvqPCZrpJ3rJAFsCr0w3UJs6hY8mdGA7AXTRxR?= =?us-ascii?Q?oQCLuBhSqtmKYGqSmEBMOlo2LCRkcBIt3TuYsUA1f4cQGRs9ZsuYXNgwi2Uz?= =?us-ascii?Q?v+ygs7KFMSNpqRH4iZlU1qsVjFuRqBJrg+R0Lzx1OjTLrXBf5PfU6DFkmnCh?= =?us-ascii?Q?eMEwRVRnnIHEE0GQSjzXj5SpIGDxcicvQGyVTB3QekDJXUW0mCFMwWeXjKFN?= =?us-ascii?Q?w3FBXvif5vtQLbbJ9BZRQ8uDzxZZxJzNpxoH3K+IjRPD6ZPomhF3NH3Gy0X3?= =?us-ascii?Q?mDJlcbmtQwEnQpVT9RYOEBhbvHHihWqQx9OJGQ+q+DtP04vhJRP9rjm4D24L?= =?us-ascii?Q?VV+ocGzWRZExXoxwFLY42Fhfr/9zDfPyue9NqAdocshrJRW3PQpIUDzY8SO5?= =?us-ascii?Q?vHEpW3eTIieb4Xn1liqCgxQvQMKE9+pILRlOF9S2omi15PSnIRtu3onRoWv4?= =?us-ascii?Q?fF/nWm6lZVHjKOFv9j/gtSzVcPdz+RYU1klwPXWKioOtye+x80ss/MKisGPW?= =?us-ascii?Q?o3ybv9FBnbqgfpL0g0j+H4/+McLUQ2MAtEtuOP7uRVJ6gB1aOlbHJl5b/NXU?= =?us-ascii?Q?sjxbnADSbmCLLz0fKhnhd1Mb5Yc7yqIlnSNekJd37OIjYoKCjqoEtm957ZdN?= =?us-ascii?Q?cfC+PCXZqEjtVmH32vRttPYFeD5NLGPxNclwwAdzGpWMGoIvbrk8+E4Clnzp?= =?us-ascii?Q?llTY5CUZV0Aev8rY7xIfN1ci0hFjsOYWWreoU2i2cSu6ZVl7x9OYF/Hq+3RI?= =?us-ascii?Q?Fw88prMkiLinms/1IBQ1k0GvKgNz3h2jPyS/KyAiIlt6Hsd01//goFDz+nCb?= =?us-ascii?Q?y1wZ/bG8HcuIQfG7T9NyVajSFnBK3MtetzgHoCat+26ew6mi6vY2RelMP7C8?= =?us-ascii?Q?Jw2YdHZjRGrZpeKOCTSRJOnje7Bg42XVHiGth4WibxV3g3Vp16XlaxPv8qVI?= =?us-ascii?Q?X1JYemmpI+oLqiLGQvyAHWupj6KGsCrqmkPsia7kiSaEMjkuoTkMI3z/ky1Y?= =?us-ascii?Q?A7KiAZCmvNcwLPWPeySS/0h9i/Tc+zDpga6Kd1sBj5TSLkbNMZ468578SeC8?= =?us-ascii?Q?m5NvOA=3D=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: a97ebf38-da6c-40f1-db17-08d9fd4e327e X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Mar 2022 19:44:14.7180 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 9bn0YEreYc0i6abfXFK/E0ElAjq3FEHj1VCdUyUq5LeCdwA4dHOEwgtcynRj/quldjr3u4QRu99xkCqRZ1Z4aMzASw6bhL92Y1tVEi41MPE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB4736 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a01:111:f400:7d00::72c (failed) 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=2a01:111:f400:7d00::72c; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1646337458367100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Hanna Reitz --- tests/qemu-iotests/tests/image-fleecing | 64 ++++++++++++----- tests/qemu-iotests/tests/image-fleecing.out | 76 ++++++++++++++++++++- 2 files changed, 120 insertions(+), 20 deletions(-) diff --git a/tests/qemu-iotests/tests/image-fleecing b/tests/qemu-iotests/t= ests/image-fleecing index a58b5a1781..909fc0a7ad 100755 --- a/tests/qemu-iotests/tests/image-fleecing +++ b/tests/qemu-iotests/tests/image-fleecing @@ -49,12 +49,17 @@ remainder =3D [('0xd5', '0x108000', '32k'), # Right-en= d of partial-left [1] ('0xdc', '32M', '32k'), # Left-end of partial-right [2] ('0xcd', '0x3ff0000', '64k')] # patterns[3] =20 -def do_test(use_cbw, base_img_path, fleece_img_path, nbd_sock_path, vm): +def do_test(use_cbw, use_snapshot_access_filter, base_img_path, + fleece_img_path, nbd_sock_path, vm): log('--- Setting up images ---') log('') =20 assert qemu_img('create', '-f', iotests.imgfmt, base_img_path, '64M') = =3D=3D 0 - assert qemu_img('create', '-f', 'qcow2', fleece_img_path, '64M') =3D= =3D 0 + if use_snapshot_access_filter: + assert use_cbw + assert qemu_img('create', '-f', 'raw', fleece_img_path, '64M') =3D= =3D 0 + else: + assert qemu_img('create', '-f', 'qcow2', fleece_img_path, '64M') = =3D=3D 0 =20 for p in patterns: qemu_io('-f', iotests.imgfmt, @@ -81,16 +86,23 @@ def do_test(use_cbw, base_img_path, fleece_img_path, nb= d_sock_path, vm): log('') =20 =20 - # create tmp_node backed by src_node - log(vm.qmp('blockdev-add', { - 'driver': 'qcow2', - 'node-name': tmp_node, - 'file': { + if use_snapshot_access_filter: + log(vm.qmp('blockdev-add', { + 'node-name': tmp_node, 'driver': 'file', 'filename': fleece_img_path, - }, - 'backing': src_node, - })) + })) + else: + # create tmp_node backed by src_node + log(vm.qmp('blockdev-add', { + 'driver': 'qcow2', + 'node-name': tmp_node, + 'file': { + 'driver': 'file', + 'filename': fleece_img_path, + }, + 'backing': src_node, + })) =20 # Establish CBW from source to fleecing node if use_cbw: @@ -102,6 +114,13 @@ def do_test(use_cbw, base_img_path, fleece_img_path, n= bd_sock_path, vm): })) =20 log(vm.qmp('qom-set', path=3Dqom_path, property=3D'drive', value= =3D'fl-cbw')) + + if use_snapshot_access_filter: + log(vm.qmp('blockdev-add', { + 'driver': 'snapshot-access', + 'node-name': 'fl-access', + 'file': 'fl-cbw', + })) else: log(vm.qmp('blockdev-backup', job_id=3D'fleecing', @@ -109,16 +128,18 @@ def do_test(use_cbw, base_img_path, fleece_img_path, = nbd_sock_path, vm): target=3Dtmp_node, sync=3D'none')) =20 + export_node =3D 'fl-access' if use_snapshot_access_filter else tmp_node + log('') log('--- Setting up NBD Export ---') log('') =20 - nbd_uri =3D 'nbd+unix:///%s?socket=3D%s' % (tmp_node, nbd_sock_path) + nbd_uri =3D 'nbd+unix:///%s?socket=3D%s' % (export_node, nbd_sock_path) log(vm.qmp('nbd-server-start', {'addr': {'type': 'unix', 'data': {'path': nbd_sock_path}}})) =20 - log(vm.qmp('nbd-server-add', device=3Dtmp_node)) + log(vm.qmp('nbd-server-add', device=3Dexport_node)) =20 log('') log('--- Sanity Check ---') @@ -151,7 +172,11 @@ def do_test(use_cbw, base_img_path, fleece_img_path, n= bd_sock_path, vm): log('--- Cleanup ---') log('') =20 + log(vm.qmp('nbd-server-stop')) + if use_cbw: + if use_snapshot_access_filter: + log(vm.qmp('blockdev-del', node_name=3D'fl-access')) log(vm.qmp('qom-set', path=3Dqom_path, property=3D'drive', value= =3Dsrc_node)) log(vm.qmp('blockdev-del', node_name=3D'fl-cbw')) else: @@ -160,7 +185,6 @@ def do_test(use_cbw, base_img_path, fleece_img_path, nb= d_sock_path, vm): assert e is not None log(e, filters=3D[iotests.filter_qmp_event]) =20 - log(vm.qmp('nbd-server-stop')) log(vm.qmp('blockdev-del', node_name=3Dtmp_node)) vm.shutdown() =20 @@ -177,17 +201,21 @@ def do_test(use_cbw, base_img_path, fleece_img_path, = nbd_sock_path, vm): log('Done') =20 =20 -def test(use_cbw): +def test(use_cbw, use_snapshot_access_filter): with iotests.FilePath('base.img') as base_img_path, \ iotests.FilePath('fleece.img') as fleece_img_path, \ iotests.FilePath('nbd.sock', base_dir=3Diotests.sock_dir) as nbd_sock_path, \ iotests.VM() as vm: - do_test(use_cbw, base_img_path, fleece_img_path, nbd_sock_path, vm) + do_test(use_cbw, use_snapshot_access_filter, base_img_path, + fleece_img_path, nbd_sock_path, vm) =20 =20 log('=3D=3D=3D Test backup(sync=3Dnone) based fleecing =3D=3D=3D\n') -test(False) +test(False, False) =20 -log('=3D=3D=3D Test filter based fleecing =3D=3D=3D\n') -test(True) +log('=3D=3D=3D Test cbw-filter based fleecing =3D=3D=3D\n') +test(True, False) + +log('=3D=3D=3D Test fleecing-format based fleecing =3D=3D=3D\n') +test(True, True) diff --git a/tests/qemu-iotests/tests/image-fleecing.out b/tests/qemu-iotes= ts/tests/image-fleecing.out index e96d122a8b..da0af93388 100644 --- a/tests/qemu-iotests/tests/image-fleecing.out +++ b/tests/qemu-iotests/tests/image-fleecing.out @@ -52,8 +52,8 @@ read -P0 0x3fe0000 64k --- Cleanup --- =20 {"return": {}} -{"data": {"device": "fleecing", "len": 67108864, "offset": 393216, "speed"= : 0, "type": "backup"}, "event": "BLOCK_JOB_CANCELLED", "timestamp": {"micr= oseconds": "USECS", "seconds": "SECS"}} {"return": {}} +{"data": {"device": "fleecing", "len": 67108864, "offset": 393216, "speed"= : 0, "type": "backup"}, "event": "BLOCK_JOB_CANCELLED", "timestamp": {"micr= oseconds": "USECS", "seconds": "SECS"}} {"return": {}} =20 --- Confirming writes --- @@ -67,7 +67,7 @@ read -P0xdc 32M 32k read -P0xcd 0x3ff0000 64k =20 Done -=3D=3D=3D Test filter based fleecing =3D=3D=3D +=3D=3D=3D Test cbw-filter based fleecing =3D=3D=3D =20 --- Setting up images --- =20 @@ -137,3 +137,75 @@ read -P0xdc 32M 32k read -P0xcd 0x3ff0000 64k =20 Done +=3D=3D=3D Test fleecing-format based fleecing =3D=3D=3D + +--- Setting up images --- + +Done + +--- Launching VM --- + +Done + +--- Setting up Fleecing Graph --- + +{"return": {}} +{"return": {}} +{"return": {}} +{"return": {}} + +--- Setting up NBD Export --- + +{"return": {}} +{"return": {}} + +--- Sanity Check --- + +read -P0x5d 0 64k +read -P0xd5 1M 64k +read -P0xdc 32M 64k +read -P0xcd 0x3ff0000 64k +read -P0 0x00f8000 32k +read -P0 0x2010000 32k +read -P0 0x3fe0000 64k + +--- Testing COW --- + +write -P0xab 0 64k +{"return": ""} +write -P0xad 0x00f8000 64k +{"return": ""} +write -P0x1d 0x2008000 64k +{"return": ""} +write -P0xea 0x3fe0000 64k +{"return": ""} + +--- Verifying Data --- + +read -P0x5d 0 64k +read -P0xd5 1M 64k +read -P0xdc 32M 64k +read -P0xcd 0x3ff0000 64k +read -P0 0x00f8000 32k +read -P0 0x2010000 32k +read -P0 0x3fe0000 64k + +--- Cleanup --- + +{"return": {}} +{"return": {}} +{"return": {}} +{"return": {}} +{"return": {}} + +--- Confirming writes --- + +read -P0xab 0 64k +read -P0xad 0x00f8000 64k +read -P0x1d 0x2008000 64k +read -P0xea 0x3fe0000 64k +read -P0xd5 0x108000 32k +read -P0xdc 32M 32k +read -P0xcd 0x3ff0000 64k + +Done --=20 2.31.1 From nobody Sun May 12 02:11:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1646337620; cv=pass; d=zohomail.com; s=zohoarc; b=C9GBgxWPz8FjFfvegBSWjgXWTmtSTi3wzjcymqPTV8W1o75s1FxQr1kb2/J2hj0MUPeXpGBstpm625oNp6i09505n3G/+p7Y3Mb7ZcZw70WKPLExXUyvIccVzNzNZ6+ONj3RpRT9x45vN3zldaJ6+fzTh/kixd52VU6aJwVf66w= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646337620; 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=gaYYTHt+J27XJ8iUeKAJ7iE9wB98iZR1jC6tKdNEJ4o=; b=cmITf/XzboFKTub0o6T5KNpLUyEAV02oZ7T0H9O07rFq+Jj/sFHClSCNavBSUgVMAKe4q21BYQR1xM9hModKwDn6oIYXi6eK9QqI2lgZOL7oDA4L5N5s73t7syjyODoZzc7dMgKsBrL0eE6sBhUfUe09zgGCAhp2Y0X1EPGmrxs= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646337620686996.4574251669502; Thu, 3 Mar 2022 12:00:20 -0800 (PST) Received: from localhost ([::1]:54438 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nPrcZ-0000tU-Gg for importer@patchew.org; Thu, 03 Mar 2022 15:00:19 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39246) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nPrNG-00046q-MU; Thu, 03 Mar 2022 14:44:31 -0500 Received: from [2a01:111:f400:7d00::710] (port=7585 helo=EUR05-VI1-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 1nPrNE-0004Xj-Up; Thu, 03 Mar 2022 14:44:30 -0500 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by VE1PR08MB4736.eurprd08.prod.outlook.com (2603:10a6:802:a6::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.26; Thu, 3 Mar 2022 19:44:15 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::4545:8e0c:19c7:2a6d]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::4545:8e0c:19c7:2a6d%5]) with mapi id 15.20.5038.014; Thu, 3 Mar 2022 19:44:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jrUn+rUMT27NNDLM2pi1zP2F8ZsgCQPZL0Syv9141bN/rcVvzMy+hSK7zzqnu3053GOAkbUDnAc/0XR2sMhjgopjCz/hMRBQMSK7UAEJIGcrwdNlYj1Fj+XLxs1vv2Baw0qx62Mcye0nIRonHHSFKM6IyDji4nOgtXIU/4kR/NKf/RkNAQza80hJVrlTG9LnkpX7gWP/XEVW27Qd+3NgFBXlx4SCECdFXV4JdKWJ+Dl53K732ug4BzAUkYGVXi+en0/ICEtp5/EvlYexJxHGq1RwY8Y1xWiuwJfm0XZYG8y0Hmcaccg2kebYxUwTMYOt/Com34LHVSt0cleN28WfzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gaYYTHt+J27XJ8iUeKAJ7iE9wB98iZR1jC6tKdNEJ4o=; b=ni/AluKp6zqKBQeQ5b4ZOKrCjmcJnVcUjH7zWvKgD2SgL2QC+0CCnbmewY+nw8WBrruoIHPhOwfUib9MKUFv0cg9hTi182pTAuf16FWjs84hf5DDVzz+b4QpiRCDri4f8JUTtx+A1L06G29+BF9ClwW+lfNDk3oqZFwwgm+6D4Guz2jP48vXDdH0S8Lpe9czNn26YOksu6H8oasis94a8KRoVVRFWA/kU6LKtNps2Q4AU6swWdFszh4KHAF2tjuOUn0gJCEkRFwWdzxIc2IY6OY9YG/wtxLQbZ/rqXwJHMoBFbc035AoxNiNi5Zk57FRvf+LbFCKBg0JeZh8aQV6Cg== 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=gaYYTHt+J27XJ8iUeKAJ7iE9wB98iZR1jC6tKdNEJ4o=; b=R2mXzVKM7aYgyQmZ6Akw6fQjkEQWqIIpoVlP3TIsGN3zzowkH21V88HH6BXkFQcoXOXhbYS+GoGiVzO1VJkSE6Hr3WaxcVF8PwlnhkD7CfA6cdPTUzQf52wPXWq6EE08oaG87Gfx84Eh221i4SySACnjoQyDgR1EIVGF+dsAi4s= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, armbru@redhat.com, fam@euphon.net, stefanha@redhat.com, eblake@redhat.com, hreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com, jsnow@redhat.com Subject: [PATCH v6 14/16] iotests.py: add qemu_io_pipe_and_status() Date: Thu, 3 Mar 2022 20:43:47 +0100 Message-Id: <20220303194349.2304213-15-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220303194349.2304213-1-vsementsov@virtuozzo.com> References: <20220303194349.2304213-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: VE1PR03CA0038.eurprd03.prod.outlook.com (2603:10a6:803:118::27) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d7d6eead-3f51-4942-3203-08d9fd4e32fd X-MS-TrafficTypeDiagnostic: VE1PR08MB4736:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PoRF2Cnuk/CB2deOL+yZTIkD10TNuHCjF3l53DsTky/xc6SM3UAeN7tUZzW9r171YyK82EFfuxseMgTVFgU6UHW51cSlj2EJwPwmMha9kE9xtctbUg5BETvhLq66etHyl1mu//8PVBJck18EcsV+8aq55ksYwCpGvbN5Jbq4UxyRHni39pTdAYbj1RSWG2rBMgUFOam083PtBCfSyQyNDN2QXsRhcFovmuYT0XIcOgXzykgImODm1PtRq5pKXjIksEPw7aRTPl7UQE4vyIhmFttjcdkpTbERkVJnfR0rZx6GKnVo0wGbiNpP7n2EPB1KfQU4gDjduRhksFo+gafH8JaiHO+FQIJxS/YnzsrpMCg09O6thTE/mRurv1fMTjB0eh9no+TpdpmDdGW1htDp4fbqw4TJtcpHCdK1qoa4YOBhmXgt9bk6oUsMjLc3ABDK3iaWg3SMB4bDIsFYEEhV86erRG0HsmqL1yDzxlu8zQKCYuTrNzI+yNzU3HUtE6H+bVi4GdH2kv+c2Y80CjGb0WycC8JbRoKblg9pg1QZCLNmHkFHFOtPI7WN48HUoPTw0BcC+Jj9pwpaq92r4zX0aC65D8ZVTzn/SvUc4XCuTTvMT92vs8jRjyK01lKGtVT+oVn1jtz7/zu3h/XxDRujFl68CjbDLSReqWW95jwpRnk3ci5m4BuYVmuS1tG2CJ5hqwXG7WpTgyEnsnBTR8haUw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(6506007)(6512007)(26005)(6486002)(6666004)(186003)(1076003)(2616005)(316002)(6916009)(508600001)(36756003)(4326008)(8676002)(66476007)(66556008)(66946007)(4744005)(86362001)(8936002)(5660300002)(52116002)(38100700002)(2906002)(38350700002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?wZbto/kR5ta+iip+2Pj9cNR8NEIM2FrN1/9qZVTWyNzGAkKnXpO8DjhKpsRE?= =?us-ascii?Q?48ROUbMXh6/yO57RNbNYVeLiDQHVMjXiNFXNs5HpdY2OO0Ud3AEbfD/ZfCE1?= =?us-ascii?Q?PSFAwqVPNVJ048nIswsrmauyJBnadKLbLzn7UHzGNnb6Q+s79kTbhCGEJBPA?= =?us-ascii?Q?SSnrXLq1Hh+72jOZHCh1edVki/N4Z6/kp6BxlM4x6oXtqdeyCT9yd+W3vd4b?= =?us-ascii?Q?zeCyxS52uFcElujtM6Dz6r8JdIwq1C9V0lI9AEmoODKYuZENfDrJ6XoxgodR?= =?us-ascii?Q?5EqsgG9+NuONJdZUrF1G44t8Wi/+ef47o/Ugt+JKcHSpct7H02XWkLh+Cw6b?= =?us-ascii?Q?JvOFWmuNQ005B3hv7F5WcGrgY0CRwfZH27bamAqAm9E9gC7rL7htgJ9VIYrD?= =?us-ascii?Q?X/U4nQ1W5brUxsUG37/vHJy1Ts8ivHNWWcs7jy5Tldz0Fpf1dQRmsvh8h16p?= =?us-ascii?Q?OE+IZmSqddBiI23n52H/MmohP0ZeevW1i7C+3BzUktiUJQp6XeIvd0tOBUyr?= =?us-ascii?Q?J+JgX31e6LA0ISTxnksOGBCAJbOdlwIgY9nIiQS9D3o0soETRAPyZnee5Lm6?= =?us-ascii?Q?byzAivy4BVQSyzyPtbjei7JMZQEONmU3b/aAVrpR70D+oTyI+HJHHlv0qk8k?= =?us-ascii?Q?LCP1B00VP0SqkXX1FvDi/V1DUt/jzvT70weyZY4ux8Rx6wdbKm/4zLi+9Wmx?= =?us-ascii?Q?miFEzv3cLtoPcs4jWz64mMZoeQVDVsKiueuGhb15WeqhRcOUVWpbB+qjOHJc?= =?us-ascii?Q?aqADk5Ee95qEvhqA6xMziz016HKZrathaSXhCOYpLvjHfu3ad3d/0sd9Kdgi?= =?us-ascii?Q?cUFOOYg7JgBZeaBuri/J/dN1h4F6KdzWRw0bs/s8R5cZJ0OnLl3l7bB5c+oW?= =?us-ascii?Q?MmRssfu7NpC4hFUcPNVk+agDxrslh6pTMMQP/4RcX2MDtl3yrOgXcImX1Rov?= =?us-ascii?Q?pXtCKpHgoKkDiClrChSpNfekEfRbJQ8/IAhRo62gFWr5VhL5oreaAHvXT6QQ?= =?us-ascii?Q?2s2uRjjSUdddlzMQOPEcYZ7eKcuQgeKnoQYI4L90L6kOw3ZHHJDMHoPjotbC?= =?us-ascii?Q?HuV9KQaAsbJn/zkh49Kts1WAk6utN5Kd3lmfx7PqKCNYxxyql+c/t7eEWCCP?= =?us-ascii?Q?nZb77WDjqONt1UagRWBzX0tPXVQWwO8IW7Kk0cifDWHKtfZYDxt68lgg5q2Y?= =?us-ascii?Q?RMuJcztG7dQi0rLvSC3UK+SOAflUwDInXaPTcz/VlfiOtGOcl1pdCR7tr0uo?= =?us-ascii?Q?S3tcOJGqY7qv1Km9YSijejJDe0Q4d3chSZaZUfxDNixINGhBVO95Cm8092Ak?= =?us-ascii?Q?8+mw32rQnIs9A1a/qV1Mz7N4k7ilqQOss8CzqZJ3ZsF5jajdlbBuE/QUq+Dn?= =?us-ascii?Q?AktbIcTBLUtrRYGSZF5UcPhaVRUtsSPK0RZfDfVwrG0AELR/SkXoPnJsu/2B?= =?us-ascii?Q?U4RYlZUtHy2ifSpPfmpmF3R+fAa8EYQb9Ncyg9C/dlGE4PXtT5YoKVW9IE+3?= =?us-ascii?Q?TYjNNWw9ckZTE6h5wm7oL38zfh59qvmGjcO1dTlutS3/aF+Ht+1vMPP040ES?= =?us-ascii?Q?yXJx4e/SPWApCUen7QqPy42GbksdRdp8Jf11VWYtFEEBWlTEVGnFqpKhS6EX?= =?us-ascii?Q?OxfHxE6Df+ale2Pl0dcqi4BQ2TRo82c3MSBOwe+AkeN6FSf2SKaqwLwEBsoW?= =?us-ascii?Q?NNpEBA=3D=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: d7d6eead-3f51-4942-3203-08d9fd4e32fd X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Mar 2022 19:44:15.5772 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: sCNqgfPFFm+C0THrWhs8dWm6ZNqPLcg9Bgnh3REna+13SUMtCW6ViL21fskXrx259/BKCr4F4K629rducoGRHaPdsP743w2uOyYPv/MUmbE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB4736 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a01:111:f400:7d00::710 (failed) 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=2a01:111:f400:7d00::710; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1646337622068100001 Content-Type: text/plain; charset="utf-8" Add helper that returns both status and output, to be used in the following commit Signed-off-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/iotests.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 6ba65eb1ff..bb071e5669 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -278,6 +278,9 @@ def qemu_io(*args): '''Run qemu-io and return the stdout data''' return qemu_tool_pipe_and_status('qemu-io', qemu_io_wrap_args(args))[0] =20 +def qemu_io_pipe_and_status(*args): + return qemu_tool_pipe_and_status('qemu-io', qemu_io_wrap_args(args)) + def qemu_io_log(*args): result =3D qemu_io(*args) log(result, filters=3D[filter_testfiles, filter_qemu_io]) --=20 2.31.1 From nobody Sun May 12 02:11:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1646337768; cv=pass; d=zohomail.com; s=zohoarc; b=YOtinGNK/tC7VhCU3CBqZtDtQu6DXMhOtVMYMuLz44DqxHHGHqRl241X/XYw0rFpy2IehlWB0aAGx5e8mwz390QYbaeH9aVWqec1BKw4rbWf2Gjy58ug9BX9XdjE9uoSQ6l6EU1JBA19TGT0w7SFpHBU19Ig/G0kgbTmiUTf+f4= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646337768; 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=JnXEeuoL4Vv3p1Q4s5BuJZZqZVqTZWvpFCi98qbgHHU=; b=n5X5G9i+g/spg3Jqzx3wEnOIW7slGYVDEL7NQ3z4twRNyUYNROy3rlrOsJd+rYUejlu6vRIvtJCxN0zKMGVEcxklNpDQQ340W1hahh8qYo9wmJ8jDQKzqmlKlzMuU2zELVQbLmS+HlahO446gpt1Spv/4BM2nQN3p81GJuqahao= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 164633776879515.270570975612486; Thu, 3 Mar 2022 12:02:48 -0800 (PST) Received: from localhost ([::1]:60362 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nPrex-0005iA-Ik for importer@patchew.org; Thu, 03 Mar 2022 15:02:47 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39264) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nPrNH-00047A-Iz; Thu, 03 Mar 2022 14:44:31 -0500 Received: from [2a01:111:f400:7d00::701] (port=54113 helo=EUR05-VI1-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 1nPrNF-0004Yn-D9; Thu, 03 Mar 2022 14:44:31 -0500 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by VE1PR08MB4736.eurprd08.prod.outlook.com (2603:10a6:802:a6::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.26; Thu, 3 Mar 2022 19:44:16 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::4545:8e0c:19c7:2a6d]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::4545:8e0c:19c7:2a6d%5]) with mapi id 15.20.5038.014; Thu, 3 Mar 2022 19:44:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eExPTqBT8C/KV958RZRhXpDGrjbkMowR46uqeIOmY2/XG1B0KuZwAyz5NG/nga2JiWqsxths7niYDwxutwpcp9whHCnghT6ucKunLIRM7I9icr2+h5rMu3nc+2vIIHzLJvGwbC3KMCuudCx9ohNTEhXEhPWc1bZFatk/Cm786GzadP3WbS8Hx0Q8/164ubAcerTBqezj2nxxWqa3Gn9XDmClny+GUi7qPLAg2oFpJptKdM8oVWdLs7/VC9yg57KaTgrgpauPvqDL1zXQe2FkPYdTxY6l0JKsRs+Z+YEX6G4wmQel/xfd21HoaZ8BCm774lunU/YOONpj1Eo73sB7hA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=JnXEeuoL4Vv3p1Q4s5BuJZZqZVqTZWvpFCi98qbgHHU=; b=Cm9QHeCHRu75zO9bRZbBLYVlDL2hp+JoheQzWE/Qir5d7kvbdhrt87ADJ9LmhEgNx/7ZRuXLC17zCvNZSwDHkOaGfo6n3AqMPT7vLG716CQUQkT1Cd9pE6OyIzKNUmGwCCsUDAew7SQjyVgGMq+4EFGUeX3LY+xoNhKT+wZHE+Z2eFV/VdiLYyMauXh1sI1XFJl2ey+A6SycRGBgsTUeCUBqA3PgufYLgfrMbGAHUSzTZ0YcDpwPifmBcUdd8A22t4iui/5fH+/rHNeyShZ1PR3A7l6ZwLdpLdORRuc0WnqXVj5pA4K2G0q6PqoWZSLXG+fmuPCxA6uX2i0VMqvjrg== 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=JnXEeuoL4Vv3p1Q4s5BuJZZqZVqTZWvpFCi98qbgHHU=; b=A7TGD37+jDKOa+AG3jQQ2cP6M3Vu9va1RXSBnWkYxN8t6/4N8DnE5M2b3pxRa/p5m2RqtiY/ImycicrpK4qjfFcO8w1MVi8Y9NH+97stYEZ/g5VmP72aJ6Zi+q/gLXXU71WNKzkjjYLQDgul9+8+Mhr/xQmqn05kfAzXQkifi5g= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, armbru@redhat.com, fam@euphon.net, stefanha@redhat.com, eblake@redhat.com, hreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com, jsnow@redhat.com Subject: [PATCH v6 15/16] iotests/image-fleecing: add test case with bitmap Date: Thu, 3 Mar 2022 20:43:48 +0100 Message-Id: <20220303194349.2304213-16-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220303194349.2304213-1-vsementsov@virtuozzo.com> References: <20220303194349.2304213-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: VE1PR03CA0038.eurprd03.prod.outlook.com (2603:10a6:803:118::27) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3e5ae0e2-5ffb-421b-5b1c-08d9fd4e3387 X-MS-TrafficTypeDiagnostic: VE1PR08MB4736:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ln2cTgUnd21c7lQIsE9/W9kASOPB3OzcPoVyNdx/8V6VjtE7ZB7Sp419EBLc46517fQ7RA9+YruZtbPXDK7SaEjjh2VZFFVQDZMk7Y3W+Y3jvVLYi0zUwKz7th3w3gIOEeKnkw/02C25vgHElBUGFpmwT1jPKKMttc+5NhBZweoAfg7FHoXd7KWktSK52Me2Wr0WgAMG6dZ5Mm+g/wNU/Phh6TFhtfEdHZk0inNljyopI8Y2uU9zjQE1yuhca7Z7XMfqqV0RnicmV4yQWq+N17S8JuhH5a4EMCt7dTPTJ89ou/DU/jcy2kQ21FcEFtux2qO/CIMIm7uRT60/FoDcfayWwejc+EQisCGvXuS5uM0GK/0QLpCfjp5G+CJWMUAQ6aoMqBeA5yXFgXtZ4orHgBE0X0VRYMpe4AsEtmtXNFAvwgknztB3yTHoM/tXeEnecms8G779JZo3OS2zGJxlRWCA/LsFpPN32L3+bl4X6joshcd93PdHke73EQ0cKvBt8F9p1s5nUiKhjLUZZPgipZsFWZ+EpDoUWx0uVVqde3SAHWy5tWlgMIh/GkRvbhbasBCiPfCI3m09r4xg6imSLq56OCxxUwSIV/ai4VOWyMNns8FPNPaMteD5K4u05HZ+uu7fCD5qy9qWcZX2tepkhr6uKxof5c42jCVUcGJy0H+GNWcGqx7eTlwRve6lajlR2KZiFe9CTPmvaagUo7iPsw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(6506007)(6512007)(26005)(6486002)(6666004)(186003)(1076003)(2616005)(316002)(6916009)(508600001)(36756003)(4326008)(8676002)(66476007)(83380400001)(66556008)(66946007)(86362001)(8936002)(5660300002)(52116002)(38100700002)(2906002)(38350700002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?ZIIaysrtRvVJ4v2i6BsxylT6+BsGlavfgUT/CKokJiXYt3YXioyV/MzuEZyc?= =?us-ascii?Q?DDIyPF0U2/45YvJv14QPXDLnc/6lWGR9emBhVCm7eBF5P7nDdFajtDgYdNYr?= =?us-ascii?Q?AgJoTt2IbKkq1b0MGVHSN+wQGsOzxUKfoZOnCeydWCXQa1tK5LSQ6RhDRuFi?= =?us-ascii?Q?pLp1i7jT+/8m2Wpri4kAml/3AzwCkfvmkc7yszkrRQTHGEBSK7b2pT9WnHge?= =?us-ascii?Q?WjpYEAppWGKNDrnZlbUBh1Ghy0H/UvVrWIymDF7yefenuobfXyylEmny1fSc?= =?us-ascii?Q?kEN5y1wqg2V1cDSSwAyHt8fgIozu06xDEb3o7Cz3uWC5xSovJ4MGD4H4/J8s?= =?us-ascii?Q?Ymqp0JWxUW+f+xxgwMHsqJq24rpN1WTTK60cJ4Cwe//S2mYISB1aWIyHmClM?= =?us-ascii?Q?afweUwr9E26Aq0udOZYr7GvvmMfyu7efhxn4hblc6sHpbq9t2+BVieQ6lGnj?= =?us-ascii?Q?VxSt/bOtVlmUGFi7aGzZR2ZBRESrXC7i5Px8A44mSMFhX9ADsTmLMjYiZO7Z?= =?us-ascii?Q?6vk+QI69u6xtSXhUROTTpxjWSwTarQy23Wc8dKDWqrkdchXl2XU+MXT6hItT?= =?us-ascii?Q?fPML2VfjzsMuBIXYEV3KvAMENJknDyn9iGYkuAKH3lGVKMyqZuL0YNUVRRaP?= =?us-ascii?Q?UZg4tdKCKh9czbndaQa4Vqkje5NnrF4NcKZ1fa+w4VqftJggmJ0u/iQU+OyS?= =?us-ascii?Q?d+O75vfvw3pv7czKCoq3XFy/BGDATYk3zaOeHy7nk5CUf2oIbamgaJQf7RiB?= =?us-ascii?Q?3W2xgxEMEqFVRD7hXoSZDqpYppaD898hgqoeLvhwH/LXCbKs0jAYIzxjINot?= =?us-ascii?Q?B9/ZVsR/vK1FVprRowxdrxEbVPp8fySMPuSw2Y1TRStOy19P741LQYASOOsw?= =?us-ascii?Q?J9H6j5DVFhDKDtfOa0EweQtVaYVmnr3ZnZOSx6rrucj4w7Jux173875Iihfz?= =?us-ascii?Q?Ukdwx7imDFRW/LOmPHXgch99VzOgIASbFUzg3x7e1HNbIo0DqbXNW0uwcAVE?= =?us-ascii?Q?liYjS+YaavrH2Xeocx1lyfZLKOS0tsoFsxf0DsJt8N5S7xRmguvd8se+roOI?= =?us-ascii?Q?Q+SFtNhnpgqiIYGd5s/LtB4AsAw+kb7A9K31BDJnImCpZMxnOyv/WvXQCRy+?= =?us-ascii?Q?D9TElF/EzrDYfKNmOKzX3h0zJcFnjF9+X0t0y9JB8t8DDW9N7zzzomg6JH1r?= =?us-ascii?Q?eBQwR70+L2zLJQYBa4i60/On1BvL+MvECCtiI8atkYluVshz3GWSa3HTqoQf?= =?us-ascii?Q?PshSY9flNpBNP5Zs14M4Dn45oBBVt++CCFqTPMBa8Ykth7ij03qiCvQWV2es?= =?us-ascii?Q?ubHZ1UMEgTGOdQ3wLoyePh62J8oZiFQgjmmMePeS5YNoifC5nwQtWGOFKfKg?= =?us-ascii?Q?WrlKvm11Y9uzxVyRQkHcuPqqq8EwPaoFEHsJOhJaONOMSE/3JP3eG0jc7Hyu?= =?us-ascii?Q?Ap3TZu254dgxZHAwFCu3tadad+cC6yY4D+lKm9JTunK6YwLsqzBOFsKReyMo?= =?us-ascii?Q?+Tan3zcelp3liI+w18suVbG3VmPNj4bt9b7cTqdeIIO+s+KitNKeUblOJOmI?= =?us-ascii?Q?+SOM9OhLmsUvGsjpsKMFdJmOJ56oxNVbi9iVuN3EWUdEYlYw/z7kBL7fxWkq?= =?us-ascii?Q?boB1fXkqG8xTe592fcVYVdYlmH334zzpELYk0+Zy2pA1KN56k2v+MLpunxBh?= =?us-ascii?Q?OSLaJg=3D=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3e5ae0e2-5ffb-421b-5b1c-08d9fd4e3387 X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Mar 2022 19:44:16.4202 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 3FATXL4TrcvQQW9TEJxnOaB+olkRM0AGFg3b3yAQiD6jUNgrqYdb9uqiS60pclVB0jZtnNc3b3zh35vloRTyelJLSxfELBw5j9Xq3kgbCCg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB4736 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a01:111:f400:7d00::701 (failed) 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=2a01:111:f400:7d00::701; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1646337769799100001 Content-Type: text/plain; charset="utf-8" Note that reads zero areas (not dirty in the bitmap) fails, that's correct. Signed-off-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/tests/image-fleecing | 38 +++++++--- tests/qemu-iotests/tests/image-fleecing.out | 84 +++++++++++++++++++++ 2 files changed, 113 insertions(+), 9 deletions(-) diff --git a/tests/qemu-iotests/tests/image-fleecing b/tests/qemu-iotests/t= ests/image-fleecing index 909fc0a7ad..c9ffa6647e 100755 --- a/tests/qemu-iotests/tests/image-fleecing +++ b/tests/qemu-iotests/tests/image-fleecing @@ -23,12 +23,14 @@ # Creator/Owner: John Snow =20 import iotests -from iotests import log, qemu_img, qemu_io, qemu_io_silent +from iotests import log, qemu_img, qemu_io, qemu_io_silent, \ + qemu_io_pipe_and_status =20 iotests.script_initialize( - supported_fmts=3D['qcow2', 'qcow', 'qed', 'vmdk', 'vhdx', 'raw'], + supported_fmts=3D['qcow2'], supported_platforms=3D['linux'], required_fmts=3D['copy-before-write'], + unsupported_imgopts=3D['compat'] ) =20 patterns =3D [('0x5d', '0', '64k'), @@ -50,11 +52,15 @@ remainder =3D [('0xd5', '0x108000', '32k'), # Right-en= d of partial-left [1] ('0xcd', '0x3ff0000', '64k')] # patterns[3] =20 def do_test(use_cbw, use_snapshot_access_filter, base_img_path, - fleece_img_path, nbd_sock_path, vm): + fleece_img_path, nbd_sock_path, vm, + bitmap=3DFalse): log('--- Setting up images ---') log('') =20 assert qemu_img('create', '-f', iotests.imgfmt, base_img_path, '64M') = =3D=3D 0 + if bitmap: + assert qemu_img('bitmap', '--add', base_img_path, 'bitmap0') =3D= =3D 0 + if use_snapshot_access_filter: assert use_cbw assert qemu_img('create', '-f', 'raw', fleece_img_path, '64M') =3D= =3D 0 @@ -106,12 +112,17 @@ def do_test(use_cbw, use_snapshot_access_filter, base= _img_path, =20 # Establish CBW from source to fleecing node if use_cbw: - log(vm.qmp('blockdev-add', { + fl_cbw =3D { 'driver': 'copy-before-write', 'node-name': 'fl-cbw', 'file': src_node, 'target': tmp_node - })) + } + + if bitmap: + fl_cbw['bitmap'] =3D {'node': src_node, 'name': 'bitmap0'} + + log(vm.qmp('blockdev-add', fl_cbw)) =20 log(vm.qmp('qom-set', path=3Dqom_path, property=3D'drive', value= =3D'fl-cbw')) =20 @@ -148,7 +159,10 @@ def do_test(use_cbw, use_snapshot_access_filter, base_= img_path, for p in patterns + zeroes: cmd =3D 'read -P%s %s %s' % p log(cmd) - assert qemu_io_silent('-r', '-f', 'raw', '-c', cmd, nbd_uri) =3D= =3D 0 + out, ret =3D qemu_io_pipe_and_status('-r', '-f', 'raw', '-c', cmd, + nbd_uri) + if ret !=3D 0: + print(out) =20 log('') log('--- Testing COW ---') @@ -166,7 +180,10 @@ def do_test(use_cbw, use_snapshot_access_filter, base_= img_path, for p in patterns + zeroes: cmd =3D 'read -P%s %s %s' % p log(cmd) - assert qemu_io_silent('-r', '-f', 'raw', '-c', cmd, nbd_uri) =3D= =3D 0 + out, ret =3D qemu_io_pipe_and_status('-r', '-f', 'raw', '-c', cmd, + nbd_uri) + if ret !=3D 0: + print(out) =20 log('') log('--- Cleanup ---') @@ -201,14 +218,14 @@ def do_test(use_cbw, use_snapshot_access_filter, base= _img_path, log('Done') =20 =20 -def test(use_cbw, use_snapshot_access_filter): +def test(use_cbw, use_snapshot_access_filter, bitmap=3DFalse): with iotests.FilePath('base.img') as base_img_path, \ iotests.FilePath('fleece.img') as fleece_img_path, \ iotests.FilePath('nbd.sock', base_dir=3Diotests.sock_dir) as nbd_sock_path, \ iotests.VM() as vm: do_test(use_cbw, use_snapshot_access_filter, base_img_path, - fleece_img_path, nbd_sock_path, vm) + fleece_img_path, nbd_sock_path, vm, bitmap=3Dbitmap) =20 =20 log('=3D=3D=3D Test backup(sync=3Dnone) based fleecing =3D=3D=3D\n') @@ -219,3 +236,6 @@ test(True, False) =20 log('=3D=3D=3D Test fleecing-format based fleecing =3D=3D=3D\n') test(True, True) + +log('=3D=3D=3D Test fleecing-format based fleecing with bitmap =3D=3D=3D\n= ') +test(True, True, bitmap=3DTrue) diff --git a/tests/qemu-iotests/tests/image-fleecing.out b/tests/qemu-iotes= ts/tests/image-fleecing.out index da0af93388..62e1c1fe42 100644 --- a/tests/qemu-iotests/tests/image-fleecing.out +++ b/tests/qemu-iotests/tests/image-fleecing.out @@ -190,6 +190,90 @@ read -P0 0x00f8000 32k read -P0 0x2010000 32k read -P0 0x3fe0000 64k =20 +--- Cleanup --- + +{"return": {}} +{"return": {}} +{"return": {}} +{"return": {}} +{"return": {}} + +--- Confirming writes --- + +read -P0xab 0 64k +read -P0xad 0x00f8000 64k +read -P0x1d 0x2008000 64k +read -P0xea 0x3fe0000 64k +read -P0xd5 0x108000 32k +read -P0xdc 32M 32k +read -P0xcd 0x3ff0000 64k + +Done +=3D=3D=3D Test fleecing-format based fleecing with bitmap =3D=3D=3D + +--- Setting up images --- + +Done + +--- Launching VM --- + +Done + +--- Setting up Fleecing Graph --- + +{"return": {}} +{"return": {}} +{"return": {}} +{"return": {}} + +--- Setting up NBD Export --- + +{"return": {}} +{"return": {}} + +--- Sanity Check --- + +read -P0x5d 0 64k +read -P0xd5 1M 64k +read -P0xdc 32M 64k +read -P0xcd 0x3ff0000 64k +read -P0 0x00f8000 32k +read failed: Invalid argument + +read -P0 0x2010000 32k +read failed: Invalid argument + +read -P0 0x3fe0000 64k +read failed: Invalid argument + + +--- Testing COW --- + +write -P0xab 0 64k +{"return": ""} +write -P0xad 0x00f8000 64k +{"return": ""} +write -P0x1d 0x2008000 64k +{"return": ""} +write -P0xea 0x3fe0000 64k +{"return": ""} + +--- Verifying Data --- + +read -P0x5d 0 64k +read -P0xd5 1M 64k +read -P0xdc 32M 64k +read -P0xcd 0x3ff0000 64k +read -P0 0x00f8000 32k +read failed: Invalid argument + +read -P0 0x2010000 32k +read failed: Invalid argument + +read -P0 0x3fe0000 64k +read failed: Invalid argument + + --- Cleanup --- =20 {"return": {}} --=20 2.31.1 From nobody Sun May 12 02:11:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1646337340; cv=pass; d=zohomail.com; s=zohoarc; b=YyhZrbn7GFsvkjbTX9FgVd+gTKV7g5MsXX6iCL/g0i4eu8pXWXdzcTlt7WFoAFAOaP3HSxkiuR01mrcLT60u7uxwKPWWFGDqJ8/LfROaxoZhucTA8OvBL8vVfEIoTUsKYprl28uJuVhBnWuhIHzO16MbQQc9sh48H/K0+T2k+9I= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646337340; 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=MPWq8WNPK3dD6vDdPAgUea/YC405nYdzt4CdrYSUjO8=; b=ZiHZ50qkrOEa2j5ErsOxLwl7uoN10FeFPrmQWh1yeBHjDcaQPuJpHT2i7K9OIiQISuEnf1fYP19Xwh+oPpUQHcnIAiz17cmRohYgo6XaRzhJOl2sizmlZKoqRXUSUs7r0tXBb9YTdkd3u6a3/QpTx4iytCsCp3pBsvmRnv5RU4s= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16463373403421013.0254315966124; Thu, 3 Mar 2022 11:55:40 -0800 (PST) Received: from localhost ([::1]:41204 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nPrY2-0008Qq-Uo for importer@patchew.org; Thu, 03 Mar 2022 14:55:39 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39268) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nPrNI-00048L-8l; Thu, 03 Mar 2022 14:44:33 -0500 Received: from [2a01:111:f400:7d00::72c] (port=28672 helo=EUR05-VI1-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 1nPrNF-0004Wu-Qs; Thu, 03 Mar 2022 14:44:32 -0500 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by VE1PR08MB4736.eurprd08.prod.outlook.com (2603:10a6:802:a6::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.26; Thu, 3 Mar 2022 19:44:17 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::4545:8e0c:19c7:2a6d]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::4545:8e0c:19c7:2a6d%5]) with mapi id 15.20.5038.014; Thu, 3 Mar 2022 19:44:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ajXrxEdq9xfM0sOTBGPh+bWD88bPJ9+oD+ThOrRxlXgiD4Fz8bU0/8YxMpRYv75PDugRtBvdeJPP+6SVz8sQmzwyxBC4gIdEw7D+BnN9OyVgj7KtW4yfKkkIZLvI2WUkKUDZ5rQ72F93v6qBdlXeOCjrTrRzX0jqY8quYkaSmvBfLZH/7YuRwUxKSNluKjjHQrteUbMNv0SlZ97aUWuMzaBRYDqc5RF6F8MpTnjzYmDzg0QNP59w/df/cbL0h6P7oyi1DL4UklXAxz9f593TAy68zUoCihuZ6LcNVDibmKXxsOuutkoW+meU+iFQmDwVM31MWh4vgicWinx2HS7MGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=MPWq8WNPK3dD6vDdPAgUea/YC405nYdzt4CdrYSUjO8=; b=K4P4Kb2u7SXcwLxo9y6fBjeHGw5CT7t5+X72HpZFsfEOB1NiFHkwVoCbpvVKmMcKvVdxVhb1Q/eBIZKBbRYJ8W2hokPUW4SrPcPKUB28/R+hV0pDdpbc5SxVfMMyAWdr5jJAEGLMzraE+M43m3daZsUtRxTz24dFPT2bzNrJ9YlYUI0dddry7UIfZVLf4IL5T9GSewAwYcVOGLxAfp1N2saPAWb9BPsx2nBcXb3INCB0b/KQkDD0DlHuvfeeF6oHEinIyzYYEETjCyKpjv6V6f/rXPjFfXSxMQoFucjgfDuahn/qouPLY1g2vrjeEkEzSuvSbqWREaM+e7/lWF96Jg== 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=MPWq8WNPK3dD6vDdPAgUea/YC405nYdzt4CdrYSUjO8=; b=l547U+j0kO2q1WxfEvHwXbFTz/bpgnIsILuXxzdzB0mEzEYer7DURsFV2x0hOVcKDsc47hD5WwrHYJQXwfY+nXFrs/KVYpHO7Zqmr4/1U//RN3YiICMtSE3fvFYw04RUQdjsuFQEB1bAgArwBb46LT1VRpHRkolioHwW9dFxS6c= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, armbru@redhat.com, fam@euphon.net, stefanha@redhat.com, eblake@redhat.com, hreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com, jsnow@redhat.com Subject: [PATCH v6 16/16] iotests/image-fleecing: test push backup with fleecing Date: Thu, 3 Mar 2022 20:43:49 +0100 Message-Id: <20220303194349.2304213-17-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220303194349.2304213-1-vsementsov@virtuozzo.com> References: <20220303194349.2304213-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: VE1PR03CA0038.eurprd03.prod.outlook.com (2603:10a6:803:118::27) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7fb3ead7-7a4f-4c5a-c6b2-08d9fd4e33f9 X-MS-TrafficTypeDiagnostic: VE1PR08MB4736:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0nGzzg3eL9rcLonKqhBIAkybog8QwXWk27x98urIHRjPdj87nxjJvw6IMIGErleF/4cDzn0nk/H7tgDbkg0HwL1iirlnK34xugHpPY5CYe3rSlSIcorL+RE4lmSsJrNs0g4iiGKU/qmdkp8jRvWlEl0FWj3c6NvpHcDNNCLMfNgceJ3XMDRSzjeDRcwLY/OeV74qAo7RtuO3MTVYNBWtK/4zdZmRkAvm25FMB+qsJUfouMJHQIwTNppiydtMQt6+vGPEeTid6MfsCeifa3ibg/n/uCyXO3OZSBYIBMaU67g9RKc+aBTtToZz4Wc+HQ72Akt9Bcre5A5kTCzLEUoe0IF+RHl83nssE6PFdel5yLDiDbxFekslJdAn7m045kUt75b0balCx0g4GizTZovRuxPGHnoCdOblny1oIj9qg32odvMFpTMO4JEtJ9JJcakUBpALWOnQ2fsXW3qtF7UbWyD5CTEUvojw0VAInwfPQ/l5nRAafqSZPC3r+AhOtGyo2CJRArOMtxJtOIRZ0RfH6BjuRFNy6qOCTSaUeV/LOpa/OlcQxLKwfVuzgzCuKAxLnF8tUDdvV92GwYkts8XzgNbzGRIlk6uB/0I61tQPN8bJuqbXzaPB/HMYDCdmxNHC4z+hOOyh1yykYi6NqzLvTfUGEhSCilfGuBU8aOevTI4zkJppAe+Xe2WRyhterRkLWHUxGYGXsYOkdQZ2cd+IkQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(6506007)(6512007)(26005)(6486002)(6666004)(186003)(1076003)(2616005)(316002)(6916009)(508600001)(36756003)(4326008)(8676002)(66476007)(83380400001)(66556008)(66946007)(86362001)(8936002)(5660300002)(52116002)(38100700002)(2906002)(38350700002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?BxdOWvjyzvoimWchdd/NWU6w7jFrvJdnDcEqBDrWrIMlFLUkdswz6erYTaSa?= =?us-ascii?Q?UeWQRk1Sp5yVDJ01N5l+KYCzhBcLlRBMrU0Fhqf+xvKrhH6wzHhmnqrEiPQ0?= =?us-ascii?Q?iEto6tD87+QcWDIotTHwlnWIW0qi79PjJIQmHVdo72NwzTIlAS9uu29IOOMy?= =?us-ascii?Q?gfIseSvXu/LMH+4fevaDwZiWsK8cMgeQo4DMecG/mjkKlddiQBwH24uLPtHw?= =?us-ascii?Q?3r3OenOP78WWctM+sKMu7cOXaKknJNOvn2/UkJqdVarrjuPCO1mPoCNqTicB?= =?us-ascii?Q?YbTBJ9eBRdp9n0OUVUVXXKd9aPeOxKkzHttHIMqmWcsEVgb5IdC7OIdird8Y?= =?us-ascii?Q?S6vYeVF1XmkZm/+sReFZC6jvE6biVVLTJgEx+l4uK77dLllqsm2Ydui318UH?= =?us-ascii?Q?PDj59RHAQwpgpUPvF8IIXtgRMo4KutBwy10mXd7PyMah7HiyfUIN8deq9klY?= =?us-ascii?Q?LSDEwpLhNlzIakEb1gHnnjT7CcIsZ9juPSp9NVBFVhjgpmuD4/zB4zwIksoy?= =?us-ascii?Q?UZIHFq59sLCDbWgCz3gXokYl6IMRl6OofSsenjvlMIp2177nwmh4SHvJ6i67?= =?us-ascii?Q?rUYxbraeyOh/RvxEJcO3Qbwz/w4TlCTq5C6pewq1lv4mqh5/yW9XBMnNIDR3?= =?us-ascii?Q?sM+5M5WIcdpuq3uD+gy9PSR2OZVo62e2F2Tn3JX17RNduAtWYKKyv91Moc1u?= =?us-ascii?Q?+cy4BQCVNa+ye9kiSpXC2+cXTYBupp8HJn68uOBzWL16faBuIIJ/nkQIB9nj?= =?us-ascii?Q?F8dockltN/2XpZ3W8Iijfr4q3ZxYbuAy8vil8zlZbi8JkcQE4JwVl9XXN0Th?= =?us-ascii?Q?uBrdormN5Zn5fXAK7gmL5oEUoWTJZYC/qpyMAP5nXazZgvDUJvlP6rfGwTkk?= =?us-ascii?Q?sIVIkA1WSB2nOyizRNJMgadpDZn4zfJ+/C1vcz0CVX8OJaWJwL6UI/u1Y2vX?= =?us-ascii?Q?YwWXhwfIxIInG/AI0k9OJcH1UQtRr1i3K9Sj5qDnjSP0zhs94Wd2R1AHQCtm?= =?us-ascii?Q?eTA/x/5mP4OXOoUiuyz1p5yC8GLGQ/VFKtkfszs+5B7VvkyboK1fxFDSGd+F?= =?us-ascii?Q?0M4kVkWB5DfIrn6haTeIFDoOLVfEhnkU0lknc1RFuuAcbvP5qk1Z5BQV8vow?= =?us-ascii?Q?RUvsdRT+6BzLTvezSUMpCE7Ku9uEYaLn/0IcTCYSP73+q8e3QuoSgaqLvqwH?= =?us-ascii?Q?EhAb+yavBq4UK25M6CSjZeAkOmvtx6NrZVpdFWDPQoMG1aNZ4IU0eYCIPGFs?= =?us-ascii?Q?Byt/Pw3LaloG0fjiZYqY8nqteh3sFyLeK1S1IASWKsgIYt8QdW0FVTecYWq8?= =?us-ascii?Q?D8wh6+pBuiRNlOzMVUXQIgrQTvYh+Tmm30Jl2MpkAvzfNkAYq2HB0JERGVj8?= =?us-ascii?Q?h1QeKt/xhTF/JW53QPVl9YR7PcBeT7bVLdPNqmYFlL2b4MQkkfEj/0uW+opy?= =?us-ascii?Q?Fym9lMkqpWvgg2jDC1MDvzX1X7Jwuss31oRUym8316zNX+S/J3s05n2wTJ/g?= =?us-ascii?Q?Ueo9mZkjvS2NiK8LHvDWxYWI1I5BL9PWl2QmZUNU669qszgDWNL7osKz7Vc7?= =?us-ascii?Q?rcVikw0GKExL5fzDc7cIXSzc6oHruViyfToCth8fJqnDJrYLVYh3CswCvWup?= =?us-ascii?Q?xfx9qIgV3mmS13uooDXWZhu4dKsmR3YuX5Si64xCrEpnN+M8k/ZWgj3SJhsG?= =?us-ascii?Q?81gYuQ=3D=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7fb3ead7-7a4f-4c5a-c6b2-08d9fd4e33f9 X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Mar 2022 19:44:17.2013 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: kK12NazOddUJV1XdTB4MP6rKvevORldifmKT/dDEgtJOCBtOJQj6AhnAY8ONIQja67cmxE4G/tRLBlUfb18pRb6TjC7gL3OfG7E4eFJ4k+A= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB4736 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a01:111:f400:7d00::72c (failed) 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=2a01:111:f400:7d00::72c; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1646337341704100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/tests/image-fleecing | 125 +++++++++++++++----- tests/qemu-iotests/tests/image-fleecing.out | 63 ++++++++++ 2 files changed, 156 insertions(+), 32 deletions(-) diff --git a/tests/qemu-iotests/tests/image-fleecing b/tests/qemu-iotests/t= ests/image-fleecing index c9ffa6647e..c56278639c 100755 --- a/tests/qemu-iotests/tests/image-fleecing +++ b/tests/qemu-iotests/tests/image-fleecing @@ -51,9 +51,15 @@ remainder =3D [('0xd5', '0x108000', '32k'), # Right-end= of partial-left [1] ('0xdc', '32M', '32k'), # Left-end of partial-right [2] ('0xcd', '0x3ff0000', '64k')] # patterns[3] =20 -def do_test(use_cbw, use_snapshot_access_filter, base_img_path, - fleece_img_path, nbd_sock_path, vm, +def do_test(vm, use_cbw, use_snapshot_access_filter, base_img_path, + fleece_img_path, nbd_sock_path=3DNone, + target_img_path=3DNone, bitmap=3DFalse): + push_backup =3D target_img_path is not None + assert (nbd_sock_path is not None) !=3D push_backup + if push_backup: + assert use_cbw + log('--- Setting up images ---') log('') =20 @@ -67,6 +73,9 @@ def do_test(use_cbw, use_snapshot_access_filter, base_img= _path, else: assert qemu_img('create', '-f', 'qcow2', fleece_img_path, '64M') = =3D=3D 0 =20 + if push_backup: + assert qemu_img('create', '-f', 'qcow2', target_img_path, '64M') = =3D=3D 0 + for p in patterns: qemu_io('-f', iotests.imgfmt, '-c', 'write -P%s %s %s' % p, base_img_path) @@ -141,28 +150,45 @@ def do_test(use_cbw, use_snapshot_access_filter, base= _img_path, =20 export_node =3D 'fl-access' if use_snapshot_access_filter else tmp_node =20 - log('') - log('--- Setting up NBD Export ---') - log('') + if push_backup: + log('') + log('--- Starting actual backup ---') + log('') =20 - nbd_uri =3D 'nbd+unix:///%s?socket=3D%s' % (export_node, nbd_sock_path) - log(vm.qmp('nbd-server-start', - {'addr': {'type': 'unix', - 'data': {'path': nbd_sock_path}}})) + log(vm.qmp('blockdev-add', **{ + 'driver': iotests.imgfmt, + 'node-name': 'target', + 'file': { + 'driver': 'file', + 'filename': target_img_path + } + })) + log(vm.qmp('blockdev-backup', device=3Dexport_node, + sync=3D'full', target=3D'target', + job_id=3D'push-backup', speed=3D1)) + else: + log('') + log('--- Setting up NBD Export ---') + log('') =20 - log(vm.qmp('nbd-server-add', device=3Dexport_node)) + nbd_uri =3D 'nbd+unix:///%s?socket=3D%s' % (export_node, nbd_sock_= path) + log(vm.qmp('nbd-server-start', + {'addr': { 'type': 'unix', + 'data': { 'path': nbd_sock_path } } })) =20 - log('') - log('--- Sanity Check ---') - log('') + log(vm.qmp('nbd-server-add', device=3Dexport_node)) =20 - for p in patterns + zeroes: - cmd =3D 'read -P%s %s %s' % p - log(cmd) - out, ret =3D qemu_io_pipe_and_status('-r', '-f', 'raw', '-c', cmd, - nbd_uri) - if ret !=3D 0: - print(out) + log('') + log('--- Sanity Check ---') + log('') + + for p in patterns + zeroes: + cmd =3D 'read -P%s %s %s' % p + log(cmd) + out, ret =3D qemu_io_pipe_and_status('-r', '-f', 'raw', '-c', = cmd, + nbd_uri) + if ret !=3D 0: + print(out) =20 log('') log('--- Testing COW ---') @@ -173,6 +199,23 @@ def do_test(use_cbw, use_snapshot_access_filter, base_= img_path, log(cmd) log(vm.hmp_qemu_io(qom_path, cmd, qdev=3DTrue)) =20 + if push_backup: + # Check that previous operations were done during backup, not after + # If backup is already finished, it's possible that it was finished + # even before hmp qemu_io write, and we didn't actually test + # copy-before-write operation. This should not happen, as we use + # speed=3D1. But worth checking. + result =3D vm.qmp('query-block-jobs') + assert len(result['return']) =3D=3D 1 + + result =3D vm.qmp('block-job-set-speed', device=3D'push-backup', s= peed=3D0) + assert result =3D=3D {'return': {}} + + log(vm.event_wait(name=3D'BLOCK_JOB_COMPLETED', + match=3D{'data': {'device': 'push-backup'}}), + filters=3D[iotests.filter_qmp_event]) + log(vm.qmp('blockdev-del', node_name=3D'target')) + log('') log('--- Verifying Data ---') log('') @@ -180,8 +223,12 @@ def do_test(use_cbw, use_snapshot_access_filter, base_= img_path, for p in patterns + zeroes: cmd =3D 'read -P%s %s %s' % p log(cmd) - out, ret =3D qemu_io_pipe_and_status('-r', '-f', 'raw', '-c', cmd, - nbd_uri) + args =3D ['-r', '-c', cmd] + if push_backup: + args +=3D [target_img_path] + else: + args +=3D ['-f', 'raw', nbd_uri] + out, ret =3D qemu_io_pipe_and_status(*args) if ret !=3D 0: print(out) =20 @@ -189,7 +236,8 @@ def do_test(use_cbw, use_snapshot_access_filter, base_i= mg_path, log('--- Cleanup ---') log('') =20 - log(vm.qmp('nbd-server-stop')) + if not push_backup: + log(vm.qmp('nbd-server-stop')) =20 if use_cbw: if use_snapshot_access_filter: @@ -218,24 +266,37 @@ def do_test(use_cbw, use_snapshot_access_filter, base= _img_path, log('Done') =20 =20 -def test(use_cbw, use_snapshot_access_filter, bitmap=3DFalse): +def test(use_cbw, use_snapshot_access_filter, + nbd_sock_path=3DNone, target_img_path=3DNone, bitmap=3DFalse): with iotests.FilePath('base.img') as base_img_path, \ iotests.FilePath('fleece.img') as fleece_img_path, \ - iotests.FilePath('nbd.sock', - base_dir=3Diotests.sock_dir) as nbd_sock_path, \ iotests.VM() as vm: - do_test(use_cbw, use_snapshot_access_filter, base_img_path, - fleece_img_path, nbd_sock_path, vm, bitmap=3Dbitmap) + do_test(vm, use_cbw, use_snapshot_access_filter, base_img_path, + fleece_img_path, nbd_sock_path, target_img_path, + bitmap=3Dbitmap) + +def test_pull(use_cbw, use_snapshot_access_filter, bitmap=3DFalse): + with iotests.FilePath('nbd.sock', + base_dir=3Diotests.sock_dir) as nbd_sock_path: + test(use_cbw, use_snapshot_access_filter, nbd_sock_path, None, + bitmap=3Dbitmap) + +def test_push(): + with iotests.FilePath('target.img') as target_img_path: + test(True, True, None, target_img_path) =20 =20 log('=3D=3D=3D Test backup(sync=3Dnone) based fleecing =3D=3D=3D\n') -test(False, False) +test_pull(False, False) =20 log('=3D=3D=3D Test cbw-filter based fleecing =3D=3D=3D\n') -test(True, False) +test_pull(True, False) =20 log('=3D=3D=3D Test fleecing-format based fleecing =3D=3D=3D\n') -test(True, True) +test_pull(True, True) =20 log('=3D=3D=3D Test fleecing-format based fleecing with bitmap =3D=3D=3D\n= ') -test(True, True, bitmap=3DTrue) +test_pull(True, True, bitmap=3DTrue) + +log('=3D=3D=3D Test push backup with fleecing =3D=3D=3D\n') +test_push() diff --git a/tests/qemu-iotests/tests/image-fleecing.out b/tests/qemu-iotes= ts/tests/image-fleecing.out index 62e1c1fe42..acfc89ff0e 100644 --- a/tests/qemu-iotests/tests/image-fleecing.out +++ b/tests/qemu-iotests/tests/image-fleecing.out @@ -293,3 +293,66 @@ read -P0xdc 32M 32k read -P0xcd 0x3ff0000 64k =20 Done +=3D=3D=3D Test push backup with fleecing =3D=3D=3D + +--- Setting up images --- + +Done + +--- Launching VM --- + +Done + +--- Setting up Fleecing Graph --- + +{"return": {}} +{"return": {}} +{"return": {}} +{"return": {}} + +--- Starting actual backup --- + +{"return": {}} +{"return": {}} + +--- Testing COW --- + +write -P0xab 0 64k +{"return": ""} +write -P0xad 0x00f8000 64k +{"return": ""} +write -P0x1d 0x2008000 64k +{"return": ""} +write -P0xea 0x3fe0000 64k +{"return": ""} +{"data": {"device": "push-backup", "len": 67108864, "offset": 67108864, "s= peed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {= "microseconds": "USECS", "seconds": "SECS"}} +{"return": {}} + +--- Verifying Data --- + +read -P0x5d 0 64k +read -P0xd5 1M 64k +read -P0xdc 32M 64k +read -P0xcd 0x3ff0000 64k +read -P0 0x00f8000 32k +read -P0 0x2010000 32k +read -P0 0x3fe0000 64k + +--- Cleanup --- + +{"return": {}} +{"return": {}} +{"return": {}} +{"return": {}} + +--- Confirming writes --- + +read -P0xab 0 64k +read -P0xad 0x00f8000 64k +read -P0x1d 0x2008000 64k +read -P0xea 0x3fe0000 64k +read -P0xd5 0x108000 32k +read -P0xdc 32M 32k +read -P0xcd 0x3ff0000 64k + +Done --=20 2.31.1