From patchwork Tue Jan 16 13:04:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 10166827 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 4F949600CA for ; Tue, 16 Jan 2018 13:14:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 418BD28520 for ; Tue, 16 Jan 2018 13:14:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 35E0D2852A; Tue, 16 Jan 2018 13:14:50 +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 1EB7F28520 for ; Tue, 16 Jan 2018 13:14:49 +0000 (UTC) Received: from localhost ([::1]:35499 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebR4i-0002DF-Ds for patchwork-qemu-devel@patchwork.kernel.org; Tue, 16 Jan 2018 08:14:48 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55771) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebQvW-0002qI-0z for qemu-devel@nongnu.org; Tue, 16 Jan 2018 08:05:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ebQvL-0006Wi-OJ for qemu-devel@nongnu.org; Tue, 16 Jan 2018 08:05:18 -0500 Received: from mail-ve1eur01on0091.outbound.protection.outlook.com ([104.47.1.91]:25568 helo=EUR01-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 1ebQvL-0006Va-Df; Tue, 16 Jan 2018 08:05:07 -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=yweBPoPlRT5aTsh7mBM8zgaTJK0ARCJAWHfb2gscz9U=; b=G5DtpG0ceUTDfzlN3lPsmt+IjY8NuRu+C2ILzpvRpsw1soA0gQ9WCIxPE20Z++eOQpjNLlr7rLvPwSyAmrNbFAghpgyeozU9oJeNp/ZTO54Zo462BCgznNZvDlbQf/2I62exYly2N8Hla/z9Rxh3IfXiyWm1CQu+y+Eih61HrQ0= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; Received: from xantnef-ws.sw.ru (195.214.232.6) by VI1PR0801MB2000.eurprd08.prod.outlook.com (2603:10a6:800:8a::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.407.7; Tue, 16 Jan 2018 13:05:05 +0000 From: Anton Nefedov To: qemu-devel@nongnu.org Date: Tue, 16 Jan 2018 16:04:29 +0300 Message-Id: <1516107870-8110-9-git-send-email-anton.nefedov@virtuozzo.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516107870-8110-1-git-send-email-anton.nefedov@virtuozzo.com> References: <1516107870-8110-1-git-send-email-anton.nefedov@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: HE1P190CA0006.EURP190.PROD.OUTLOOK.COM (2603:10a6:3:bc::16) To VI1PR0801MB2000.eurprd08.prod.outlook.com (2603:10a6:800:8a::21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3367d490-f786-40f6-712c-08d55ce1c390 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:VI1PR0801MB2000; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB2000; 3:c5yh9qFEKwHI09AQS2wsXvzx/T77nIwd9iRpMFGIXrask/R8yFe4/JARUBTpd1pgcbinbh9xMD5ggD1t5sGyKPa86Kt63cC59eooZYXH1pdt3iAsHZCg5pxDMROBwltVtkAK9p3x+Q+Ba50JqbiTrg1rGlBist334iuXonJXHRdGMPUfiQWFFi+xmb9x7fKKuwBZqnn+k8/QT2QbXB8B81/459R7VrNueyfGSzJUaxcJKk/epL0xB9e6HmegEO4K; 25:e+lL624xplmxsxX1lzfn138lWg+RBzonSA3k86w8+xtuyYsy1plNtO0YOi3XQoOFiz/O5tUqjYRJGtCpfn7QJhPU+4sxRRzsdTbKIfdYnJCQ++MSGr5Fy+GMoC4P7nT0J1cArwyFXRQxai4hPyTywrlmrdK/kqqTx4UBA1TV5Y6x+mgMut1W1IHRkDtuLy7LaV9zo30CIzvwY+KZ3BQRKuogEM1VLx1f/gDtMud0GFexbzRas2+XvhbyZfTZiuLL0ckmoyrffg/YMdpyp8n1SMxZvFO1MdXvIyWFt6xuwtJv7i8Bj6mdZZ1h57gm9ZyLkt4EIP4W1UOyk+FaTrh6SQ==; 31:ldrQqzLLBiCMtRl8abAun6AQwwX5h2cyLox6RmkVkH+pwdPaVgTEqmzO8lwj3649MkNecymywDZQA81LQrMSylDMK68AkCeJMajxqGHrc4hCWvNNNtIN0X0d7Re/3aCWRBnJUzJzgn2Vb5Y4NnUas1yCbivp3wP0lRv8F/w+HEySupOLWNaaUGSL2ll5xVUAZI4fBqbdFE0PtXV5OXYa66BM91nqRFa8IEX+afftUFM= X-MS-TrafficTypeDiagnostic: VI1PR0801MB2000: X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB2000; 20:I62aG14DmSOPxur5TzHGRYjHgSII+XJXy31n8kyZUcmgWfCGzQA7lu07SON/xvmOinn2tuGtSKMBu/6qM69C9x/V6d2xC0HVQlwgfw+FsLRjtHTaDtFQp0PVIlVYF24tVx4K2N/VZKFML3uH+h8WUcouLXEa33+UZgffecbR+wQ6YivHWzuQy3vidTU2oV0IXHbQ8HzouPeoL9qOkyKG/eHZzMYnEW4PUeMGYn0NVtJujXKx9CPA5KfdowrLUZTIRVpbq14mpGRsSLJj19YcJJI225gvwFdk3NDfYhfT/tGddcVogRz61wkCqr4gapgIjmdJRh2tPZ3P/TP0I8Zm1NrHmh+vIMdVB7two0q4GnnWuErRoqnFvVPmDlcQeWLnz/0f7zHhAHnqLhLWAZ30J9mGRfreXpCmD+qh2ib65Cc=; 4:39hUfu3aCSucCqRqS59oCy4ejJv+tf18QiUPAJlGnpqhHy3/msdz2iNOKxtggareGJhYCNlot7Gcbs+QYXZDGDgH4pCxP+2iboutz2ARXUDGqwBOCKFjGcjnWdvhZsrHOJ2Dku77tvTxamTRfJBXEpU35UW08abMoFwZ332XZiMUiP6LD4sym0HEf/tmKcgpAzB3DSyZF2Gg21QyLCnDfN3jCy40WMTTPivnzEFPwGlV7itFSdYjqNW8o95KOdGBxLLy/GQfBneme6qkU5K8bg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(5005006)(8121501046)(93006095)(93001095)(3002001)(3231023)(944501161)(10201501046)(6041268)(20161123564045)(20161123558120)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:VI1PR0801MB2000; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:VI1PR0801MB2000; X-Forefront-PRVS: 0554B1F54F X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(346002)(396003)(366004)(39380400002)(376002)(39840400004)(189003)(199004)(105586002)(2906002)(48376002)(6916009)(2950100002)(5660300001)(53416004)(66066001)(6512007)(53936002)(26005)(50466002)(47776003)(16526018)(6666003)(2351001)(478600001)(36756003)(106356001)(2361001)(69596002)(51416003)(305945005)(68736007)(4326008)(8936002)(81166006)(386003)(52116002)(3846002)(25786009)(8676002)(81156014)(59450400001)(6486002)(50226002)(76176011)(6116002)(6506007)(97736004)(316002)(16586007)(86362001)(575784001)(107886003)(7736002)(21314002); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR0801MB2000; 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; VI1PR0801MB2000; 23:Cmbe2t/e13lOUZFL8R5F2NA378/r1pD8sMqoNyL?= =?us-ascii?Q?K831mrISyUFEZ/Zf8ejhCBO4Lq20SEktRIf0FNhyHYjaOd+/P1C8QtsgW374?= =?us-ascii?Q?dw0Z0CxwBERRnYT194MPKPfFwHFDJBhRDnQ0CbVzsBrZV7x0XTTigihvw9XJ?= =?us-ascii?Q?0f76bnx4B+9lrYVo+xy7PZvMVjq5T5aP40swRDr5T6UhLERirY7JnktE9x2Y?= =?us-ascii?Q?qnBtz9e3CNw7SKrqljtzuG/iX5ZE/Q8e9ekW9q9MyF3hybtisN58O0OailUH?= =?us-ascii?Q?dvdWrBcFnHG3uMQN+ET/vMwDEhC2CPb6HXcGn15SNtWOHLJI6CflkpmZBg7t?= =?us-ascii?Q?Yrxuzy3OMEg6uVJC3F6K6tA8a5iasn2AsrNdAS14tS/Ovv27hBR8PvVcrdkY?= =?us-ascii?Q?Y/iSOeIpMQ0mFZzRanB95RzsRDohBDMVVELZAkE3LOJAp40/EQ9Nihqiym8B?= =?us-ascii?Q?hxJz+c9F96ekuajTSecK/mmMxxFleeTFydormaJULZlZSdW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-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jan 2018 13:05:05.4182 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3367d490-f786-40f6-712c-08d55ce1c390 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB2000 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.1.91 Subject: [Qemu-devel] [PATCH v6 8/9] qcow2: skip writing zero buffers to empty COW areas 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 If COW areas of the newly allocated clusters are zeroes on the backing image, efficient bdrv_write_zeroes(flags=BDRV_REQ_ALLOCATE) can be used on the whole cluster instead of writing explicit zero buffers later in perform_cow(). iotest 060: write to the discarded cluster does not trigger COW anymore. so, break on write_aio event instead, will work for the test (but write won't fail anymore, so update reference output) iotest 066: cluster-alignment areas that were not really COWed are now detected as zeroes, hence the initial write has to be exactly the same size for the maps to match Signed-off-by: Anton Nefedov --- block/qcow2.h | 6 +++++ block/qcow2-cluster.c | 2 +- block/qcow2.c | 63 ++++++++++++++++++++++++++++++++++++++++++++-- block/trace-events | 1 + tests/qemu-iotests/060 | 2 +- tests/qemu-iotests/060.out | 3 ++- tests/qemu-iotests/066 | 2 +- tests/qemu-iotests/066.out | 4 +-- 8 files changed, 75 insertions(+), 8 deletions(-) diff --git a/block/qcow2.h b/block/qcow2.h index 46c8cf4..e6e3a22 100644 --- a/block/qcow2.h +++ b/block/qcow2.h @@ -377,6 +377,12 @@ typedef struct QCowL2Meta Qcow2COWRegion cow_end; /** + * Indicates that COW regions are already handled and do not require + * any more processing. + */ + bool skip_cow; + + /** * The I/O vector with the data from the actual guest write request. * If non-NULL, this is meant to be merged together with the data * from @cow_start and @cow_end into one single write operation. diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c index a3fec27..511ceb8 100644 --- a/block/qcow2-cluster.c +++ b/block/qcow2-cluster.c @@ -791,7 +791,7 @@ static int perform_cow(BlockDriverState *bs, QCowL2Meta *m) assert(start->offset + start->nb_bytes <= end->offset); assert(!m->data_qiov || m->data_qiov->size == data_bytes); - if (start->nb_bytes == 0 && end->nb_bytes == 0) { + if ((start->nb_bytes == 0 && end->nb_bytes == 0) || m->skip_cow) { return 0; } diff --git a/block/qcow2.c b/block/qcow2.c index 2ed21ff..811adeb 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -1833,6 +1833,11 @@ static bool merge_cow(uint64_t offset, unsigned bytes, continue; } + /* If COW regions are handled already, skip this too */ + if (m->skip_cow) { + continue; + } + /* The data (middle) region must be immediately after the * start region */ if (l2meta_cow_start(m) + m->cow_start.nb_bytes != offset) { @@ -1875,6 +1880,53 @@ static bool is_zero(BlockDriverState *bs, int64_t offset, int64_t bytes) return res >= 0 && (res & BDRV_BLOCK_ZERO) && nr == bytes; } +static bool is_zero_cow(BlockDriverState *bs, QCowL2Meta *m) +{ + if (bs->encrypted) { + return false; + } + + if (!is_zero(bs, m->offset + m->cow_start.offset, m->cow_start.nb_bytes)) { + return false; + } + + if (!is_zero(bs, m->offset + m->cow_end.offset, m->cow_end.nb_bytes)) { + return false; + } + + return true; +} + +static void handle_alloc_space(BlockDriverState *bs, QCowL2Meta *l2meta) +{ + BDRVQcow2State *s = bs->opaque; + QCowL2Meta *m; + + for (m = l2meta; m != NULL; m = m->next) { + int ret; + + if (!m->cow_start.nb_bytes && !m->cow_end.nb_bytes) { + continue; + } + + if (!is_zero_cow(bs, m)) { + continue; + } + + /* instead of writing zero COW buffers, + efficiently zero out the whole clusters */ + ret = bdrv_co_pwrite_zeroes(bs->file, m->alloc_offset, + m->nb_clusters * s->cluster_size, + BDRV_REQ_ALLOCATE); + if (ret < 0) { + continue; + } + + trace_qcow2_skip_cow(qemu_coroutine_self(), m->offset, m->nb_clusters); + m->skip_cow = true; + } +} + static coroutine_fn int qcow2_co_pwritev(BlockDriverState *bs, uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags) @@ -1957,24 +2009,31 @@ static coroutine_fn int qcow2_co_pwritev(BlockDriverState *bs, uint64_t offset, goto fail; } + qemu_co_mutex_unlock(&s->lock); + + if (bs->file->bs->supported_zero_flags & BDRV_REQ_ALLOCATE) { + handle_alloc_space(bs, l2meta); + } + /* If we need to do COW, check if it's possible to merge the * writing of the guest data together with that of the COW regions. * If it's not possible (or not necessary) then write the * guest data now. */ if (!merge_cow(offset, cur_bytes, &hd_qiov, l2meta)) { - qemu_co_mutex_unlock(&s->lock); BLKDBG_EVENT(bs->file, BLKDBG_WRITE_AIO); trace_qcow2_writev_data(qemu_coroutine_self(), cluster_offset + offset_in_cluster); ret = bdrv_co_pwritev(bs->file, cluster_offset + offset_in_cluster, cur_bytes, &hd_qiov, 0); - qemu_co_mutex_lock(&s->lock); if (ret < 0) { + qemu_co_mutex_lock(&s->lock); goto fail; } } + qemu_co_mutex_lock(&s->lock); + while (l2meta != NULL) { QCowL2Meta *next; diff --git a/block/trace-events b/block/trace-events index 11c8d5f..c9fa596 100644 --- a/block/trace-events +++ b/block/trace-events @@ -61,6 +61,7 @@ qcow2_writev_done_part(void *co, int cur_bytes) "co %p cur_bytes %d" qcow2_writev_data(void *co, uint64_t offset) "co %p offset 0x%" PRIx64 qcow2_pwrite_zeroes_start_req(void *co, int64_t offset, int count) "co %p offset 0x%" PRIx64 " count %d" qcow2_pwrite_zeroes(void *co, int64_t offset, int count) "co %p offset 0x%" PRIx64 " count %d" +qcow2_skip_cow(void* co, uint64_t offset, int nb_clusters) "co %p offset 0x%" PRIx64 " nb_clusters %d" # block/qcow2-cluster.c qcow2_alloc_clusters_offset(void *co, uint64_t offset, int bytes) "co %p offset 0x%" PRIx64 " bytes %d" diff --git a/tests/qemu-iotests/060 b/tests/qemu-iotests/060 index 14797dd..1d09bc0 100755 --- a/tests/qemu-iotests/060 +++ b/tests/qemu-iotests/060 @@ -160,7 +160,7 @@ poke_file "$TEST_IMG" '131084' "\x00\x00" # 0x2000c # any unallocated cluster, leading to an attempt to overwrite the second L2 # table. Finally, resume the COW write and see it fail (but not crash). echo "open -o file.driver=blkdebug $TEST_IMG -break cow_read 0 +break write_aio 0 aio_write 0k 1k wait_break 0 write 64k 64k diff --git a/tests/qemu-iotests/060.out b/tests/qemu-iotests/060.out index c4cb7c6..7a0fbb8 100644 --- a/tests/qemu-iotests/060.out +++ b/tests/qemu-iotests/060.out @@ -108,7 +108,8 @@ qcow2: Marking image as corrupt: Preventing invalid write on metadata (overlaps blkdebug: Suspended request '0' write failed: Input/output error blkdebug: Resuming request '0' -aio_write failed: No medium found +wrote 1024/1024 bytes at offset 0 +1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) === Testing unallocated image header === diff --git a/tests/qemu-iotests/066 b/tests/qemu-iotests/066 index 8638217..3c216a1 100755 --- a/tests/qemu-iotests/066 +++ b/tests/qemu-iotests/066 @@ -71,7 +71,7 @@ echo _make_test_img $IMG_SIZE # Create data clusters (not aligned to an L2 table) -$QEMU_IO -c 'write -P 42 1M 256k' "$TEST_IMG" | _filter_qemu_io +$QEMU_IO -c "write -P 42 $(((1024 + 32) * 1024)) 192k" "$TEST_IMG" | _filter_qemu_io orig_map=$($QEMU_IMG map --output=json "$TEST_IMG") # Convert the data clusters to preallocated zero clusters diff --git a/tests/qemu-iotests/066.out b/tests/qemu-iotests/066.out index 3d9da9b..093431e 100644 --- a/tests/qemu-iotests/066.out +++ b/tests/qemu-iotests/066.out @@ -19,8 +19,8 @@ Offset Length Mapped to File === Writing to preallocated zero clusters === Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67109376 -wrote 262144/262144 bytes at offset 1048576 -256 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 196608/196608 bytes at offset 1081344 +192 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) wrote 262144/262144 bytes at offset 1048576 256 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) wrote 196608/196608 bytes at offset 1081344