From nobody Mon Feb 9 07:55:29 2026 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1555495967; cv=none; d=zoho.com; s=zohoarc; b=Nqletqx45Au54PuSTb8lrCVeUFuc1Zv9myTNBZmppIVl/9g8ExfyKIOmCaomsP6I9f6Zhg5DcbI9lyh1fEhupX7e+54zVKPGw2BpT5exVOBvC6vcmesEN7GIQTkgtcjkclhUPM9e/rbbQu/E6YOhfNBOhi2OGBDKRtjK55dEIv4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555495967; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=Ta91m8qC3Ajr1p7hx7GPE0HbMA7wA/KUP46nUkCgeDQ=; b=nf5DKROC7FckK14tahXPyPFzCxG1GdySLg/eLVoU1vdEQfHXBwkC2mgPZ69cIFNroRESC9KCGmUuKVMuCGmxiJ4fCf8kzcq9b5E7f8xBl9D1X9LjE1KDmTjVivernPkLJHH4fWQCKSV4aH8c6ZZ8SvSyLgRB9BWX9HJ8F8pelPQ= ARC-Authentication-Results: i=1; mx.zoho.com; spf=temperror (zoho.com: Error in retrieving data from DNS) 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 1555495967257833.9354166791109; Wed, 17 Apr 2019 03:12:47 -0700 (PDT) Received: from localhost ([127.0.0.1]:50053 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hGhYM-0004ul-Nh for importer@patchew.org; Wed, 17 Apr 2019 06:12:30 -0400 Received: from eggs.gnu.org ([209.51.188.92]:44216) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hGhVY-00038N-1Z for qemu-devel@nongnu.org; Wed, 17 Apr 2019 06:09:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hGhVW-0003u4-Pz for qemu-devel@nongnu.org; Wed, 17 Apr 2019 06:09:36 -0400 Received: from relay.sw.ru ([185.231.240.75]:47100) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hGhVW-0003sv-F4; Wed, 17 Apr 2019 06:09:34 -0400 Received: from [10.28.8.145] (helo=kvm.sw.ru) by relay.sw.ru with esmtp (Exim 4.91) (envelope-from ) id 1hGhVS-0005Kr-MR; Wed, 17 Apr 2019 13:09:30 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Wed, 17 Apr 2019 13:09:29 +0300 Message-Id: <20190417100929.39943-3-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20190417100929.39943-1-vsementsov@virtuozzo.com> References: <20190417100929.39943-1-vsementsov@virtuozzo.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 185.231.240.75 Subject: [Qemu-devel] [PATCH 2/2] iotests: test big qcow2 shrink X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, fam@euphon.net, vsementsov@virtuozzo.com, den@virtuozzo.com, mreitz@redhat.com, stefanha@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/249 | 69 ++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/249.out | 30 +++++++++++++++++ tests/qemu-iotests/group | 1 + 3 files changed, 100 insertions(+) create mode 100755 tests/qemu-iotests/249 create mode 100644 tests/qemu-iotests/249.out diff --git a/tests/qemu-iotests/249 b/tests/qemu-iotests/249 new file mode 100755 index 0000000000..f0140461ad --- /dev/null +++ b/tests/qemu-iotests/249 @@ -0,0 +1,69 @@ +#!/usr/bin/env bash +# +# Test big discard in qcow2 shrink +# +# Copyright (c) 2019 Virtuozzo International GmbH. All rights reserved. +# +# 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 . +# + +# creator +owner=3Dvsementsov@virtuozzo.com + +seq=3D`basename $0` +echo "QA output created by $seq" + +status=3D1 # failure is the default! + +_cleanup() +{ + _cleanup_test_img +} +trap "_cleanup; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter + +# Requires backing files and .bdrv_change_backing_file support +_supported_fmt qcow2 +_supported_proto file +_supported_os Linux + +# This test checks bug in qcow2_process_discards, fixed by previous commit. +# The problem was that bdrv_pdiscard was called with uint64_t bytes parame= ter +# which was cropped to int. +# To reproduce bug we need to overflow int by one sequential discard, so we +# need size > 2G, bigger cluster size (as with default 64k we may have max= imum +# of 512M sequential data, corresponding to one L1 entry, and we need to w= rite +# at offset 0 at last, to prevent bdrv_co_truncate(bs->file) in +# qcow2_co_truncate to stole the whole effect of failed discard. + +size=3D2300M +IMGOPTS=3D"cluster_size=3D1M" + +_make_test_img $size +$QEMU_IO -c 'write 100M 2000M' -c 'write 2100M 200M' \ + -c 'write 0 100M' "$TEST_IMG" | _filter_qemu_io + +$QEMU_IMG info "$TEST_IMG" | _filter_testdir + +$QEMU_IMG resize --shrink "$TEST_IMG" 50M + +$QEMU_IMG info "$TEST_IMG" | _filter_testdir + +# success, all done +echo "*** done" +rm -f $seq.full +status=3D0 diff --git a/tests/qemu-iotests/249.out b/tests/qemu-iotests/249.out new file mode 100644 index 0000000000..18bf7b2fb2 --- /dev/null +++ b/tests/qemu-iotests/249.out @@ -0,0 +1,30 @@ +QA output created by 249 +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2411724800 +wrote 2097152000/2097152000 bytes at offset 104857600 +1.953 GiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 209715200/209715200 bytes at offset 2202009600 +200 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 104857600/104857600 bytes at offset 0 +100 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +image: TEST_DIR/t.qcow2 +file format: qcow2 +virtual size: 2.2G (2411724800 bytes) +disk size: 2.3G +cluster_size: 1048576 +Format specific information: + compat: 1.1 + lazy refcounts: false + refcount bits: 16 + corrupt: false +Image resized. +image: TEST_DIR/t.qcow2 +file format: qcow2 +virtual size: 50M (52428800 bytes) +disk size: 54M +cluster_size: 1048576 +Format specific information: + compat: 1.1 + lazy refcounts: false + refcount bits: 16 + corrupt: false +*** done diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group index bae7718380..3a40dbfe69 100644 --- a/tests/qemu-iotests/group +++ b/tests/qemu-iotests/group @@ -248,3 +248,4 @@ 246 rw auto quick 247 rw auto quick 248 rw auto quick +249 rw auto --=20 2.18.0