From patchwork Thu Nov 22 18:48:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Shinkevich X-Patchwork-Id: 1001935 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=virtuozzo.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4317kz4CFPz9s0t for ; Fri, 23 Nov 2018 05:48:58 +1100 (AEDT) Received: from localhost ([::1]:48920 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPu24-0003PY-CN for incoming@patchwork.ozlabs.org; Thu, 22 Nov 2018 13:48:56 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59664) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPu1S-0003OA-LX for qemu-devel@nongnu.org; Thu, 22 Nov 2018 13:48:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gPu1P-00074Y-Um for qemu-devel@nongnu.org; Thu, 22 Nov 2018 13:48:18 -0500 Received: from relay.sw.ru ([185.231.240.75]:48742) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gPu1P-0006zs-GJ; Thu, 22 Nov 2018 13:48:15 -0500 Received: from [172.16.25.136] (helo=localhost.sw.ru) by relay.sw.ru with esmtp (Exim 4.91) (envelope-from ) id 1gPu1I-0006jl-JQ; Thu, 22 Nov 2018 21:48:08 +0300 From: Andrey Shinkevich To: qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Thu, 22 Nov 2018 21:48:02 +0300 Message-Id: <1542912487-279165-1-git-send-email-andrey.shinkevich@virtuozzo.com> X-Mailer: git-send-email 1.8.3.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 185.231.240.75 Subject: [Qemu-devel] [PATCH 0/5] Discrad blocks during block-stream operation 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, vsementsov@virtuozzo.com, jcody@redhat.com, armbru@redhat.com, dgilbert@redhat.com, andrey.shinkevich@virtuozzo.com, den@openvz.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Hello everyone! The given feature discards blocks with copy-on-read operation while the streaming process runs. Adding the 'discard' argument to the QMP block-stream command allows dropping a block in the backing chain after it has been copied to the active layer. That will elude the block duplication in the intermediate backing file. It saves the disk space while external snapshots are being merged. The method involves the filter insertion above the active layer to allow write operation in the backing chain. The method is similar to that in the 'commit active' command (mirror.c). The permission to write into an inactive layer can not be obtained due to the existing child permission mechanism. There is a commented up hack in the callback function bdrv_stream_top_pwritev() in block/stream.c that redirects write operations below the filter node. Being uncommented, it enables writing into the inactive layer and passing all the iotests in the 030 file. Otherwise, no WRITE permission is granted after the filter insertion above the target node. Any suggestions to resolve that issue will be appreciated. The suggestions of Dr. David Alan Gilbert and Alberto Garcia after their first review have been applied. Sincerely, Andrey Shinkevich (5): Discard blocks while copy-on-read The discard flag for block stream operation iotests: allow resume_drive by node name iotests: prepare 030 for graph change iotests: 030 with block-stream discard block/stream.c | 429 ++++++++++++++++++++++++++++++++++++++++-- blockdev.c | 8 +- hmp-commands.hx | 4 +- hmp.c | 4 +- include/block/block_int.h | 2 +- qapi/block-core.json | 5 +- tests/qemu-iotests/030 | 163 +++++++++++----- tests/qemu-iotests/030.out | 4 +- tests/qemu-iotests/iotests.py | 9 +- 9 files changed, 558 insertions(+), 70 deletions(-)