From patchwork Sun Dec 30 20:09:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Shinkevich X-Patchwork-Id: 10745237 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3D5D46C5 for ; Sun, 30 Dec 2018 20:11:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2D9F028830 for ; Sun, 30 Dec 2018 20:11:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2203C28874; Sun, 30 Dec 2018 20:11:01 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 28E4F2884E for ; Sun, 30 Dec 2018 20:11:00 +0000 (UTC) Received: from localhost ([127.0.0.1]:46467 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gdhQJ-0003Er-D3 for patchwork-qemu-devel@patchwork.kernel.org; Sun, 30 Dec 2018 15:10:59 -0500 Received: from eggs.gnu.org ([208.118.235.92]:43335) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gdhOq-0001g3-Kr for qemu-devel@nongnu.org; Sun, 30 Dec 2018 15:09:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gdhOp-0008Fz-3g for qemu-devel@nongnu.org; Sun, 30 Dec 2018 15:09:28 -0500 Received: from relay.sw.ru ([185.231.240.75]:46796) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gdhOo-0008Bt-S6; Sun, 30 Dec 2018 15:09:27 -0500 Received: from [172.16.25.136] (helo=localhost.sw.ru) by relay.sw.ru with esmtp (Exim 4.91) (envelope-from ) id 1gdhOi-0000Oj-7l; Sun, 30 Dec 2018 23:09:20 +0300 From: Andrey Shinkevich To: qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Sun, 30 Dec 2018 23:09:11 +0300 Message-Id: <1546200557-774583-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 v5 0/6] 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Dear collegues, 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. v5: The existing copy-on-read filter driver was applied to the block-stream operation in the separated patch. The code refactoring in 'stream.c' is big. Unfortunately, there are issues with getting "write" lock in iotests - subject to further resolution. v4: "[PATCH v4 0/5] Discrad blocks during block-stream operation" The targeted version of the release at 'Since' word of the comment to 'discard' argument changed to 4.0 in the file qapi/block-core.json as Eric Blake noticed. v3: "[PATCH v3 0/5] Discrad blocks during block-stream operation" The series version number and the given changelog were added. 'Signed-off-by' subscription of the patch [PATCH 3/5] amended as Peter Krempa requested. v2: "[PATCH 0/5] Discrad blocks during block-stream operation" The suggestions of Dr. David Alan Gilbert and Alberto Garcia after their first review have been applied. The abort() callback function have been added to the filter driver and some refactoring work done. The test suite for the 'block-stream' command with 'discard' option was added to the 030 file of iotests. v1: "[PATCH 0/2] Discrad blocks during block-stream operation" The initial implementation of the feature. Sincerely, Andrey Shinkevich (6): Stream block job involves copy-on-read filter driver 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/copy-on-read.c | 24 ++++ block/stream.c | 290 ++++++++++++++++++++++++++++++++++++++++-- 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 +- 10 files changed, 448 insertions(+), 65 deletions(-)