From patchwork Thu Nov 16 16:54:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 10061519 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 68CA160230 for ; Thu, 16 Nov 2017 16:59:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 579842A5BE for ; Thu, 16 Nov 2017 16:59:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4C0AA2AB1A; Thu, 16 Nov 2017 16:59:10 +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 87D402A5BE for ; Thu, 16 Nov 2017 16:59:09 +0000 (UTC) Received: from localhost ([::1]:41822 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFNVM-0003xl-NX for patchwork-qemu-devel@patchwork.kernel.org; Thu, 16 Nov 2017 11:59:08 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40187) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFNRm-0001R7-5f for qemu-devel@nongnu.org; Thu, 16 Nov 2017 11:55:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eFNRj-0007Re-VV for qemu-devel@nongnu.org; Thu, 16 Nov 2017 11:55:25 -0500 Received: from mail-he1eur01on0120.outbound.protection.outlook.com ([104.47.0.120]:43088 helo=EUR01-HE1-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 1eFNRj-0007Fo-Mf; Thu, 16 Nov 2017 11:55:23 -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=HzQAt0IughnxdlowGw/d/RrK8qLCQkHCj5HLKBBhdnU=; b=Z5CGkhH5460R2zCIJTbQBFMSZSZArs0ns3oS++CnMq3ttYr+iHmrwZYQXHNEHe0UW9WT+wMhEUCZJSwNKVAUSaliBob3MccnjQTIe34AbAef+zEf6KCZdNlRPteb5UuQQ4rt7ZiS/RvUMevrbCi0Ey44kr7yWFLbWDwZFlgDifw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; Received: from xantnef-ws.sw.ru (195.214.232.6) by DB6PR0801MB1992.eurprd08.prod.outlook.com (2603:10a6:4:76::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.239.5; Thu, 16 Nov 2017 16:55:19 +0000 From: Anton Nefedov To: qemu-devel@nongnu.org Date: Thu, 16 Nov 2017 19:54:57 +0300 Message-Id: <1510851298-59922-4-git-send-email-anton.nefedov@virtuozzo.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510851298-59922-1-git-send-email-anton.nefedov@virtuozzo.com> References: <1510851298-59922-1-git-send-email-anton.nefedov@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: DB3PR0202CA0008.eurprd02.prod.outlook.com (2603:10a6:8:1::21) To DB6PR0801MB1992.eurprd08.prod.outlook.com (2603:10a6:4:76::9) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 76f49baf-a30b-41f9-a90d-08d52d12d1f4 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4602075)(7168017)(4627115)(201703031133081)(201702281549075)(2017052603258); SRVR:DB6PR0801MB1992; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0801MB1992; 3:QFgcIFva3+LtW7ABtzf5uonA1jfCtsTgIS0dmNh/dHXOhZhGh3NcTlCqcA3S+A8R0b9V1nMd0uODVLbWO6+sXgp7m+yOZf/9Yg/roFRuXqg48yfC1iw3PRcJXdoXf8eht7e4QXEZSplWmG8tZUpycGnkLU75aA2mkSKuKL32DKTTf2ZRH4371/vzErXZjHIcclOSbxHg6DxUGgNrY8BBKrSsaWn5fcC+ibl4ghSq4jmFwUBQH25skHwh0G07ryI0; 25:zwe1Ajx9i0/w+qG4ael18jxtRWyanje25oKcFoqUeNCbPoSv4m4dXghOu/kTiHWXWboULCdZnVp4yqo4yjPosxS8cD4w1pzXbwrdxV3L2uuTG/CPO9A23Bm7LPutj8cJFPvVjO1UxJEWGFYpnKCJTpXLbGmKRqvCRtzuNTbiGkLX2E2ysPbwnjZNCn2DsauvaOlef+mDeYnPTrkQu2h0v9i0tq57kva8AIdRfu1o91mZfHJTmm2RF9B7ABmO84ZFOAq22eVuMYHqC4BXDBVP+dvLrXWJXFJ8n71nqbtwy5AcZ0bw6EnyVRaIpHmk6p6mEI82slNVSI+az95urxnSBA==; 31:z3u6kxl7IgMHRefpYDNv82+FWMJ9FiwITtfZh7/WQANY8oANqvTtly67qBF3Mub3LqSC0E/P7w9C//4OnmDftyo8W3xJWgYEeqIGdvDbLUcMLgBQyN78ycBbo7h7BUbKkMHVaJhgVJ4tD/auHThkwyq3RUE4sIQ6zp5d7Lrg3FnZABGIBQi1c5bGO2It77gXnXkY/+sM6NpMs/TLcaCD0MN4sY2MLw7OXdibGAzc6PI= X-MS-TrafficTypeDiagnostic: DB6PR0801MB1992: X-Microsoft-Exchange-Diagnostics: 1; DB6PR0801MB1992; 20:swU0S3LLazZ+1ReEYcsCavNMxPOWjgyFOfZPqWL1shWLJmCcXSRe06TlYc2TTr/X1VmcN20da6muHXg1QZittGdiSiopdsyZfhteJf2x/G8qzMMCw30gkneMluol66+Gs8K0KjwbNKv99jmVwItQWa0Cy8KGx9Y/C0yYSbzNTyWOeZ9+jZdV+rE+DBzMvkkbOBi+Xm8/H0SG5Ali5NVP40LH1VTsWYR5lisWDQnv8avVEECUw12ZTKce2/tqQt5n5J/+qO1KRG9lU14LGaqb17/ekzwkBWwdbcxt7D8aMMM5zKvGXn0O4NYcMj9RTLhcWDNbiSS1CCjh0FiiY2cDo6qsRoLSok3PU7PDoKq8vfyIFARD8BFkTZTM7aAhpT7psCKZRwUEq0Erzm7DNXgEJHVXS+C9R0EDRscQC35WK5s=; 4:44Z49fsWRfliNXO72eslJ8kTd6qWWQ4ksOVgn1j+cMv+IcSAsKbZ/zmCXQ/I45Xj6Hs551v5KwtZogFoa/kjoqTAh6xAUoesVQAiGdNd8ABQixU/4hwTMuZCee2nEfmQvOkaXRJPBIzk1cvkCjfKf5byo7xvbNvsyx8Z15T2jUfXIJaMuhGtEMf6MHpLdxx8MRX5A2mRhuZ6orJvJ+ldwbGueSyHTTOZFEOw6im6VS8oBYk56UnQqDzToAsOcp90Om5Rjh7I5YWnLH4ez4gKlg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(3002001)(10201501046)(3231022)(100000703101)(100105400095)(93006095)(93001095)(6041248)(20161123562025)(20161123560025)(20161123564025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DB6PR0801MB1992; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DB6PR0801MB1992; X-Forefront-PRVS: 0493852DA9 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(376002)(346002)(189002)(199003)(189998001)(69596002)(97736004)(2950100002)(6916009)(6666003)(47776003)(50466002)(66066001)(3846002)(48376002)(5660300001)(316002)(6116002)(16586007)(86362001)(5003940100001)(16526018)(33646002)(6512007)(478600001)(2361001)(106356001)(53936002)(105586002)(2351001)(36756003)(7736002)(76176999)(50986999)(107886003)(305945005)(50226002)(68736007)(53416004)(8676002)(81156014)(81166006)(25786009)(4326008)(8936002)(6506006)(101416001)(6486002)(2906002); DIR:OUT; SFP:1102; SCL:1; SRVR:DB6PR0801MB1992; 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; DB6PR0801MB1992; 23:4frONvuFmNBf5cKsp/1PTlaN+VZ4FNmgt5O7MT0?= =?us-ascii?Q?MHILO2KWzgmiyz6ZEvkxmxq6GWD8BbOqVfzC92zdd/YB+5GMocM1uie354wH?= =?us-ascii?Q?hvxoV/tZ4cMg7itodQ5tYXfi39kLgKhos3uZmYDiiX9USGRSryZZbFgS8N65?= =?us-ascii?Q?1gz7sPnQWs8C8YQ2sGLQ4tyimFLPcUqjvVGofmqEWVTl0GAMCp6ey2mb4w5j?= =?us-ascii?Q?6PY5RjHXF07qpNr9SZbuyOopZBB5QPcgZoAmBrhaNcQBiE7sLcBofNyzRRdg?= =?us-ascii?Q?XZBusN0wY5OASeBIvIv8uMaORoPdnBXVeIORO36TteqPhJ/3lB+S/w5s4BIL?= =?us-ascii?Q?VhWu7FWshrp7VPI9vGr6NFKt6D8YAjq8pDCU5bqBoVfIffYp5IuaW5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uEaT4+ccerb9dygL6b2MmM= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2017 16:55:19.0426 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 76f49baf-a30b-41f9-a90d-08d52d12d1f4 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB1992 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.0.120 Subject: [Qemu-devel] [PATCH v2 3/4] block-stream: add compress option 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, den@virtuozzo.com, qemu-block@nongnu.org, mreitz@redhat.com, stefanha@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP It might be useful to compress images during block-stream; this way the user can merge compressed images of a backing chain and the result will remain compressed. Signed-off-by: Anton Nefedov Reviewed-by: Stefan Hajnoczi --- qapi/block-core.json | 4 ++++ include/block/block_int.h | 4 +++- block/stream.c | 16 ++++++++++++---- blockdev.c | 13 ++++++++++++- hmp.c | 2 ++ hmp-commands.hx | 4 ++-- 6 files changed, 35 insertions(+), 8 deletions(-) diff --git a/qapi/block-core.json b/qapi/block-core.json index ab96e34..b7282cd 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -2007,6 +2007,9 @@ # # @speed: the maximum speed, in bytes per second # +# @compress: true to compress data; may only be set if the target format +# supports it (default: false). (Since 2.12) +# # @on-error: the action to take on an error (default report). # 'stop' and 'enospc' can only be used if the block device # supports io-status (see BlockInfo). Since 1.3. @@ -2026,6 +2029,7 @@ { 'command': 'block-stream', 'data': { '*job-id': 'str', 'device': 'str', '*base': 'str', '*base-node': 'str', '*backing-file': 'str', '*speed': 'int', + '*compress': 'bool', '*on-error': 'BlockdevOnError' } } ## diff --git a/include/block/block_int.h b/include/block/block_int.h index a548277..093bf9b 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -863,6 +863,7 @@ int is_windows_drive(const char *filename); * @backing_file_str: The file name that will be written to @bs as the * the new backing file if the job completes. Ignored if @base is %NULL. * @speed: The maximum speed, in bytes per second, or 0 for unlimited. + * @compress: True to compress data. * @on_error: The action to take upon error. * @errp: Error object. * @@ -875,7 +876,8 @@ int is_windows_drive(const char *filename); */ void stream_start(const char *job_id, BlockDriverState *bs, BlockDriverState *base, const char *backing_file_str, - int64_t speed, BlockdevOnError on_error, Error **errp); + int64_t speed, bool compress, + BlockdevOnError on_error, Error **errp); /** * commit_start: diff --git a/block/stream.c b/block/stream.c index e6f7234..75c9d66 100644 --- a/block/stream.c +++ b/block/stream.c @@ -38,23 +38,29 @@ typedef struct StreamBlockJob { BlockdevOnError on_error; char *backing_file_str; int bs_flags; + bool compress; } StreamBlockJob; static int coroutine_fn stream_populate(BlockBackend *blk, int64_t offset, uint64_t bytes, - void *buf) + void *buf, bool compress) { struct iovec iov = { .iov_base = buf, .iov_len = bytes, }; QEMUIOVector qiov; + int flags = BDRV_REQ_COPY_ON_READ; + + if (compress) { + flags |= BDRV_REQ_WRITE_COMPRESSED; + } assert(bytes < SIZE_MAX); qemu_iovec_init_external(&qiov, &iov, 1); /* Copy-on-read the unallocated clusters */ - return blk_co_preadv(blk, offset, qiov.size, &qiov, BDRV_REQ_COPY_ON_READ); + return blk_co_preadv(blk, offset, qiov.size, &qiov, flags); } typedef struct { @@ -166,7 +172,7 @@ static void coroutine_fn stream_run(void *opaque) } trace_stream_one_iteration(s, offset, n, ret); if (copy) { - ret = stream_populate(blk, offset, n, buf); + ret = stream_populate(blk, offset, n, buf, s->compress); } if (ret < 0) { BlockErrorAction action = @@ -227,7 +233,8 @@ static const BlockJobDriver stream_job_driver = { void stream_start(const char *job_id, BlockDriverState *bs, BlockDriverState *base, const char *backing_file_str, - int64_t speed, BlockdevOnError on_error, Error **errp) + int64_t speed, bool compress, + BlockdevOnError on_error, Error **errp) { StreamBlockJob *s; BlockDriverState *iter; @@ -267,6 +274,7 @@ void stream_start(const char *job_id, BlockDriverState *bs, s->base = base; s->backing_file_str = g_strdup(backing_file_str); s->bs_flags = orig_bs_flags; + s->compress = compress; s->on_error = on_error; trace_stream_start(bs, base, s); diff --git a/blockdev.c b/blockdev.c index 56a6b24..ae2a1d2 100644 --- a/blockdev.c +++ b/blockdev.c @@ -2968,6 +2968,7 @@ void qmp_block_stream(bool has_job_id, const char *job_id, const char *device, bool has_base_node, const char *base_node, bool has_backing_file, const char *backing_file, bool has_speed, int64_t speed, + bool has_compress, bool compress, bool has_on_error, BlockdevOnError on_error, Error **errp) { @@ -2981,6 +2982,10 @@ void qmp_block_stream(bool has_job_id, const char *job_id, const char *device, on_error = BLOCKDEV_ON_ERROR_REPORT; } + if (!has_compress) { + compress = false; + } + bs = bdrv_lookup_bs(device, device, errp); if (!bs) { return; @@ -3034,11 +3039,17 @@ void qmp_block_stream(bool has_job_id, const char *job_id, const char *device, goto out; } + if (compress && bs->drv->bdrv_co_pwritev_compressed == NULL) { + error_setg(errp, "Compression is not supported for this drive %s", + device); + goto out; + } + /* backing_file string overrides base bs filename */ base_name = has_backing_file ? backing_file : base_name; stream_start(has_job_id ? job_id : NULL, bs, base_bs, base_name, - has_speed ? speed : 0, on_error, &local_err); + has_speed ? speed : 0, compress, on_error, &local_err); if (local_err) { error_propagate(errp, local_err); goto out; diff --git a/hmp.c b/hmp.c index 35a7041..854c88e 100644 --- a/hmp.c +++ b/hmp.c @@ -1812,9 +1812,11 @@ void hmp_block_stream(Monitor *mon, const QDict *qdict) const char *device = qdict_get_str(qdict, "device"); const char *base = qdict_get_try_str(qdict, "base"); int64_t speed = qdict_get_try_int(qdict, "speed", 0); + bool compress = qdict_get_try_bool(qdict, "compress", false); qmp_block_stream(true, device, device, base != NULL, base, false, NULL, false, NULL, qdict_haskey(qdict, "speed"), speed, + qdict_haskey(qdict, "compress"), compress, true, BLOCKDEV_ON_ERROR_REPORT, &error); hmp_handle_error(mon, &error); diff --git a/hmp-commands.hx b/hmp-commands.hx index 4afd57c..f6794bb 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -75,8 +75,8 @@ ETEXI { .name = "block_stream", - .args_type = "device:B,speed:o?,base:s?", - .params = "device [speed [base]]", + .args_type = "device:B,speed:o?,base:s?,compress:o?", + .params = "device [speed [base]] [compress]", .help = "copy data from a backing file into a block device", .cmd = hmp_block_stream, },