From patchwork Thu May 21 22:06:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 282077 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75428C433E0 for ; Thu, 21 May 2020 22:08:16 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3C617206F6 for ; Thu, 21 May 2020 22:08:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="oXtWt6kF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3C617206F6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:34796 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbtMN-0005ZJ-Bp for qemu-devel@archiver.kernel.org; Thu, 21 May 2020 18:08:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56504) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jbtLI-0003rb-Lk; Thu, 21 May 2020 18:07:09 -0400 Received: from mail-eopbgr70104.outbound.protection.outlook.com ([40.107.7.104]:17734 helo=EUR04-HE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jbtLH-0007vC-5a; Thu, 21 May 2020 18:07:08 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i1UysHU5Kl5EvrWwAANJeGd4qjMgHEUJfQBgxavSbEqfwLIZxqdvC6VcTfWOmEw/UOAfdFeh/Evzny1grw0mjxjmL23AAGEzY4lNrkJM8md72ZmQZb3o7Jo96TvQJzeG5dO1KkDVuiajyl0G7IpkxO5gqWq3505jVrnERfICPSk2vDH6xgsXDG1T8KncerdCEacuOKYJCuPaAES4O5L/A3xVYEq42NpV5X+XwqvVxLOUZwjMMRr9t+6uAj+W/OS5TGBfi2vjZ4E1MqQcO7G2/JRPLTtyweCJEvRq5Zl8YNFc1mvJ+ZwXfp6y/EDKXGI9Bknn3W0mbPKFtN88je6QEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+lip4dD19i4EOeKiQ0LX1sMJZbgdXQCeU57yRCNf1Zk=; b=fJpFSr/3C9BBzOTqF/b2D8i0nVl2Z/SsTONaPwBuzLfKftepbsTQuhH0VxezZi1Lp4JSeqv7s5+SpIrq74YbzdxDaeZzQN3e5XyTSIOrrDACvooZiEZKwUQ2Qq9KR2z0TdTCBVuCBeCkiSIgniDX9jWmaQGdIKdXrgcGpwXhiDJiJLGnntsa1fqHbCDE5Y+juw43agAQ/tivWAxVC5wrMc3K6DJ9gCnaRD8/9FaXPbtsUYqoubH2Cp+gIyvcbFcj/7xXF7zHWCSq41isinOMozy+3OtiKkcThmtB4EW6/gqucLtFjHk/JoICb7hfOZK2oMzQSJWGz8ENykhAhmQXsg== 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=+lip4dD19i4EOeKiQ0LX1sMJZbgdXQCeU57yRCNf1Zk=; b=oXtWt6kFT3+Bqvd7/i7+87UMAN0t0kcte9DyCdBCP9xAkJJwhmFWt/YOAEoTbHekGGfb49tCP/6ztYBYU/Ahck/7lelOpn2muxs/N0ouTpw8+/CSnQVVTpoEiheiRw9ZtKc1LFMo+w7fUAg1Htnl1ep7Sh6FnYyJmfvGUmV1FiQ= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none; nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM7PR08MB5512.eurprd08.prod.outlook.com (2603:10a6:20b:de::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.24; Thu, 21 May 2020 22:07:01 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::a408:2f0f:bc6c:d312]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::a408:2f0f:bc6c:d312%3]) with mapi id 15.20.3021.020; Thu, 21 May 2020 22:07:01 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v4 1/6] migration/block-dirty-bitmap: refactor init_dirty_bitmap_migration Date: Fri, 22 May 2020 01:06:43 +0300 Message-Id: <20200521220648.3255-2-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200521220648.3255-1-vsementsov@virtuozzo.com> References: <20200521220648.3255-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: AM3PR07CA0137.eurprd07.prod.outlook.com (2603:10a6:207:8::23) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (185.215.60.167) by AM3PR07CA0137.eurprd07.prod.outlook.com (2603:10a6:207:8::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.12 via Frontend Transport; Thu, 21 May 2020 22:07:00 +0000 X-Mailer: git-send-email 2.21.0 X-Originating-IP: [185.215.60.167] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8041b0bc-98b8-4b6c-78a8-08d7fdd349ed X-MS-TrafficTypeDiagnostic: AM7PR08MB5512: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3; X-Forefront-PRVS: 041032FF37 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pdG/JnPVHQW4UUWcIQaxrUhwSDhrUX0M8QctRxgRpyiOq8rBmZTaKcwl8TcnmISNOD9ITx+JD6+452UljA3BLi80CUzKTKoJaki2z1c0nOwaF6+loyMqoCx2lYboawePpTmkWTOm9h2CZezLSkXbvxaFUyJXiDR0pvj+ff3aNw5UvcqYXW11/8x3GisePqzfV7GgBjwCaerFy1rng68ZROvLXva77xMDdbU8beI0ndegvYEiRel0kiL78SDpDX36e133a2pCj0eGGUbSWzkmlUVLMA+EXhANHh6BgQeKh56Rd+uy+4pV+O1mkn0pp/x/ePoCOCoM7ukwxb8+D0fozkesUh1JpH4Rzunyku9MnaEdDCDfAfg8AvJZmMH5FlCGKGYvQ3S9VSESNtHjx34+IiV3P2NHzfVf1/7mvzgX4+A= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(346002)(366004)(396003)(136003)(376002)(39840400004)(8676002)(6512007)(186003)(26005)(6666004)(2906002)(7416002)(16526019)(316002)(6916009)(8936002)(6486002)(36756003)(6506007)(1076003)(107886003)(478600001)(4326008)(66556008)(66476007)(86362001)(5660300002)(66946007)(52116002)(2616005)(69590400007)(956004)(14143004); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: aJhV33YihziCHV1sztTE8kEWEELhW4nQiJxg1wRmebOfWDNtKIAeSFDbfFZXs/WEcNDOh7DKPHh9fYpu5xwlp7azvVzv3TnEH4fYjj1CU9GhW1eyYIRQsj1b5YTjl1cckxLSYt+65Ru3z7LfsD6BAI6S5Xf/01Fpep1oKdHNvnRSQ12w8545u8qT2yOWvs8pixyVeBobvgzufM0nU1J6SuM6bqKPRCdZnWelPwboiCGWDosNC8AKGc6qoPsGZMh+unnFSjZHlAC/Mh4AejD/rQ3Zw4eChRusC8GvqTVo2SsToQMd9J3dxYqjWYO5FkxGkjXu4Dmqi2VCMU6B384Yx6MJpS/WSrQnPyo7LvGSgftbSEoZlnoZujpAFqGLyeuiddfnk2XNDYBbToLrr4oaWBUtCwVZ4P+OYx38qhLgQvIGAaVXw4yP4Yb/R10/RINlJ/rCy2Hf/V04pNASsN2VdB3Tv1+G+Tk+yM7yg+NlQ8R96qxDG12TBk7ADdVDwUda X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8041b0bc-98b8-4b6c-78a8-08d7fdd349ed X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 May 2020 22:07:01.7685 (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: S6mjHuTigG2R0fsDQSmafNVshk8U1e3mAYsnP5RWnGypyE+4Fff0+Spt8LFRgTRi7lPupAqwQinwkmltV0nj8ww8CS6OgtfenMh2ryjKsME= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR08MB5512 Received-SPF: pass client-ip=40.107.7.104; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-HE1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/21 18:07:01 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, fam@euphon.net, vsementsov@virtuozzo.com, quintela@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com, stefanha@redhat.com, den@openvz.org, jsnow@redhat.com, dgilbert@redhat.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Split out handling one bs, it is needed for the following commit, which will handle BlockBackends separately. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake --- migration/block-dirty-bitmap.c | 89 +++++++++++++++++++--------------- 1 file changed, 49 insertions(+), 40 deletions(-) diff --git a/migration/block-dirty-bitmap.c b/migration/block-dirty-bitmap.c index 7eafface61..7e93718086 100644 --- a/migration/block-dirty-bitmap.c +++ b/migration/block-dirty-bitmap.c @@ -268,57 +268,66 @@ static void dirty_bitmap_mig_cleanup(void) } /* Called with iothread lock taken. */ -static int init_dirty_bitmap_migration(void) +static int add_bitmaps_to_list(BlockDriverState *bs, const char *bs_name) { - BlockDriverState *bs; BdrvDirtyBitmap *bitmap; DirtyBitmapMigBitmapState *dbms; Error *local_err = NULL; - dirty_bitmap_mig_state.bulk_completed = false; - dirty_bitmap_mig_state.prev_bs = NULL; - dirty_bitmap_mig_state.prev_bitmap = NULL; - dirty_bitmap_mig_state.no_bitmaps = false; + FOR_EACH_DIRTY_BITMAP(bs, bitmap) { + if (!bdrv_dirty_bitmap_name(bitmap)) { + continue; + } - for (bs = bdrv_next_all_states(NULL); bs; bs = bdrv_next_all_states(bs)) { - const char *name = bdrv_get_device_or_node_name(bs); + if (!bs_name || strcmp(bs_name, "") == 0) { + error_report("Found bitmap '%s' in unnamed node %p. It can't " + "be migrated", bdrv_dirty_bitmap_name(bitmap), bs); + return -1; + } - FOR_EACH_DIRTY_BITMAP(bs, bitmap) { - if (!bdrv_dirty_bitmap_name(bitmap)) { - continue; - } + if (bdrv_dirty_bitmap_check(bitmap, BDRV_BITMAP_DEFAULT, &local_err)) { + error_report_err(local_err); + return -1; + } - if (!name || strcmp(name, "") == 0) { - error_report("Found bitmap '%s' in unnamed node %p. It can't " - "be migrated", bdrv_dirty_bitmap_name(bitmap), bs); - goto fail; - } + bdrv_ref(bs); + bdrv_dirty_bitmap_set_busy(bitmap, true); + + dbms = g_new0(DirtyBitmapMigBitmapState, 1); + dbms->bs = bs; + dbms->node_name = bs_name; + dbms->bitmap = bitmap; + dbms->total_sectors = bdrv_nb_sectors(bs); + dbms->sectors_per_chunk = CHUNK_SIZE * 8 * + bdrv_dirty_bitmap_granularity(bitmap) >> BDRV_SECTOR_BITS; + if (bdrv_dirty_bitmap_enabled(bitmap)) { + dbms->flags |= DIRTY_BITMAP_MIG_START_FLAG_ENABLED; + } + if (bdrv_dirty_bitmap_get_persistence(bitmap)) { + dbms->flags |= DIRTY_BITMAP_MIG_START_FLAG_PERSISTENT; + } - if (bdrv_dirty_bitmap_check(bitmap, BDRV_BITMAP_DEFAULT, - &local_err)) { - error_report_err(local_err); - goto fail; - } + QSIMPLEQ_INSERT_TAIL(&dirty_bitmap_mig_state.dbms_list, + dbms, entry); + } - bdrv_ref(bs); - bdrv_dirty_bitmap_set_busy(bitmap, true); - - dbms = g_new0(DirtyBitmapMigBitmapState, 1); - dbms->bs = bs; - dbms->node_name = name; - dbms->bitmap = bitmap; - dbms->total_sectors = bdrv_nb_sectors(bs); - dbms->sectors_per_chunk = CHUNK_SIZE * 8 * - bdrv_dirty_bitmap_granularity(bitmap) >> BDRV_SECTOR_BITS; - if (bdrv_dirty_bitmap_enabled(bitmap)) { - dbms->flags |= DIRTY_BITMAP_MIG_START_FLAG_ENABLED; - } - if (bdrv_dirty_bitmap_get_persistence(bitmap)) { - dbms->flags |= DIRTY_BITMAP_MIG_START_FLAG_PERSISTENT; - } + return 0; +} + +/* Called with iothread lock taken. */ +static int init_dirty_bitmap_migration(void) +{ + BlockDriverState *bs; + DirtyBitmapMigBitmapState *dbms; + + dirty_bitmap_mig_state.bulk_completed = false; + dirty_bitmap_mig_state.prev_bs = NULL; + dirty_bitmap_mig_state.prev_bitmap = NULL; + dirty_bitmap_mig_state.no_bitmaps = false; - QSIMPLEQ_INSERT_TAIL(&dirty_bitmap_mig_state.dbms_list, - dbms, entry); + for (bs = bdrv_next_all_states(NULL); bs; bs = bdrv_next_all_states(bs)) { + if (add_bitmaps_to_list(bs, bdrv_get_device_or_node_name(bs))) { + goto fail; } } From patchwork Thu May 21 22:06:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 282076 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B672C433DF for ; Thu, 21 May 2020 22:08:25 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 600BD206F6 for ; Thu, 21 May 2020 22:08:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="FWV0QOAT" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 600BD206F6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:35774 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbtMW-0005xd-JS for qemu-devel@archiver.kernel.org; Thu, 21 May 2020 18:08:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56508) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jbtLK-0003t1-4s; Thu, 21 May 2020 18:07:10 -0400 Received: from mail-eopbgr70104.outbound.protection.outlook.com ([40.107.7.104]:17734 helo=EUR04-HE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jbtLJ-0007vC-7o; Thu, 21 May 2020 18:07:09 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iyvRcgXSfYllDkRkpmu+P0JEZKe92+UKJgV3vE8qNNvYzrZnmUdEBq9HJf+70WLApE5wSRJ5e1hbfKa/mE0ZiXelcI6UubfgKn5hJDScz+6MyHG85w8xdOrxLBCTrYCLADxa3xbH71tV1gZhHSbxE4Nsys+JOFis8xWSYNsj8BD3w/FKchO5hxLYJ0SDKU0DnGS6WG2Gc1Iq45xk4Sjd50H32hGrbXXxB4tlZ5wKxpDTB9RrY6c7cUXdpxX82CnNSWj1ZlgP22D9ZLOa7RdwbHmDiPM4tbHBTnB8I9vV42n1WGun5pfTTBPY9+kGGQMYmSWfC9cdF4cVtviVCfSQmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DVYcnaT6dR52w62/tGifxQOIl8agZQNiTMO0y90ZWQI=; b=OmElxXHGdHJYjvooe+P8e4GeIWCBpAN86rnk5TdZpsEkLn05Vxti4h37+vUrlJuASANBVmkbqFKdjdn3McVVxHrZjPpHj4Mf5oyuLtmThYC009DnUgBwZg9pbHED4WDsRRFR/Kru76OMGOtBBSHip8lBFoI6yAobye98Qb7AmdE5FKCdtfOrZ3c4SrJ/sWZtcdLzh9r28mHzzEkgO7m4AwiZBohNLe3g+PtDUigw3fBdMtO83DIvskQ1orvbmdMim87FgOf3u+Rg6jtp2Bhud/EJnUhvZ+5Ph4n+9ymfgQ983YUrjPlyVRbJDuJ3ZuNUZTItzRm6BZ8FbaJUiBqCTg== 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=DVYcnaT6dR52w62/tGifxQOIl8agZQNiTMO0y90ZWQI=; b=FWV0QOATjn3suJ6Ah3MTJHKyOEQwe5R1OBI0bbQpTvSGyisQY0U9YQ2ZLnR97I1ooEGr32igsFBSEOiCVXvczk5NA4dxb9jkj3M8aziMTgbDiRDnfnowB3K1W9Y3FB68fQ9bWidpCr/xzycIwkKrvLc7QgECztaA4zffw38lKBY= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none; nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM7PR08MB5512.eurprd08.prod.outlook.com (2603:10a6:20b:de::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.24; Thu, 21 May 2020 22:07:03 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::a408:2f0f:bc6c:d312]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::a408:2f0f:bc6c:d312%3]) with mapi id 15.20.3021.020; Thu, 21 May 2020 22:07:03 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v4 2/6] block/dirty-bitmap: add bdrv_has_named_bitmaps helper Date: Fri, 22 May 2020 01:06:44 +0300 Message-Id: <20200521220648.3255-3-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200521220648.3255-1-vsementsov@virtuozzo.com> References: <20200521220648.3255-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: AM3PR07CA0137.eurprd07.prod.outlook.com (2603:10a6:207:8::23) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (185.215.60.167) by AM3PR07CA0137.eurprd07.prod.outlook.com (2603:10a6:207:8::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.12 via Frontend Transport; Thu, 21 May 2020 22:07:02 +0000 X-Mailer: git-send-email 2.21.0 X-Originating-IP: [185.215.60.167] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f1a3878a-59f2-49f5-c7bd-08d7fdd34aaf X-MS-TrafficTypeDiagnostic: AM7PR08MB5512: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:18; X-Forefront-PRVS: 041032FF37 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3m0+zP5f+vMPk7XMXtv44jxANYE4XHWi3WmfRmF44byzUA7Hzd9Z0ZXoTFW0Yxw06rwsw0LTrG6/NIkTixg9ol9rpcDAh5vVk5GgoiNH/D1QHC20j2I0MWfQ5olI8oYElq4ic2B+jH/WA5pRYKbcqJdCK7XYFr3EVM+9nXVsnswMLwppFmWeIPhBJhpDRhruX1E/jSIhB4yXv5ikDpBGjSJMgABN1AwP7BuBlgEMHv02oK09OsaZIQFlzVHnoFG+bw90uytU4KP781xa4C+lIiisD9EwErl8TtkYfh64gtgeWOFtatpZFgcDG5BSaaoUnbrUfX9TlkN7rfXhED2I74NTfdr6T7eoXxImn0e7V6OoCbU4cJmXfqeAy1iHZctDYuUUyGpR8JSMrOoK4rLEQnSZEVoHBDd0xPzeFFmc++A= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(346002)(366004)(396003)(136003)(376002)(39840400004)(8676002)(6512007)(186003)(26005)(6666004)(2906002)(7416002)(16526019)(316002)(6916009)(8936002)(6486002)(36756003)(6506007)(1076003)(107886003)(478600001)(4326008)(66556008)(66476007)(86362001)(5660300002)(66946007)(52116002)(2616005)(69590400007)(956004)(14143004); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: AgVk5susrOoKjdVzQY0n7a19OKzr/gY706WPnujjLMHOivW/TUx4PjiadbzoM8BSys8/DMlqgHIWhXhDrgu7asOa+KTHmZRyeuRsnKgDwiiLzulz1Yo7z8u/8AfOZiFlvOS1HkVb1L9XoGyFYttYgcxtR+2+dgUCVn4Q0uz7OhSQ47JHerh1pvlN1AMhZxwbTsijF2WL89IvtbyufdlBlJUfRfk1XSkSYNcRlKbT3GOEDsVK/UZwueQpBFKb6LHWT+HD0yuMTV5d/xa6AG4LEafvAA/2iWT9em5iE4+DphaSNknf4eYXqRqpubEnXZgIEm0eT86KaPk3Ae+BkvDL+sMjWRNnoWtNfvrgB5sBzEXUVQfdEIKhG/6hQSmR6eAefaPdJh/R3OEpimIaML13+BCVnQ8/FgjX5DxXSz78rV8+drnCDKrJj0LXMJd/oZEhafQx673Ksq8wBICK6vTrVkryFxDBGXGt/1ztc8iinVc= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: f1a3878a-59f2-49f5-c7bd-08d7fdd34aaf X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 May 2020 22:07:03.0429 (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: EY/o+kjyr1sHsuFKXSNdZ9WdGJ9TyejYkdkvfx1GO/LGusA9dii40dmU+F1z7DdDQWh9pdZcJrdMyvNfIPjUttqcJmxpl7yJ9WWoz53F4MA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR08MB5512 Received-SPF: pass client-ip=40.107.7.104; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-HE1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/21 18:07:01 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, fam@euphon.net, vsementsov@virtuozzo.com, quintela@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com, stefanha@redhat.com, Andrey Shinkevich , den@openvz.org, jsnow@redhat.com, dgilbert@redhat.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" To be used for bitmap migration in further commit. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Andrey Shinkevich Reviewed-by: Eric Blake --- include/block/dirty-bitmap.h | 1 + block/dirty-bitmap.c | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/include/block/dirty-bitmap.h b/include/block/dirty-bitmap.h index 5a8d52e4de..36e8da4fc2 100644 --- a/include/block/dirty-bitmap.h +++ b/include/block/dirty-bitmap.h @@ -95,6 +95,7 @@ int64_t bdrv_get_dirty_count(BdrvDirtyBitmap *bitmap); void bdrv_dirty_bitmap_truncate(BlockDriverState *bs, int64_t bytes); bool bdrv_dirty_bitmap_readonly(const BdrvDirtyBitmap *bitmap); bool bdrv_has_readonly_bitmaps(BlockDriverState *bs); +bool bdrv_has_named_bitmaps(BlockDriverState *bs); bool bdrv_dirty_bitmap_get_autoload(const BdrvDirtyBitmap *bitmap); bool bdrv_dirty_bitmap_get_persistence(BdrvDirtyBitmap *bitmap); bool bdrv_dirty_bitmap_inconsistent(const BdrvDirtyBitmap *bitmap); diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c index f9bfc77985..c01319b188 100644 --- a/block/dirty-bitmap.c +++ b/block/dirty-bitmap.c @@ -818,6 +818,19 @@ bool bdrv_has_readonly_bitmaps(BlockDriverState *bs) return false; } +bool bdrv_has_named_bitmaps(BlockDriverState *bs) +{ + BdrvDirtyBitmap *bm; + + QLIST_FOREACH(bm, &bs->dirty_bitmaps, list) { + if (bdrv_dirty_bitmap_name(bm)) { + return true; + } + } + + return false; +} + /* Called with BQL taken. */ void bdrv_dirty_bitmap_set_persistence(BdrvDirtyBitmap *bitmap, bool persistent) { From patchwork Thu May 21 22:06:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 282075 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C576AC433DF for ; Thu, 21 May 2020 22:09:52 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8EA3E206F6 for ; Thu, 21 May 2020 22:09:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="bcttCbiG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8EA3E206F6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:43408 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbtNv-0000lm-Ps for qemu-devel@archiver.kernel.org; Thu, 21 May 2020 18:09:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56518) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jbtLM-0003vt-F8; Thu, 21 May 2020 18:07:13 -0400 Received: from mail-eopbgr70104.outbound.protection.outlook.com ([40.107.7.104]:17734 helo=EUR04-HE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jbtLL-0007vC-Jn; Thu, 21 May 2020 18:07:12 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NDucc2+fEsKmykredQOZHfbLOzUtn3LqWOUe/h8svWgqCoVAaj/gA1K8IAP939odaaODQFAqi6evQ+CixZ6+ZPQzzXu7cPrean5BzB2Annx2k0h67uJbVM+pf9kl/NQKqAcsDm0R5kjPINiQw1GEN0EgQTHrkwty9FVXeZiYK0s/czv7KsSt6QK9LvwG2abtFb2fUsHVOVMlZzuQjRVDq0bNUBw35xPz+ybqfR1aBue43qKoyFLN27aCMbDkX+0G6//L6HFGZrMiDShjl7iHLc49gY54CWlLkSgXxxw0KXk3UKPlrhZJd+OihSl8Y57oDY4mZ7dsGh53iZswG0te3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VHP1moYfx+Izoo1zlpgDF/AE2vXuhq5vSzP8W+8q1cY=; b=KxRsATedAylr7THHMHf1cJCKT4jK2Q01eLcy598nmSXfqm8CCmzdyA6pT9BlzKqW19o8tH5VyKhrhd0Q7OIKB1onzGBePATx9/mjB7hGuUIEs4vUbZU5A/9/pLQ0PHjYz/DSP9NIFLySS5lzqIDA0GKshNUIVJDbvweb+9ZHPvFli5T7TLNFwmQWEL0qRMeVh4MN0OOYEa5+gGRD9PFp26+MBQEUZZkeWWRf6mD+9NG7k9Sdc9oPVQNTt8vArPFpteX/Itz0mrms1yz5fVjos9O7Ve0NwKV6VekaAw6urSRkvVTyegsdllGiN1aMMxUCuQX3H/9rZSuBCyAe9YuNtA== 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=VHP1moYfx+Izoo1zlpgDF/AE2vXuhq5vSzP8W+8q1cY=; b=bcttCbiGJzSQo+gciLMRyUIxYgdrNoexHReHu4jeo5UPfMmP4HDSeG7g222QaLv2SJPQfhoxc1pPcZh450qQDQSwgW44FHuSfAhpQWXdfAYnvDpqsc9mVxWPsxIjiwXQCypJiSgkdNrefMDwBcjC9K1qzoSK1dmIZX3TW8EepfI= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none; nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM7PR08MB5512.eurprd08.prod.outlook.com (2603:10a6:20b:de::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.24; Thu, 21 May 2020 22:07:04 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::a408:2f0f:bc6c:d312]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::a408:2f0f:bc6c:d312%3]) with mapi id 15.20.3021.020; Thu, 21 May 2020 22:07:04 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v4 3/6] migration/block-dirty-bitmap: fix bitmaps pre-blockdev migration during mirror job Date: Fri, 22 May 2020 01:06:45 +0300 Message-Id: <20200521220648.3255-4-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200521220648.3255-1-vsementsov@virtuozzo.com> References: <20200521220648.3255-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: AM3PR07CA0137.eurprd07.prod.outlook.com (2603:10a6:207:8::23) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (185.215.60.167) by AM3PR07CA0137.eurprd07.prod.outlook.com (2603:10a6:207:8::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.12 via Frontend Transport; Thu, 21 May 2020 22:07:03 +0000 X-Mailer: git-send-email 2.21.0 X-Originating-IP: [185.215.60.167] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8864a877-3606-4437-b6d5-08d7fdd34b40 X-MS-TrafficTypeDiagnostic: AM7PR08MB5512: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1850; X-Forefront-PRVS: 041032FF37 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lKUMbWnnkTgUNV16HO9pRB42bf/2fKMa9GBlnbHCfm7XsMVrWnBkB5Q0alfxngUsRVrZr4zYbR1PiNdNLnYGAnnpwjLFLae9vneKD79eWEYcRMasSoXYzb5TjPsko71I+83iMaH4DcIo4+fhandRnWMFnCakxqX6h8GKqZV9bhBtf7vzfZeQtPhmqPDwd4lLNByMqcI/y4GdY2nFvxAMyNhwWBD8UjfcTkNxLWhIj2fMRQ/0UlpXk5Eg03uRJCVDX/B47arO4Oc4c+stFg4JJFsz3oklHY9aPqQ5LECV7QR3/318LFPwfBuTvXfSqucIbf3VfkrGKhOvFVEtk6Lc2kuaP9K/p5nBTWw3w66IlDLGABHcjhm3HFGHNARd9Ph33ZJmMvxL3eP4+AGj8DPyf4R4DhxrSRrpUob2wdZe3OJ06NEOzgQo4TtcUI492FWOR5WDQhiOG/AVFaye691BBrM0o24BHhpEYEVIgY0cIvY= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(346002)(366004)(396003)(136003)(376002)(39840400004)(8676002)(6512007)(186003)(26005)(6666004)(2906002)(7416002)(16526019)(316002)(6916009)(8936002)(6486002)(36756003)(6506007)(1076003)(107886003)(478600001)(966005)(4326008)(66556008)(66476007)(86362001)(5660300002)(66946007)(52116002)(2616005)(69590400007)(956004)(14143004); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: 4nFV8IiryvIOpLWHZ8hNn4yuzWggk80wYqiOOvLBgX26iolwLWCkmT31ZHFyXBYLDsdr1+BznrBuqB0iOTnU5WjhFlLTs26SER0n58jYYxxcusXPAMzYqcnZn9B8BG/LlOZswRO+e4OuKpLxoLmtXyFt4NMwUnC0QO8Zq/puRh/dTTkhxnjy3O+ozQGqN2+SnKAXGEe9dzMsUf6RXmbXt7icRzKX7Q2Qnbq8E0zI22L4IV+WpGv8W7zTc8tXuJpaRWckozLqb7zOMvUXgnUdct0lx6rSUH0KqcurkzdtWCojN40d3twNg95S//obbA66lydD8jETSRj38stlAdUlJLSWBP8thqC1/iNEhYe7LWUSg2ZdmfoZRvVY0Hk6nx3Wh9LkXzR1vOVcSUeSCBZRuPRCGhUb10G2YA0JCxt6YY8mmyGWkIVUFMMCLR1SolNlh+UqKoRlf4xoEgB4Lv3hPgZ83JZc7xU9dGHe7W4CIi8= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8864a877-3606-4437-b6d5-08d7fdd34b40 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 May 2020 22:07:03.9898 (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: 1PbxrgoxA3ewGEe0ITg0bsxx8o5RraXUuH+ll/VUswHS6i6bjAPZPDAoVyXHhLgksGZ7buIRFxIgZn4AGWonx8bHLqUDJ6iF0NIlUvXqpM4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR08MB5512 Received-SPF: pass client-ip=40.107.7.104; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-HE1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/21 18:07:01 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, fam@euphon.net, vsementsov@virtuozzo.com, quintela@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com, stefanha@redhat.com, den@openvz.org, jsnow@redhat.com, dgilbert@redhat.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Important thing for bitmap migration is to select destination block node to obtain the migrated bitmap. Prepatch, on source we use bdrv_get_device_or_node_name() to identify the node, and on target we do bdrv_lookup_bs. bdrv_get_device_or_node_name() returns blk name only for direct children of blk. So, bitmaps of direct children of blks are migrated by blk name and others - by node name. Old libvirt is unprepared to bitmap migration by node-name, node-names are mostly auto-generated. So actually only migration by blk name works for it. Newer libvirt will use new interface (which will be added soon) to specify node-mapping for bitmaps migration explicitly. Still, let's improve the current behavior a bit. Now, consider classic libvirt migrations assisted by mirror block job: mirror block job inserts filter, so our source is not a direct child of blk, and bitmaps are migrated by node-names. And this just doesn't work with auto-generated node names. Let's fix it by using blk-name even if some implicit filters are inserted. Note2: we, of course, can't skip filters and use blk name to migrate bitmaps in filtered node by blk name for this blk if these filters have named bitmaps which should be migrated. Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1652424 Signed-off-by: Vladimir Sementsov-Ogievskiy --- migration/block-dirty-bitmap.c | 45 +++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/migration/block-dirty-bitmap.c b/migration/block-dirty-bitmap.c index 7e93718086..04a5525fd1 100644 --- a/migration/block-dirty-bitmap.c +++ b/migration/block-dirty-bitmap.c @@ -319,14 +319,54 @@ static int init_dirty_bitmap_migration(void) { BlockDriverState *bs; DirtyBitmapMigBitmapState *dbms; + GHashTable *handled_by_blk = g_hash_table_new(NULL, NULL); + BlockBackend *blk; dirty_bitmap_mig_state.bulk_completed = false; dirty_bitmap_mig_state.prev_bs = NULL; dirty_bitmap_mig_state.prev_bitmap = NULL; dirty_bitmap_mig_state.no_bitmaps = false; + /* + * Use blockdevice name for direct (or filtered) children of named block + * backends. + */ + for (blk = blk_next(NULL); blk; blk = blk_next(blk)) { + const char *name = blk_name(blk); + + if (!name || strcmp(name, "") == 0) { + continue; + } + + bs = blk_bs(blk); + + /* Skip filters without bitmaos */ + while (bs && bs->drv && bs->drv->is_filter && + !bdrv_has_named_bitmaps(bs)) + { + if (bs->backing) { + bs = bs->backing->bs; + } else if (bs->file) { + bs = bs->file->bs; + } else { + bs = NULL; + } + } + + if (bs && bs->drv && !bs->drv->is_filter) { + if (add_bitmaps_to_list(bs, name)) { + goto fail; + } + g_hash_table_add(handled_by_blk, bs); + } + } + for (bs = bdrv_next_all_states(NULL); bs; bs = bdrv_next_all_states(bs)) { - if (add_bitmaps_to_list(bs, bdrv_get_device_or_node_name(bs))) { + if (g_hash_table_contains(handled_by_blk, bs)) { + continue; + } + + if (add_bitmaps_to_list(bs, bdrv_get_node_name(bs))) { goto fail; } } @@ -340,9 +380,12 @@ static int init_dirty_bitmap_migration(void) dirty_bitmap_mig_state.no_bitmaps = true; } + g_hash_table_destroy(handled_by_blk); + return 0; fail: + g_hash_table_destroy(handled_by_blk); dirty_bitmap_mig_cleanup(); return -1; From patchwork Thu May 21 22:06:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 282074 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A45CC433E0 for ; Thu, 21 May 2020 22:11:31 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EE3A52078B for ; Thu, 21 May 2020 22:11:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="gmKo5KZc" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EE3A52078B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:49730 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbtPW-0003Ux-6U for qemu-devel@archiver.kernel.org; Thu, 21 May 2020 18:11:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56534) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jbtLS-00048E-8h; Thu, 21 May 2020 18:07:18 -0400 Received: from mail-eopbgr70104.outbound.protection.outlook.com ([40.107.7.104]:17734 helo=EUR04-HE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jbtLR-0007vC-Dw; Thu, 21 May 2020 18:07:17 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IZvB/5XpB6Q08tSHkPxlkrZ+8FYS7Rd4fk0Spue8g7f1kxzEGUtK1aEbaE1yIGYQk294ou5nXShmmljtG7GtLWcyYM0saIilvVL6IDp2JDwS+V4pezvQEkxPYWkkjXeGEStt8imrv2QEtz6CYW/6t0i2BFdBLv2DkFiqZ1Kbb1nz/TWUyyQAl+ZrpgDr2r4a2nhcle9LQa+vFZDx8cdOe8woUxHhzEobV13V8VzkFFKtpQyx1WKnucTMEs9LbtQyEsaBFHW1oxgFVpoGfK+j2w1zrsWe4AFgsDP9Hc04oELkGueAJJYQ1KNNtbK42NWug7yiMg/SIH/ATDxymNGrwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Nh1oSws41SPggEtrgs3Oo8zYiqbmB66j9rd1Csi4WIY=; b=mHYfcrfqmRkauqt+p/7StBwuD6oWWqZ9k8Xw3eQO6I5auSzjRsfdXI5DPeE5JvTEQ1UGKdpjJVuhF90dmGv8bfzeXlJHwy5sUQh7hx9OBhQyvv68f0JRdPkUuGkALJiGiPs4mn8UleNZHzcxzli01HVkKOOjtVBtAHTRVZbYJ5xj2+MHMbOb2NDx/HSN1fAf1i7xhXAx7N+Fni3xBv4Z7OWR98gEUTz/0/stay+Mbo2r9gpCvp550kOxgSDuMiGLBTXZShUffftogDD8K4vhMYl2ldfKztNm08BpZUCfdWyOINg1LbxGqryr0hn+pGbnUQrpghIRbpFCMaTZpkndJA== 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=Nh1oSws41SPggEtrgs3Oo8zYiqbmB66j9rd1Csi4WIY=; b=gmKo5KZcHf6NvJzYVlUazqJ2ywZ6deLLbUA/5XzgBVeEvGnGu6rzFzJfkCCoDMaAq99/eNA2S/KCUjfHFk/sGX66aG7/XsY568hyI6r3yrT9P5S6ZvtkDk/+SFSVPqOhkJ+12zqWtuFNsxlWFFl+pbj2c9+b+g2sil73bzQI9MA= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none; nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM7PR08MB5512.eurprd08.prod.outlook.com (2603:10a6:20b:de::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.24; Thu, 21 May 2020 22:07:07 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::a408:2f0f:bc6c:d312]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::a408:2f0f:bc6c:d312%3]) with mapi id 15.20.3021.020; Thu, 21 May 2020 22:07:07 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v4 6/6] migration/block-dirty-bitmap: forbid migration by generated node-name Date: Fri, 22 May 2020 01:06:48 +0300 Message-Id: <20200521220648.3255-7-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200521220648.3255-1-vsementsov@virtuozzo.com> References: <20200521220648.3255-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: AM3PR07CA0137.eurprd07.prod.outlook.com (2603:10a6:207:8::23) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (185.215.60.167) by AM3PR07CA0137.eurprd07.prod.outlook.com (2603:10a6:207:8::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.12 via Frontend Transport; Thu, 21 May 2020 22:07:06 +0000 X-Mailer: git-send-email 2.21.0 X-Originating-IP: [185.215.60.167] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 93fdb6e3-2c73-4770-9fad-08d7fdd34d1b X-MS-TrafficTypeDiagnostic: AM7PR08MB5512: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:15; X-Forefront-PRVS: 041032FF37 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WxixpQAQ+MZf1Kt5WJ3O+k9488LdLSqfELdMz0Lqyemvc9rYpXrA3h2000VLGL8otZlnrnq3VrOxUkgi108/UTesGOrc2JpCbcY1+U7PTbnl+M1Bd6I/qMxI/QiYUtzvXtF1eQT6QywlHnGeQK3Z/qIKLn2q6cyyhcad2t+a5MB4Y4dKaf6vCEddYjwieMoKLXyS9sBtXjMbH5rwTSynV/D9LJPdTioGWipwTcVRCom1XYTXzsUtzZKpXRXFp14NOY/VQuvJOgYEHo26UOAykeiCx9GtoqWmWammchDoqSAv2z4xEr2zAMKyf5Fdvv2/uCEazfRFw2U/70je5fydVGuS+xJIbq8Q8zJNRfpXk8Mkjf6pK/GFRmscIngcL0fzclkESxY5BViaBTpCB5EGvA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(346002)(366004)(396003)(136003)(376002)(39840400004)(8676002)(6512007)(186003)(26005)(6666004)(2906002)(7416002)(16526019)(316002)(6916009)(8936002)(6486002)(36756003)(6506007)(1076003)(107886003)(478600001)(4326008)(66556008)(66476007)(86362001)(5660300002)(66946007)(52116002)(2616005)(69590400007)(956004)(14143004); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: pe0rNW1ir4LQ3ghbP5HCgW1FmaP0euIjQDpDfBTEr8btXYtrCx3ZY8PL28ihAAK3cd92047A7t2nYxCggWMcSb2kKB276ywc99pF80KHBFQZ0RRNSl6C9yM7ECqeCDSYAljnhD04V9lThpYcuv1dUpDG/qDEPG/QwjKHodHvU8YrJKGM69iAFyp5RqRbvHlBh/pD468uyCl2IpATl6VsZk4o4OOE8mSsS0GMpmR6Mg4fGC/r58CLPaI26arjiYJAfIKfxBBqIFdqrXPM/dW7iwpz1dxyuspZItei1IytUYfYVSDO8AHCkx6wsVMd2cG2Wn75Wc77Z2hsgzPUdvdo2MPqjgSrb90AynXIvFqVkRpo0wmJH+Z1/QintdMAxONGPhU1Ha8LQdWNg7H2WgSxDKaC0Sk3R00+eDruNP4w8qMojwY3d55EjXJxhMziThtYiCV0kpm1SFeaD2uVjPMhoLSerhmeBWkVwfQnvasMhuQ= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 93fdb6e3-2c73-4770-9fad-08d7fdd34d1b X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 May 2020 22:07:07.1987 (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: LPRtoBk2FVzA3DgueYwB0zBeCSIgGjqvbhV74VKlh4ep1vn6rHHcz5HKSdFG+u4SQnxYqkwUhnqpj1GObJrwkoT4fhm+vTseDLgvvm3zEvI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR08MB5512 Received-SPF: pass client-ip=40.107.7.104; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-HE1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/21 18:07:01 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, fam@euphon.net, vsementsov@virtuozzo.com, quintela@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com, stefanha@redhat.com, Andrey Shinkevich , den@openvz.org, jsnow@redhat.com, dgilbert@redhat.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" It actually never worked with libvirt, as auto-generated names are different on source and destination. It's unsafe and useless to migrate by auto-generated node-names, so let's forbid it. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Andrey Shinkevich Reviewed-by: Eric Blake --- migration/block-dirty-bitmap.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/migration/block-dirty-bitmap.c b/migration/block-dirty-bitmap.c index 65f2948f07..71528581e4 100644 --- a/migration/block-dirty-bitmap.c +++ b/migration/block-dirty-bitmap.c @@ -285,6 +285,13 @@ static int add_bitmaps_to_list(BlockDriverState *bs, const char *bs_name) return -1; } + if (bs_name[0] == '#') { + error_report("Bitmap '%s' in a node with auto-generated " + "name '%s' can't be migrated", + bdrv_dirty_bitmap_name(bitmap), bs_name); + return -1; + } + FOR_EACH_DIRTY_BITMAP(bs, bitmap) { if (!bdrv_dirty_bitmap_name(bitmap)) { continue;