From patchwork Wed Nov 1 15:44:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 10036683 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2FEC6602B5 for ; Wed, 1 Nov 2017 15:54:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 274F6285CE for ; Wed, 1 Nov 2017 15:54:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1BDF52865F; Wed, 1 Nov 2017 15:54:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3815E285CE for ; Wed, 1 Nov 2017 15:54:44 +0000 (UTC) Received: from localhost ([::1]:56416 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e9vLn-0007JI-Ak for patchwork-qemu-devel@patchwork.kernel.org; Wed, 01 Nov 2017 11:54:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60745) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e9vCJ-0008GQ-LM for qemu-devel@nongnu.org; Wed, 01 Nov 2017 11:44:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e9vCH-0006nG-By for qemu-devel@nongnu.org; Wed, 01 Nov 2017 11:44:55 -0400 Received: from mail-eopbgr40111.outbound.protection.outlook.com ([40.107.4.111]:51842 helo=EUR03-DB5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e9vCH-0006lD-0m; Wed, 01 Nov 2017 11:44:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=7a0kBTWtThxTESewl6rLJrZMe88vE81ncrT42xqaAsk=; b=LK6EGKAHTg8+lOUgzoo1Q6lv0vHB6fVpW2/a0aBG+YcBC97iknVRBDHUDHCLdO7o8zHRoabDoGa5CzL3AN2nZZGzbt5CE7J8Bvn33vMeF47iVYIg8zWGCBxxIF1gsoEUHFLap5oQKxXsIi+CvTJ/6O8bI8+webGzsZBD4yj4HvA= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; Received: from xantnef-ws.sw.ru (195.214.232.6) by AM5PR0801MB1987.eurprd08.prod.outlook.com (2603:10a6:203:4b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.178.6; Wed, 1 Nov 2017 15:44:50 +0000 From: Anton Nefedov To: qemu-devel@nongnu.org Date: Wed, 1 Nov 2017 18:44:07 +0300 Message-Id: <1509551048-129830-15-git-send-email-anton.nefedov@virtuozzo.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1509551048-129830-1-git-send-email-anton.nefedov@virtuozzo.com> References: <1509551048-129830-1-git-send-email-anton.nefedov@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: VI1PR0501CA0017.eurprd05.prod.outlook.com (2603:10a6:800:92::27) To AM5PR0801MB1987.eurprd08.prod.outlook.com (2603:10a6:203:4b::14) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a40fe453-69b2-4875-6daf-08d5213f7d8d X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4602075)(2017052603199); SRVR:AM5PR0801MB1987; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0801MB1987; 3:iaZNUEs0EpW8Pg1i3px6155ehNUippG6CmkNO6iUElw3/ZJPJjDaSCaamACLwBivNBdAMPm+e1JjjTNMYL5x99dtbND29crDKKx5ayMU8CnCqr66IPY/vLysAzbY09R6pEiCyluhDi12pJz2Smmb0rtiq7rc48SKPvBIDd6AjznOZV23lR7kkFwQG9gAzcU0ClqTTK+pad+wsl+LXRb5bYgJRmbjts6nvJ56IjX5BMAWdApZ1dmCCF0q7bujVqiy; 25:canTv06Q9SrFQiw+NR0dLwAcjEZy1lNASWZP3IW9LKz7o3W7XEk65rCEut9Hc3SL6Z7ALSEsbiH1YUeK5Y9UVi7jJS++6wKjnkBMxg+0XbfzwG8NOp8RRdUirknLlq7E43JSIgNeYqc76y1wIY50UalDkJaDwKaZZJ6eWFY+KnlMhIGGM74RnbRGESUj7P7rAGeZ1Mvimn2ifpUDZhd4YI8+x12jPBLKIbG3fUdHQUhWrPJ2TRxjTymfYsvvIVPXK0Jt5+i7hAVPNrQl9S6B2rxDQdA+Z6irryBXJsW+rx3+diDqZyxl3vewCXD/2Y3MvoZGzuT+c7USLOfAFT4sJw==; 31:+9WDbaMwR2ugSSWk3aEZQLnRt9kFXlCs95Xwiqsqc8WxrbnxwE3gSDYaMxFVGc5HP07N7tWbztm6Ybf7bocNaQiF3nadpKua3uLEiSsxLy/XAgFEmw6iVqmnd+9KNFARGWyZpmUVWpGGpkS5MPBqsXIsetqkwwbcYePd5//BvwXmpIsu7zrDGY/lsrxWZ5kUUIgxNaX9BsUqQHL1x36YKNQBrRfjq6qUUP6F5HThvIk= X-MS-TrafficTypeDiagnostic: AM5PR0801MB1987: X-Microsoft-Exchange-Diagnostics: 1; AM5PR0801MB1987; 20:bHhnFNvc3VWMnvofPNHtw4AWNMOW6B7rAJtjpj7FHfTvvUnMHjEyTGdR1RDdjHCIF+VjK0ozusrqguCSz/7ZIp7FFNP6pzbsdqjD9eLJjT3abWiOzx1i3TtZ8r0M2Yf8MIVVRgYriCedkNosjQbl/XgS+zYk0QrnxUHTAJkF2yxVnv3OmsIXb0TQgtfl3OYvE1xC9FsNx4UBhQb1FWSDLTANWm9Z/7TC7Vsp4qMZoB2vA+Ozmwf8uPZW57++3tYf+v4zNarX1RUefipyzPp41jRloJQDIGBsMDW11cMwK9jDYfpWdqDxe5k23pfQDm6+8wM5X0xIwuqC73vRf194PpJU36/k/pLRR1jefC2QBm/J/a1XK3hrSWfi6PsgvtoXziWnTSBRbSYmThvVx/Wj3kET23UtNYSmperr4rbenIc=; 4:GSo7oN6KSM9SeB/jS6HM2Ge/ccQ9hsXiKbGJntxeKNiL9O9o1EsaV2u89b/LRHFHy0DQ7TtKppmqXE23lEe+B+WCJ/pispnCW3WOnuMHzIIJjtiq0s/DZxu5X81E8OOvvYCEMsqpCT/VS1zVbEWyfnyPno8G5cN+AWjlHzKtoFQykLVqWQv2znqroMfZsCZPSOE/pVdbEQX8/bWzmZVP0L9Nlk/bIJKAiNEhQ7eYviRVIO4RGQu/OeqL1UVyYVWVreiPAc98AL1BJSI74j4ru6puAUIn2TDXP5Sc9GR3PZZJNiKqHjbvqrkSmbdwx4Xo5lxyfOl15vsMxK0LUVbs9wKwKA7pZoV82V97RbE1Z78= X-Exchange-Antispam-Report-Test: UriScan:(250305191791016)(22074186197030); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93001095)(3231020)(100000703101)(100105400095)(3002001)(6041248)(20161123555025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123564025)(20161123558100)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:AM5PR0801MB1987; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:AM5PR0801MB1987; X-Forefront-PRVS: 0478C23FE0 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(376002)(346002)(189002)(199003)(6666003)(16526018)(53936002)(107886003)(48376002)(86362001)(6916009)(2950100002)(3846002)(6116002)(101416001)(50986999)(76176999)(106356001)(69596002)(5660300001)(25786009)(105586002)(316002)(53416004)(2351001)(16586007)(2361001)(33646002)(4326008)(5003940100001)(478600001)(66066001)(36756003)(50226002)(6306002)(6512007)(47776003)(2906002)(8936002)(6506006)(97736004)(6486002)(68736007)(305945005)(50466002)(81166006)(81156014)(8676002)(189998001)(7736002)(21314002)(2004002); DIR:OUT; SFP:1102; SCL:1; SRVR:AM5PR0801MB1987; H:xantnef-ws.sw.ru; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM5PR0801MB1987; 23:qQaE3v2a5QhaCKkGO5H3LFw9+NlkrsX9l6P0s+C?= =?us-ascii?Q?mwC3zh4LOIP7HP0/F8K2nGnxT3u6YWoWaGqS7bwDQTET1vnUR3LrplQPnQCX?= =?us-ascii?Q?S2gMGxYkZ2zPkjv0jyc4I7uXGWgxLOtF+L1ZS3bPrlQ9HaCXYU+7BokL8IHR?= =?us-ascii?Q?OyqLgdaDhz1hEHNlrRE2XGtxkSZlCpyIZYgCC95lugPaJTsuAM8pVm30AxiE?= =?us-ascii?Q?Sc/W7/lY3AD/txTmcUdYz9IZ9rwPAVwcTcehmMt7280FVt6jQILGI3V4p/WV?= =?us-ascii?Q?3jrG15HwGz/qKMLem0FGo2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2NGRO?= =?us-ascii?Q?xeAnZf0wZgEMkOSyZ9begEc2vRf67iICGDdw6FR+91M8lhtBIUXg2Hh1KQw?= =?us-ascii?Q?=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; AM5PR0801MB1987; 6:EH6WUDB2+T2ho/a2ySri9wyv/SfVO11itOjWSyQnYx7vvvGFrAUn8eGZGFNV7+A5y9KVdahUgOaYsllAZyPoz33Mp7lr/6J+9XfpbajK/B+MEQ2NfTqIm+WILw8YC7zAstTdImj6WPDcqODVL4kG9dHTM5fFq7OSUJthceKxtTWSDLmbY3HKSr3e4f0KPT6YAlKljX8vIQ0rCBm6WSEUmMBYF7sHBMOQF/kaYdwZR3sw0CtDJ3DTogQs4pV1rkxAv832utT0wiQ8z92JhpAjgacJwUmqs5ZTY5zqdx88ZHfvopAPzhGAza+KB/6casho4La82w3vc277P3hOokY7yvS1JzGd2rdEE6wQoedpEF4=; 5:UPYizz427TxxAXXV6DqUd3To/cOWpuKe68NFtmP24HPCBjeMnxta4ugh19eKychesU4P4iCkXh991Ul+NX43pbCXK2Eo2XHQjlorV/myiqwnhbHH0zzdPTSeTVkjhu9RQ3HgC4XnPzVb1ykw+Yo5DzbGFi+685rdWkC6MxmnWrg=; 24:wKdFVYhO2QBUuj8iKaxcZeN/lKuYnU2GbLwUJdtH2ejqWZwFyzQABggJSwTturNUiuTRo1YXh9VHjlWaTW5yDqwKYPex1EaglYVFB4uI8wM=; 7:MohqfEA36vEfg0DV/djnHmxkR+UcQH/L/nR+5ScKq7TH9kzanCVaDjVMIXG37XGEfwoQesC0Itx/Tfk6jlERH3S/nS9eKn1lHqkvIXQFWyfuyWzy07qNCeXlWkzrj3CSLWxFoGkjur9Spsbxfuwj8f76D3w7PAg1JzWUkNncKGR0+4TvV5nFgMAH3KGjcGas+eA0A31nVYOYuxXk7RXL+h2y/bRmA7gvrqfRGmQKLPe9Qn9RkJxqRqE51mQVy7lw SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM5PR0801MB1987; 20:Yc1+yvdqZMtZEGMXecFHtWqOQUa08EScMy6jVI5VI3j39Jdo1wBS+PjuvtDdYoTwCjE2GYyxu+kXw5uH3Hoy7Krmgj9N+CdErQyxgZlhasvntfUOrTVKxxEWEyHK0KYe8eaBINAKnflos/o+iWHW+p5jF3J513gB8EYePA4uWww= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Nov 2017 15:44:50.7588 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a40fe453-69b2-4875-6daf-08d5213f7d8d X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0801MB1987 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.4.111 Subject: [Qemu-devel] [PATCH v5 14/15] iotest 198: test BDRV_REQ_ALLOCATE 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, Anton Nefedov , berto@igalia.com, den@virtuozzo.com, qemu-block@nongnu.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Anton Nefedov --- tests/qemu-iotests/198 | 146 +++++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/198.out | 50 ++++++++++++++++ tests/qemu-iotests/group | 1 + 3 files changed, 197 insertions(+) create mode 100755 tests/qemu-iotests/198 create mode 100644 tests/qemu-iotests/198.out diff --git a/tests/qemu-iotests/198 b/tests/qemu-iotests/198 new file mode 100755 index 0000000..ad7162a --- /dev/null +++ b/tests/qemu-iotests/198 @@ -0,0 +1,146 @@ +#!/bin/env bash +# +# Test qcow2 BDRV_REQ_ALLOCATE requests +# +# Copyright (c) 2017 Parallels International GmbH +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +## + +seq=`basename $0` +echo "QA output created by $seq" + +status=1 # 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 + +_supported_fmt qcow2 +_supported_proto file +_supported_os Linux + +function do_io() +{ + $QEMU_IO "$@" | _filter_qemu_io |\ + sed -e 's/bytes at offset [0-9]*/bytes at offset XXX/g' +} + +CLUSTER_SIZE=64k +size=128M + +_make_test_img 1G + +echo +echo "== Test discarded cluster reuse ==" + +# allocate first two clusters +do_io -c "writev -P 1 0x8000 0x10000" "$TEST_IMG" +len=$(stat -c "%s" $TEST_IMG) + +# discard the 1st cluster on qcow2 level only +do_io -c "open -o pass-discard-request=off $TEST_IMG" -c "discard 0 0x10000" + +# new write will reuse the dirty host cluster and has to overwrite that +# with zeroes +do_io -c "writev -P 2 0x24000 0x8000" "$TEST_IMG" +if [ $len -ne $(stat -c "%s" $TEST_IMG) ] ; then + >&2 echo "Failed to reuse cluster" + exit 1 +fi + +echo +echo "== Test preallocation ==" + +function io_commands() +{ + echo "open -o prealloc-size=$((1024*1024)) blkdebug::$TEST_IMG" + + # Verify that intersections of a running preallocation and new requests + # is handled properly. + # + # 1. send a write #1 which triggers preallocation, suspend it in action + # 2. send a write #2 which intersects with the area being preallocated + # 3. using break/wait_break/resume, wait until write #2 is at least + # at WRITE_AIO tracepoint. + # Then it is supposed to enter pwrite(bs->child) and start waiting + # for #1 to finish + # 4. resume #1 + +cat <