From nobody Sun May 19 19:40:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1588254013; cv=none; d=zohomail.com; s=zohoarc; b=KhH5mzVINUxf+l0GBHbsrdZFrhLRKuRZ/IWDent4hFs5w1sHyzrPwgvKUyOfzbAyCgbNdzsONjLkAw+Joyg57Z64Vn2CfZou125k5iwCQi9KrviaEj3Hr6tf/iaSpsFdrwb5nbDihyez7E+EVKwhV5/cp2lmfQOKQFwW4l+6/XY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588254013; 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=fDYZ/edZH6mxqJLMYiIk3JMWOXwnpwPCJ2Glil1Gqtg=; b=h0G97jo1ufBgfbMwHnCzNFNCv4aKJPhdJbluEZ1xDmhUa4ImaBeRQfhrZKfgduYB3QbemuUcMq2AP7EjmhFx2eCUZR+Q/Q0duJf8q/d4h0fGovjBOeDjyfmHqAqOWLDtcbnodULd0plsjDOZrqclPcl1B6PPGQU8jpvys7BjTcE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1588254013191603.489068482851; Thu, 30 Apr 2020 06:40:13 -0700 (PDT) Received: from localhost ([::1]:40958 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jU9QB-0003Jz-Pn for importer@patchew.org; Thu, 30 Apr 2020 09:40:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47724) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jU9KS-0007yv-DF for qemu-devel@nongnu.org; Thu, 30 Apr 2020 09:37:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jU9Gi-0004CC-KD for qemu-devel@nongnu.org; Thu, 30 Apr 2020 09:34:16 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:36823 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jU9Gh-00044M-Vb for qemu-devel@nongnu.org; Thu, 30 Apr 2020 09:30:24 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-290-9Ud6x9WkOGeHZLqI0Usr5A-1; Thu, 30 Apr 2020 09:30:19 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1ABD3EC1A1; Thu, 30 Apr 2020 13:30:18 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-60.ams2.redhat.com [10.36.114.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 19D7666071; Thu, 30 Apr 2020 13:30:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588253422; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fDYZ/edZH6mxqJLMYiIk3JMWOXwnpwPCJ2Glil1Gqtg=; b=fzdmCoyx6lhX2CuBqHlJylnaMeVwBBD+VhjCAvkwf5lNlETG+2ro4ntfho35R7dKmptzWg gTeeiXdkVx0dtfcI25trA3I/aJcgxbgSdJeTyyhWFhVFmN2Z6Bo34VfBet3eMZ7mFnf78D kK4c6lDcvmMD+BucjKBSi3c0/ejrJyw= X-MC-Unique: 9Ud6x9WkOGeHZLqI0Usr5A-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PATCH 1/6] vmdk: Rename VmdkMetaData.valid to new_allocation Date: Thu, 30 Apr 2020 15:30:02 +0200 Message-Id: <20200430133007.170335-2-kwolf@redhat.com> In-Reply-To: <20200430133007.170335-1-kwolf@redhat.com> References: <20200430133007.170335-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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=205.139.110.120; envelope-from=kwolf@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/30 01:24:05 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.120 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, qemu-devel@nongnu.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" m_data is used for zero clusters even though valid =3D=3D 0. It really only means that a new cluster was allocated in the image file. Rename it to reflect this. While at it, change it from int to bool, too. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- block/vmdk.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/block/vmdk.c b/block/vmdk.c index 8ec18f35a5..5b09275578 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -180,7 +180,7 @@ typedef struct VmdkMetaData { unsigned int l1_index; unsigned int l2_index; unsigned int l2_offset; - int valid; + bool new_allocation; uint32_t *l2_cache_entry; } VmdkMetaData; =20 @@ -1492,7 +1492,7 @@ static int get_cluster_offset(BlockDriverState *bs, unsigned int l2_size_bytes =3D extent->l2_size * extent->entry_size; =20 if (m_data) { - m_data->valid =3D 0; + m_data->new_allocation =3D false; } if (extent->flat) { *cluster_offset =3D extent->flat_start_offset; @@ -1630,7 +1630,7 @@ static int get_cluster_offset(BlockDriverState *bs, return ret; } if (m_data) { - m_data->valid =3D 1; + m_data->new_allocation =3D true; m_data->l1_index =3D l1_index; m_data->l2_index =3D l2_index; m_data->l2_offset =3D l2_offset; @@ -2021,7 +2021,7 @@ static int vmdk_pwritev(BlockDriverState *bs, uint64_= t offset, if (ret) { return ret; } - if (m_data.valid) { + if (m_data.new_allocation) { /* update L2 tables */ if (vmdk_L2update(extent, &m_data, cluster_offset >> BDRV_SECTOR_BITS) --=20 2.25.3 From nobody Sun May 19 19:40:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1588254152; cv=none; d=zohomail.com; s=zohoarc; b=FDdYeEBMmpwTkIqK3omO4NlyhRHUvaeuhEq36qme8ATCKKCChU17jFgX+Z+jBQGppQ/A9TGefbck2KLCIpo9ljyEBb65ZmD+4VPaTztyTcWe0V86TftjESS+ZaOlwQLyn6d18NpZTwliW7eplXdhFIOGZcRzeeILalRYFmTzfX8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588254152; 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=KcFDP/ksCSb7a8hsuYkhAgmErquzGZ1XAxrWAYD/CyQ=; b=Gs3Q+uCX6A22QOj50qyt3BSDkWY3O8jS88gQK7bcQ0YgXz6T2ZDgl3YLIf3Rp66NersY0Ifb9LfnUaJy0l9nRWWPXKmLzi8mUhVTndvJgbMIfR2e+0JxeI6a6bnqM2BUViS24cYUY6onGYBNDgcORKHypDxIFqOxFVoAS1hWojI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1588254152988564.8283079501286; Thu, 30 Apr 2020 06:42:32 -0700 (PDT) Received: from localhost ([::1]:50090 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jU9SR-0007Mx-MB for importer@patchew.org; Thu, 30 Apr 2020 09:42:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47714) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jU9KR-0007yH-JU for qemu-devel@nongnu.org; Thu, 30 Apr 2020 09:37:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jU9Gh-00047T-Ig for qemu-devel@nongnu.org; Thu, 30 Apr 2020 09:34:15 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:40788 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jU9Gh-00042K-3e for qemu-devel@nongnu.org; Thu, 30 Apr 2020 09:30:23 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-309-ct3wnUH5Mna9H5tqC7S0Ug-1; Thu, 30 Apr 2020 09:30:20 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5DF14107ACCA; Thu, 30 Apr 2020 13:30:19 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-60.ams2.redhat.com [10.36.114.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 617E16A942; Thu, 30 Apr 2020 13:30:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588253422; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KcFDP/ksCSb7a8hsuYkhAgmErquzGZ1XAxrWAYD/CyQ=; b=bQIxYmyip9XJRPd6oPAzj8C4PMAXf88nbxgTkxZpoWWO42eiUhzXiqX19e2avjIKZWmRiG fRSNyA2h/TBW2FZvRlGxP7iB92Gl7UPqzYBKzBHbRMvZkhP/MhdWolDdvmLwLqXlo24Ulm B29PKUhSL2IVQ59EjkgoMQ0kVeKoqhU= X-MC-Unique: ct3wnUH5Mna9H5tqC7S0Ug-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PATCH 2/6] vmdk: Fix zero cluster allocation Date: Thu, 30 Apr 2020 15:30:03 +0200 Message-Id: <20200430133007.170335-3-kwolf@redhat.com> In-Reply-To: <20200430133007.170335-1-kwolf@redhat.com> References: <20200430133007.170335-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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=207.211.31.81; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/30 01:31:09 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 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, qemu-devel@nongnu.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" m_data must be contain valid data even for zero clusters when no cluster was allocated in the image file. Without this, zero writes segfault with images that have zeroed_grain=3Don. For zero writes, we don't want to allocate a cluster in the image file even in compressed files. Fixes: 524089bce43fd1cd3daaca979872451efa2cf7c6 Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- block/vmdk.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/block/vmdk.c b/block/vmdk.c index 5b09275578..bdd7d2dcf1 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -1572,6 +1572,12 @@ static int get_cluster_offset(BlockDriverState *bs, extent->l2_cache_counts[min_index] =3D 1; found: l2_index =3D ((offset >> 9) / extent->cluster_sectors) % extent->l2_si= ze; + if (m_data) { + m_data->l1_index =3D l1_index; + m_data->l2_index =3D l2_index; + m_data->l2_offset =3D l2_offset; + m_data->l2_cache_entry =3D ((uint32_t *)l2_table) + l2_index; + } =20 if (extent->sesparse) { cluster_sector =3D le64_to_cpu(((uint64_t *)l2_table)[l2_index]); @@ -1631,10 +1637,6 @@ static int get_cluster_offset(BlockDriverState *bs, } if (m_data) { m_data->new_allocation =3D true; - m_data->l1_index =3D l1_index; - m_data->l2_index =3D l2_index; - m_data->l2_offset =3D l2_offset; - m_data->l2_cache_entry =3D ((uint32_t *)l2_table) + l2_index; } } *cluster_offset =3D cluster_sector << BDRV_SECTOR_BITS; @@ -1990,7 +1992,7 @@ static int vmdk_pwritev(BlockDriverState *bs, uint64_= t offset, error_report("Could not write to allocated cluster" " for streamOptimized"); return -EIO; - } else { + } else if (!zeroed) { /* allocate */ ret =3D get_cluster_offset(bs, extent, &m_data, offset, true, &cluster_offset, 0, 0); --=20 2.25.3 From nobody Sun May 19 19:40:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1588254076; cv=none; d=zohomail.com; s=zohoarc; b=c7Qc8XCMy9qhivdIAb1nf8ZhDrOm2A3TtrGnbp+yMr7sW+juPp2Z0I7WDxRGD6mnisPCaFmSURc80epz2yhWiROMmObod01UqCJmeE6zI1Q6dODcQJIwh/BXOgWm9bDxup7p4lqeCKVyETq3sHfIbm/2aFDBtH4qXbDDWFTrep4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588254076; 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=vue8Ts5/jzDw8/CNpBo4HRBirBxWPkwn09a8hhQq3q8=; b=Q8lPzBbzUYJz96uQYYtvIfxWFAe2uiTJAb9l46lJUpSCVD0n+CjAQiC3cQvoV3ApXD98fW52Z/4FltNgdL750DB344HXt1aew4luTXwg+RehduKTSzAzZmLY295IxWhfVpPwX+zfqx3F4V6ZffRyf+o6OK0s0O/dmBUU5GTziH0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1588254076345725.6860402413567; Thu, 30 Apr 2020 06:41:16 -0700 (PDT) Received: from localhost ([::1]:45798 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jU9RD-0005Xc-12 for importer@patchew.org; Thu, 30 Apr 2020 09:41:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47734) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jU9KT-000800-OY for qemu-devel@nongnu.org; Thu, 30 Apr 2020 09:37:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jU9Gi-0004Cm-Ne for qemu-devel@nongnu.org; Thu, 30 Apr 2020 09:34:17 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:43247 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jU9Gi-00047w-4V for qemu-devel@nongnu.org; Thu, 30 Apr 2020 09:30:24 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-409-d3aqS4zIPhmTGXrPaF1nFQ-1; Thu, 30 Apr 2020 09:30:21 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A4957468; Thu, 30 Apr 2020 13:30:20 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-60.ams2.redhat.com [10.36.114.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id A5B2066071; Thu, 30 Apr 2020 13:30:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588253423; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vue8Ts5/jzDw8/CNpBo4HRBirBxWPkwn09a8hhQq3q8=; b=aioEDcSWPPvtOHmGDtiBaZNOvyuPPjmbw+jglgIQj8ST3Lh5OSe6awt4MXSDr56SjsQ4sj MAd5OZbjVOy9WLHA+rpeogPuNoTm4uSt2a/GuLS1EpHqb5+Y4lV3y1Z6LhUbBe3/+VcmD/ SrV8+Q8nA27A5ZNRgJBNj1zv7DVhbcI= X-MC-Unique: d3aqS4zIPhmTGXrPaF1nFQ-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PATCH 3/6] vmdk: Fix partial overwrite of zero cluster Date: Thu, 30 Apr 2020 15:30:04 +0200 Message-Id: <20200430133007.170335-4-kwolf@redhat.com> In-Reply-To: <20200430133007.170335-1-kwolf@redhat.com> References: <20200430133007.170335-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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=207.211.31.81; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/30 01:31:09 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 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, qemu-devel@nongnu.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" When overwriting a zero cluster, we must not perform copy-on-write from the backing file, but from a zeroed buffer. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- block/vmdk.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/block/vmdk.c b/block/vmdk.c index bdd7d2dcf1..da25b8992e 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -1340,7 +1340,9 @@ static void vmdk_refresh_limits(BlockDriverState *bs,= Error **errp) * get_whole_cluster * * Copy backing file's cluster that covers @sector_num, otherwise write ze= ro, - * to the cluster at @cluster_sector_num. + * to the cluster at @cluster_sector_num. If @zeroed is true, we're overwr= iting + * a zeroed cluster in the current layer and must not copy data from the + * backing file. * * If @skip_start_sector < @skip_end_sector, the relative range * [@skip_start_sector, @skip_end_sector) is not copied or written, and le= ave @@ -1351,18 +1353,21 @@ static int get_whole_cluster(BlockDriverState *bs, uint64_t cluster_offset, uint64_t offset, uint64_t skip_start_bytes, - uint64_t skip_end_bytes) + uint64_t skip_end_bytes, + bool zeroed) { int ret =3D VMDK_OK; int64_t cluster_bytes; uint8_t *whole_grain; + bool copy_from_backing; =20 /* For COW, align request sector_num to cluster start */ cluster_bytes =3D extent->cluster_sectors << BDRV_SECTOR_BITS; offset =3D QEMU_ALIGN_DOWN(offset, cluster_bytes); whole_grain =3D qemu_blockalign(bs, cluster_bytes); + copy_from_backing =3D bs->backing && !zeroed; =20 - if (!bs->backing) { + if (!copy_from_backing) { memset(whole_grain, 0, skip_start_bytes); memset(whole_grain + skip_end_bytes, 0, cluster_bytes - skip_end_b= ytes); } @@ -1377,7 +1382,7 @@ static int get_whole_cluster(BlockDriverState *bs, =20 /* Read backing data before skip range */ if (skip_start_bytes > 0) { - if (bs->backing) { + if (copy_from_backing) { /* qcow2 emits this on bs->file instead of bs->backing */ BLKDBG_EVENT(extent->file, BLKDBG_COW_READ); ret =3D bdrv_pread(bs->backing, offset, whole_grain, @@ -1397,7 +1402,7 @@ static int get_whole_cluster(BlockDriverState *bs, } /* Read backing data after skip range */ if (skip_end_bytes < cluster_bytes) { - if (bs->backing) { + if (copy_from_backing) { /* qcow2 emits this on bs->file instead of bs->backing */ BLKDBG_EVENT(extent->file, BLKDBG_COW_READ); ret =3D bdrv_pread(bs->backing, offset + skip_end_bytes, @@ -1631,7 +1636,8 @@ static int get_cluster_offset(BlockDriverState *bs, * or inappropriate VM shutdown. */ ret =3D get_whole_cluster(bs, extent, cluster_sector * BDRV_SECTOR= _SIZE, - offset, skip_start_bytes, skip_end_bytes); + offset, skip_start_bytes, skip_end_bytes, + zeroed); if (ret) { return ret; } --=20 2.25.3 From nobody Sun May 19 19:40:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1588254271; cv=none; d=zohomail.com; s=zohoarc; b=Hi4lSfr6lX3WoGw45OFe58PIkQUeJxZIMud5/k/2EzoEwzK4wd7xOw/hmnHOkvAvgykg22/y7zXAGAbw+1uQwJCca6Xf+feDa7wCsmtS7Z+Zf1oZmKiFmRdVF9s0kazT849YCUu1ZIq8iytiX2vQvrjyoME5j7fxj40dwNzBsx4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588254271; 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=105jJP1cIj/nupnh+Lwv/ZMPM89A53pmjGhd/E8GrUU=; b=Q+zRtphcgoMFSgN6GIX3SV21VUtt3mghFqYvAVJfGOjhNXXrPcsZlCZQdGmwz8qRSTlQFVUb/rWUGFxNZbVRcctiylJ/V74Gi/NnrG+Hswkm+c1tZcVKqUPmpkmq9B3/BuXvyKkty+Nv5upUMpYMM52GTynaYVEbmkA7GrYbRNw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1588254271863208.7964771918912; Thu, 30 Apr 2020 06:44:31 -0700 (PDT) Received: from localhost ([::1]:58284 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jU9UM-0002jw-DX for importer@patchew.org; Thu, 30 Apr 2020 09:44:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47744) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jU9KU-00080e-Fu for qemu-devel@nongnu.org; Thu, 30 Apr 2020 09:37:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jU9Gk-0004Gy-1Q for qemu-devel@nongnu.org; Thu, 30 Apr 2020 09:34:18 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:52197 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jU9Gj-0004DD-Ib for qemu-devel@nongnu.org; Thu, 30 Apr 2020 09:30:25 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-110-DdLmUWWDPMiDPTYddC3ZMA-1; Thu, 30 Apr 2020 09:30:22 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EC49E1895A34; Thu, 30 Apr 2020 13:30:21 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-60.ams2.redhat.com [10.36.114.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id EBD9566071; Thu, 30 Apr 2020 13:30:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588253424; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=105jJP1cIj/nupnh+Lwv/ZMPM89A53pmjGhd/E8GrUU=; b=XF03xqKv6Ay59s17J9xP5GW/KvQ2kTVRsqfWKSoObFhgUB6yGuM9dGrA46MLLx9B4m27Mz Np/Q7PbWnAvHd+3Bw1b0HUK8I5gXqX+3B80Wy1GMhXHf5DeyKTAYFzfYpPlBNiP5O67khs jIHWARK0AVkpf4SjZMzP5+XhaA5qVY8= X-MC-Unique: DdLmUWWDPMiDPTYddC3ZMA-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PATCH 4/6] vmdk: Don't update L2 table for zero write on zero cluster Date: Thu, 30 Apr 2020 15:30:05 +0200 Message-Id: <20200430133007.170335-5-kwolf@redhat.com> In-Reply-To: <20200430133007.170335-1-kwolf@redhat.com> References: <20200430133007.170335-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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=205.139.110.61; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/30 01:04:40 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.61 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, qemu-devel@nongnu.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" If a cluster is already zeroed, we don't have to call vmdk_L2update(), which is rather slow because it flushes the image file. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- block/vmdk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/vmdk.c b/block/vmdk.c index da25b8992e..dcd30f1419 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -2013,7 +2013,7 @@ static int vmdk_pwritev(BlockDriverState *bs, uint64_= t offset, offset_in_cluster =3D=3D 0 && n_bytes >=3D extent->cluster_sectors * BDRV_SECTOR_SIZ= E) { n_bytes =3D extent->cluster_sectors * BDRV_SECTOR_SIZE; - if (!zero_dry_run) { + if (!zero_dry_run && ret !=3D VMDK_ZEROED) { /* update L2 tables */ if (vmdk_L2update(extent, &m_data, VMDK_GTE_ZEROED) !=3D VMDK_OK) { --=20 2.25.3 From nobody Sun May 19 19:40:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1588254229; cv=none; d=zohomail.com; s=zohoarc; b=U9IwPLGGOpJJiZJsZvGGQLkCFFm2yKsKg64OWXexHwkrSTVuOzYfCUrbDRf3M1I5/s6SGduf8Crl+9FUSo7jgHB07Y7vL+tdUxvHXQPyzO1nSx9rj0JS103/McEC4U5sUZqSktPhI1yToPFQIoKxqyLYOMIWOIFOjIVpnJfphPM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588254229; 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=ZBXu548uWHsUziQiPVqN0GngVfBoamsskJ3rPepcQIg=; b=XoF0+szTR8JkNpgcv6ovg9EdK7tCi2bmfSNxFUaaUMrEsRu1vOXxyVLmNeeXvTyVSDL3HCGL0xeDl1ScEfDs7/RAQYomQ5IJQ5qsDTL+bvjchS0t1M6wUqgWJBehCVKrCzmckQO9eLBBSnd6uOCcLOka+TODhv3rguT+zLnswcs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1588254229255646.2925516881803; Thu, 30 Apr 2020 06:43:49 -0700 (PDT) Received: from localhost ([::1]:55254 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jU9Tf-000132-PW for importer@patchew.org; Thu, 30 Apr 2020 09:43:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47756) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jU9KV-00081L-CA for qemu-devel@nongnu.org; Thu, 30 Apr 2020 09:37:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jU9Gn-0004Kp-M0 for qemu-devel@nongnu.org; Thu, 30 Apr 2020 09:34:19 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:39057 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jU9Gn-0004KX-8c for qemu-devel@nongnu.org; Thu, 30 Apr 2020 09:30:29 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-48-NlrRkFq3OXWmssgIncxUtg-1; Thu, 30 Apr 2020 09:30:26 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5FBF6804042; Thu, 30 Apr 2020 13:30:25 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-60.ams2.redhat.com [10.36.114.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3F90E5798D; Thu, 30 Apr 2020 13:30:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588253428; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZBXu548uWHsUziQiPVqN0GngVfBoamsskJ3rPepcQIg=; b=OilS1EBnrkZciYcAcmNi94mCQvl9lsLbjeHXfJnby5DlrWc0/oMnnvor3d0WNfVw1GYAXU fwfHI19lb0UMIj1bXqkNL0RzQv8XdVA2695NW+QgpT4OKc1kOorTkejOH6oA44AyaBNrab 5XoC3/L4PIp8gmmBjuH9j+ay6ghaM3I= X-MC-Unique: NlrRkFq3OXWmssgIncxUtg-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PATCH 5/6] vmdk: Flush only once in vmdk_L2update() Date: Thu, 30 Apr 2020 15:30:06 +0200 Message-Id: <20200430133007.170335-6-kwolf@redhat.com> In-Reply-To: <20200430133007.170335-1-kwolf@redhat.com> References: <20200430133007.170335-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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=205.139.110.61; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/30 01:04:40 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.61 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, qemu-devel@nongnu.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" If we have a backup L2 table, we currently flush once after writing to the active L2 table and again after writing to the backup table. A single flush is enough and makes things a little less slow. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- block/vmdk.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/block/vmdk.c b/block/vmdk.c index dcd30f1419..d3eb9a5cdc 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -1435,7 +1435,7 @@ static int vmdk_L2update(VmdkExtent *extent, VmdkMeta= Data *m_data, offset =3D cpu_to_le32(offset); /* update L2 table */ BLKDBG_EVENT(extent->file, BLKDBG_L2_UPDATE); - if (bdrv_pwrite_sync(extent->file, + if (bdrv_pwrite(extent->file, ((int64_t)m_data->l2_offset * 512) + (m_data->l2_index * sizeof(offset)), &offset, sizeof(offset)) < 0) { @@ -1444,13 +1444,16 @@ static int vmdk_L2update(VmdkExtent *extent, VmdkMe= taData *m_data, /* update backup L2 table */ if (extent->l1_backup_table_offset !=3D 0) { m_data->l2_offset =3D extent->l1_backup_table[m_data->l1_index]; - if (bdrv_pwrite_sync(extent->file, + if (bdrv_pwrite(extent->file, ((int64_t)m_data->l2_offset * 512) + (m_data->l2_index * sizeof(offset)), &offset, sizeof(offset)) < 0) { return VMDK_ERROR; } } + if (bdrv_flush(extent->file->bs) < 0) { + return VMDK_ERROR; + } if (m_data->l2_cache_entry) { *m_data->l2_cache_entry =3D offset; } --=20 2.25.3 From nobody Sun May 19 19:40:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1588254012; cv=none; d=zohomail.com; s=zohoarc; b=Ae3uPhjkdTCdxuiHFbY8ka30VeGuL+EYVCq5KPeKJdCNxiFhoouc57jJ72NyLj76YiP4qH5O+TDcUUQvT2D5pmY5NCt+CNWSpEUJg1vX7+L7nTkvA18TMxo2GjW7+2Lmxtc0T2FY/FjfgqKqMpeaP+KabFsdh5dpAgr1cN3gwaU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588254012; 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=jmgbOeWb0JQktfZP4eZYR5FLeHsoA4kgG2QxIgGT6tg=; b=hgkG6WsDOV42KOnep1LPKQQ6/LPVI19toPtGW79KivTVnXKN9YaG0kJiN8fB8OJDgeni0S/nXRDeRft5EYLqIJs5se+ThNL+cMKtPZG8iir4PniVc0hJbnDaEMYQUAfcaeHwfHZjN4P7eEWiueMWoRreMYq0Z2JhGJXEaHIrtRs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1588254012979680.7154030497296; Thu, 30 Apr 2020 06:40:12 -0700 (PDT) Received: from localhost ([::1]:41152 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jU9QB-0003Oi-LN for importer@patchew.org; Thu, 30 Apr 2020 09:40:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47760) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jU9KV-00081h-RS for qemu-devel@nongnu.org; Thu, 30 Apr 2020 09:37:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jU9Go-0004NO-L9 for qemu-devel@nongnu.org; Thu, 30 Apr 2020 09:34:19 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:37857 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jU9Go-0004Kv-7U for qemu-devel@nongnu.org; Thu, 30 Apr 2020 09:30:30 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-463-5L8nY77QPjGVgaALxjyGiA-1; Thu, 30 Apr 2020 09:30:27 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C4EAF8730ED; Thu, 30 Apr 2020 13:30:26 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-60.ams2.redhat.com [10.36.114.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id A992967656; Thu, 30 Apr 2020 13:30:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588253429; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jmgbOeWb0JQktfZP4eZYR5FLeHsoA4kgG2QxIgGT6tg=; b=FBhR01/SQWyXii3pmuGWMZYSdsB07TBBO2NxlWAZwh0Bw8ppybc5CoFJ8/q4qQD4eSU5Jn tl1hIzyZ2spLYj/Wvt6h1VQlI2iVbvAlZz277j/DdiZVCTBg1u+4CVa/GugpIwE0aUARJP OMOylwNyWImINRvudKitdJPl+jIM3q8= X-MC-Unique: 5L8nY77QPjGVgaALxjyGiA-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PATCH 6/6] iotests: vmdk: Enable zeroed_grained=on by default Date: Thu, 30 Apr 2020 15:30:07 +0200 Message-Id: <20200430133007.170335-7-kwolf@redhat.com> In-Reply-To: <20200430133007.170335-1-kwolf@redhat.com> References: <20200430133007.170335-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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=207.211.31.120; envelope-from=kwolf@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/29 23:34:52 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 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, qemu-devel@nongnu.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" In order to avoid bitrot in the zero cluster code in VMDK, enable zero_grained=3Don by default for the tests. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- tests/qemu-iotests/059 | 6 +++--- tests/qemu-iotests/check | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/qemu-iotests/059 b/tests/qemu-iotests/059 index 5438025285..4c90fc0363 100755 --- a/tests/qemu-iotests/059 +++ b/tests/qemu-iotests/059 @@ -41,9 +41,9 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt vmdk _supported_proto file _supported_os Linux -_unsupported_imgopts "subformat=3DmonolithicFlat" \ - "subformat=3DtwoGbMaxExtentFlat" \ - "subformat=3DtwoGbMaxExtentSparse" + +# We test all kinds of VMDK options here, so ignore user-specified options +IMGOPTS=3D"" =20 capacity_offset=3D16 granularity_offset=3D20 diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check index f7a2d3d6c3..9c461cf76d 100755 --- a/tests/qemu-iotests/check +++ b/tests/qemu-iotests/check @@ -546,6 +546,9 @@ fi if [ "$IMGFMT" =3D=3D "luks" ] && ! (echo "$IMGOPTS" | grep "iter-time=3D"= > /dev/null); then IMGOPTS=3D$(_optstr_add "$IMGOPTS" "iter-time=3D10") fi +if [ "$IMGFMT" =3D=3D "vmdk" ] && ! (echo "$IMGOPTS" | grep "zeroed_grain= =3D" > /dev/null); then + IMGOPTS=3D$(_optstr_add "$IMGOPTS" "zeroed_grain=3Don") +fi =20 if [ -z "$SAMPLE_IMG_DIR" ]; then SAMPLE_IMG_DIR=3D"$source_iotests/sample_images" --=20 2.25.3