From patchwork Wed Feb 14 16:09:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 10219379 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 714FB601C2 for ; Wed, 14 Feb 2018 16:18:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 61551287A1 for ; Wed, 14 Feb 2018 16:18:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 55B3328A40; Wed, 14 Feb 2018 16:18:44 +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 0A25D28A02 for ; Wed, 14 Feb 2018 16:18:43 +0000 (UTC) Received: from localhost ([::1]:35995 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1elzla-0003Zn-7o for patchwork-qemu-devel@patchwork.kernel.org; Wed, 14 Feb 2018 11:18:42 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44271) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1elzcu-0004A3-9K for qemu-devel@nongnu.org; Wed, 14 Feb 2018 11:09:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1elzcq-0008IM-NT for qemu-devel@nongnu.org; Wed, 14 Feb 2018 11:09:44 -0500 Received: from mail-eopbgr20114.outbound.protection.outlook.com ([40.107.2.114]:53808 helo=EUR02-VE1-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 1elzcq-0008FZ-Eo; Wed, 14 Feb 2018 11:09:40 -0500 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=3A6Vs5IsrVturZsm7FWdlB7aSe3Hd4KVHsiTZ1Pkx1E=; b=Y3q9MRGt6TyZqP87+xZcIuLxmIW6Cp2JNPBKiSE/sL63AL6Da+YTOx9nSHyOcq1FUhOwO1InnqifaWHMLh40Y3bZGdJ+tnZ/nWaGpHElbMWIkdUyoA5LLBU2y//h/+0/u3Hpc39oVqUbO/YxXj5GUd55m+tkps+rj26XmfrW3Qw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; Received: from xantnef-ws.sw.ru (195.214.232.6) by AM5PR0801MB1988.eurprd08.prod.outlook.com (2603:10a6:203:4b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.485.10; Wed, 14 Feb 2018 16:09:37 +0000 From: Anton Nefedov To: qemu-devel@nongnu.org Date: Wed, 14 Feb 2018 19:09:19 +0300 Message-Id: <1518624560-38060-2-git-send-email-anton.nefedov@virtuozzo.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518624560-38060-1-git-send-email-anton.nefedov@virtuozzo.com> References: <1518624560-38060-1-git-send-email-anton.nefedov@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: HE1PR0502CA0009.eurprd05.prod.outlook.com (2603:10a6:3:e3::19) To AM5PR0801MB1988.eurprd08.prod.outlook.com (2603:10a6:203:4b::15) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cb48a70a-3e46-44a6-9dc2-08d573c558bb X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603307)(7153060)(7193020); SRVR:AM5PR0801MB1988; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0801MB1988; 3:u6hceCyj6khgWZXUrk+94KRQcfJsvDIwaFrR3kF5zd1NXLik+ZH8g44Cny8HOAO7gVrusBHaPQMMntHZvPNhG4sp/9v5Sf+/3jutPugmy20tzkOp517W3ZeCDbOkMMaqHoPjXsO2lKDbpI4jZ4s/8fdzxBic4DFZJuCgzRS+cDMSUd+k3WAvdCDHci1V4xcVRAyiYo16Y0BeVfPX8/hzh/HkGQwABBFdNpz6YuBavB/tPk1wXJXuRj203f546+xA; 25:86cpwyKFszoU8AErzxM9cb9aYW/QAtgrcVDWCNBxm1pTVFA25AYj+86Zambw9aH1kgfvh8GTGQ++ZJUBavpDa+xKXFsOTEnP1xW+rLnBzfEKjgewyrYFUZWzxjMyK2TYSKyrbKmGnaNivfoBGumgwAQDtvMtSRQJOR3osJlPF7GKtwN92bbkyeXiU1F/MqQqLQIFax/gcA3VfVqo5sq+cGHOrs1KpzvMBxr6HX1BkL/PS7v7pPE89e+F3tM5ii7RTBsbCCFRqXrrzZN28p8Sp2vAJE9b2AQ87a10G0Ex3RexfcOvZgCKqt94yBbnfOspG4wuXeksbFWPRuwrb4fVIA==; 31:opn5dpoE7b2l8uUf9II9NSOkVOscvTPUTA78jhDfwEIk6hi7I0v9EEU26WSUtkuECEt5ECiV9R2D6QeJ6AzNlYVHzwSGoam/vJije23kwpbsmmUDaz4ZAO1mOMrU5fQnI510qzXHuu5xtJYB6puHU7mx4ywo1ESk+UK24tGFhfPWU/5KkA3KZr53wwZsBALS6QI7aFngfFL2OUMYLVlX2Ulz5b07/fyWGX/7aE6QO1k= X-MS-TrafficTypeDiagnostic: AM5PR0801MB1988: X-Microsoft-Exchange-Diagnostics: 1; AM5PR0801MB1988; 20:ePsuTDZ5jN717HH1qCYtzbbp2++aw/oRXW19xBcbFXO3paSFU0ybott3POdR8ceHCTLW8ewKVk4Errvpr4vl3gayF7SRE97dTSm1vIaBA8RVH7hHEUkZXVZGqZw3HaWcxH5Df6Hkso3A04hmEpXtdCJYVTNexCvnn+pMJ8pc818gFZchv0VxzgH1gDT+Ii4lgtoDbjHBOGfvKOGgq9Goo9rkHVuENLS36oJO6sB+trhF9P7Szsrb7UC/f+XsfgIX+/QuJa0lbOSdWkS3b/DkZJZrWJx04lLXfALuP2v+denqtoET8AzjFR+M8RfhsYIWWLiwd1sg51mtYSEl0BwQX9v25SayGWg4BXy5NujmCCAP0m7ZoLdAsNkwNzljBK/IqnotqJGFJmtVLVpBsuX0Yfg2lANGbqGjIXO6CvW8OH17FiJ+2ZMD43FcH0oNzQh5XC51+eNuGXbmkRIOEAAkR/RjWMxvblOHrdf7K2gKCdEq9x5FMuS6gnSi8p/22KNt; 4:YViJPPk4hoeZP9bAjkgjaXCNZA0nxnanpnYJu2dCura0Hee26gr/9m/+Y5OLZ4vaJHBnzj8yC9GJOKL/ORvcfprI4Pm5kiOIGLdaHgTMOsPnHBcl/Ltl/4mNgDryu+VGNCXwveLZWv5yPG3IRryb3RIzlJLRIfUaDvQaXtCvMVJLsBmVdIYgJHZpF1eKiakZLvfvEEycgXaGlCK+nCi298ImiugGmxyt1RNdwERPsyjT/ur4wldVEvPOYJ5rmCzi1nRkQV4UduxmMFDJYTnmvQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(8121501046)(5005006)(10201501046)(93006095)(93001095)(3002001)(3231101)(944501161)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(6072148)(201708071742011); SRVR:AM5PR0801MB1988; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0801MB1988; X-Forefront-PRVS: 0583A86C08 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(39380400002)(366004)(346002)(376002)(396003)(39850400004)(199004)(189003)(25786009)(47776003)(107886003)(3846002)(5660300001)(50466002)(16526019)(97736004)(52116002)(16586007)(6116002)(316002)(2906002)(36756003)(386003)(86362001)(6506007)(305945005)(186003)(68736007)(6666003)(6916009)(8676002)(7736002)(2950100002)(81156014)(81166006)(55236004)(105586002)(8936002)(106356001)(26005)(53416004)(50226002)(6486002)(4326008)(69596002)(2361001)(51416003)(66066001)(76176011)(53936002)(2351001)(478600001)(6512007)(48376002)(21314002); DIR:OUT; SFP:1102; SCL:1; SRVR:AM5PR0801MB1988; H:xantnef-ws.sw.ru; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX: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; AM5PR0801MB1988; 23:zI0kmLI+670aNlQ1tFuSaGvPg/vsodGGJVZYAg6?= =?us-ascii?Q?54hOXIBrMWt6Q7opjANbKUart6HNdc8C2zdFMzgQjKZceVTy0FKXZYgnLQGI?= =?us-ascii?Q?CRfFs/FdOEetdjbT+rnbW11/O/kfgwEC+CcvFv9GIzTxAkOmN+AhQsvHhFgV?= =?us-ascii?Q?a8iC5cIRKPF9pEf5c5ZJ1fp1mby3fcf+WemZ7dTnW+vAhVi6KLcD9S2MUVO4?= =?us-ascii?Q?3bH22HL5DSk/ZvcuQidHFAcgy4foPDYYpNcCfQCyXe5vCKmcLFXQ0QIM0kmB?= =?us-ascii?Q?V0vzZcPn0ZMGv69rge22Qem9j1XBujVRLcp78UKE4fw0byQTuYbg4tw4gbwB?= =?us-ascii?Q?Vv7GYG3vNQ/WEhPVQ84L+IHoAcYHj1WZq2mY8cFPAXkS+txysfkGwdU7/0td?= =?us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ft-Exchange-Diagnostics: 1; AM5PR0801MB1988; 6:F5C5ZQaLEXz9rPVUHeoAPWITR3DZwpV7lhfaBYgwGwjMGWGz4ttcu40NNBubFSu3DL8AS2EEociQyF8ae3fJP5Z+qa9IVIsfb2Nyzr5FGh3pt7u+h9cr+3A2Uv4anzIENtGxbgItYURyEjVqxklt5DOdAv0ahBkEfMUoSxIolzPrYkESTZh6byIkaXm+YV4s00HWyQPY/cZEes5u2W1AJxc7cJIigUNLWnK5G7orKUt1ej7zs8i6SumaxzFHYHeFrnYwlWmuJ3RcP/+SdbXevS2xVCpyaRfQvmvooUcfKj571d4Ine2AqJHH84/B5VwHrPGUkp/f/MWpR2wz7nTEp/MjiIBpFgq7o4EVIJWXSeg=; 5:x1tX7mBelgiqBAy2e2nY48YkhiMMqTdLJFncHsrFMcGFXR2xuBrlcROZTSCyjSnMtF9t6OVUN7uhSwa6GkpecddOzyLw1DV5drm2fSwLnQ/rKrU2aY90dPpJKgGVktR7s+S/DEECVpjcQgojuhGS12rL5nRaS8yMjKYuBhTYock=; 24:Ts9uHThQlCPOS/tFIhtQEkCh/48VI99ZVnzoPp+VsJwWMaxS53CEOWhajrnsFRNjPfIXOFNBNGBunGsm7gyGcZGoGpTGZfaxbSkURjFd2EQ=; 7:LXtknzw0DacVL7AZP+72ZV8msA2dDN+zvZfAuNFhAHVFV+eHeJAJZl0xRYL80tL+U4jsluB9FlSl2Macd2avF0YwTXPDFqGN97EGbTO2Y5WqtidGuIvPpsVaMW1ya2my7yxFGZhwTNercHotcqFy19RcByR63w2qPsGbhhm1JMtvyYdxm+BVF39mk8t2VAYOn5OY1z8kawP/7xI2rBlRJyVBGBVlSRawvlbuUECYusuwVD6W3e1UrWNnpGfqnNTe SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM5PR0801MB1988; 20:MV5lVNPpQypZAy6/Jxqv0yDJC+pCZLl0JbxGHg9ixnNxc+eKj0CgV7yzy5tK9ce9PD9+B+2YTXGDaDrqBCs0GAms0DxkLcE0tkUthTLjxAdCl+CSKJzBSPdAoMQao+0EsnAhHoKcxBdSw6qXmAfAfhyReiBk1ZVBiUw+xDYVwRI= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Feb 2018 16:09:37.0672 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cb48a70a-3e46-44a6-9dc2-08d573c558bb X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0801MB1988 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.2.114 Subject: [Qemu-devel] [PATCH v3 1/2] iotest 033: add misaligned write-zeroes test via truncate 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 , famz@redhat.com, qemu-block@nongnu.org, mreitz@redhat.com, stefanha@redhat.com, berto@igalia.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This new test case only makes sense for qcow2 while iotest 033 is generic; however it matches the test purpose perfectly and also 033 contains those do_test() tricks to pass the alignment, which won't look nice being duplicated in other tests or moved to the common code. Signed-off-by: Anton Nefedov Tested-by: Eric Blake --- tests/qemu-iotests/033 | 29 +++++++++++++++++++++++++++++ tests/qemu-iotests/033.out | 13 +++++++++++++ 2 files changed, 42 insertions(+) diff --git a/tests/qemu-iotests/033 b/tests/qemu-iotests/033 index 2cdfd13..a1d8357 100755 --- a/tests/qemu-iotests/033 +++ b/tests/qemu-iotests/033 @@ -64,6 +64,9 @@ do_test() } | $QEMU_IO $IO_EXTRA_ARGS } +echo +echo "=== Test aligned and misaligned write zeroes operations ===" + for write_zero_cmd in "write -z" "aio_write -z"; do for align in 512 4k; do echo @@ -102,7 +105,33 @@ for align in 512 4k; do done done + +# Trigger truncate that would shrink qcow2 L1 table, which is done by +# clearing one entry (8 bytes) with bdrv_co_pwrite_zeroes() + +echo +echo "=== Test misaligned write zeroes via truncate ===" +echo + +# any size will do, but the smaller the size the smaller the required image +CLUSTER_SIZE=$((4 * 1024)) +L2_COVERAGE=$(($CLUSTER_SIZE * $CLUSTER_SIZE / 8)) +_make_test_img $(($L2_COVERAGE * 2)) + +do_test 512 "write -P 1 0 0x200" "$TEST_IMG" | _filter_qemu_io +# next L2 table +do_test 512 "write -P 1 $L2_COVERAGE 0x200" "$TEST_IMG" | _filter_qemu_io + +# only interested in qcow2 here; also other formats might respond with +# "not supported" error message +if [ $IMGFMT = "qcow2" ]; then + do_test 512 "truncate $L2_COVERAGE" "$TEST_IMG" | _filter_qemu_io +fi + +do_test 512 "read -P 1 0 0x200" "$TEST_IMG" | _filter_qemu_io + # success, all done +echo echo "*** done" rm -f $seq.full status=0 diff --git a/tests/qemu-iotests/033.out b/tests/qemu-iotests/033.out index 95929ef..9683f6b 100644 --- a/tests/qemu-iotests/033.out +++ b/tests/qemu-iotests/033.out @@ -1,6 +1,8 @@ QA output created by 033 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 +=== Test aligned and misaligned write zeroes operations === + == preparing image == wrote 1024/1024 bytes at offset 512 1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -164,4 +166,15 @@ read 512/512 bytes at offset 512 read 3072/3072 bytes at offset 1024 3 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=== Test misaligned write zeroes via truncate === + +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=4194304 +wrote 512/512 bytes at offset 0 +512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 512/512 bytes at offset 2097152 +512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 512/512 bytes at offset 0 +512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + *** done