From patchwork Tue Nov 14 10:16:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 10057273 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 97C2E601D3 for ; Tue, 14 Nov 2017 10:22:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6D304292FF for ; Tue, 14 Nov 2017 10:22:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 61FBE29302; Tue, 14 Nov 2017 10:22:43 +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 922E1292FF for ; Tue, 14 Nov 2017 10:22:42 +0000 (UTC) Received: from localhost ([::1]:58653 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eEYMb-0006lh-VO for patchwork-qemu-devel@patchwork.kernel.org; Tue, 14 Nov 2017 05:22:41 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48290) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eEYHY-0003Dn-Ln for qemu-devel@nongnu.org; Tue, 14 Nov 2017 05:17:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eEYHV-0007Gy-BO for qemu-devel@nongnu.org; Tue, 14 Nov 2017 05:17:28 -0500 Received: from mail-db5eur01on0091.outbound.protection.outlook.com ([104.47.2.91]:64462 helo=EUR01-DB5-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 1eEYHU-0007FN-TE; Tue, 14 Nov 2017 05:17:25 -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=3Oqosq6QtUY9+6pUZcK724b0Uo12wYNzwlKHVeEx/hA=; b=C3eNjxdAlxT0MI9FAENcsy/38QS2T+9fmOjWXJLqZ7HAXutpr9zQ7cH4dnohaZJzjByF5ajBFr9cJ0EUVUsos/qN9IzYmX8ryw6lSEjsqPgtccGIttTFFhe3mRBqIseSAVFbbHROvvLL+BXFuKuE5S+EaLvaAatlNSmNyuS4F3s= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; Received: from xantnef-ws.sw.ru (195.214.232.6) by HE1PR0801MB1993.eurprd08.prod.outlook.com (2603:10a6:3:4f::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.218.12; Tue, 14 Nov 2017 10:17:22 +0000 From: Anton Nefedov To: qemu-devel@nongnu.org Date: Tue, 14 Nov 2017 13:16:52 +0300 Message-Id: <1510654613-47868-5-git-send-email-anton.nefedov@virtuozzo.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510654613-47868-1-git-send-email-anton.nefedov@virtuozzo.com> References: <1510654613-47868-1-git-send-email-anton.nefedov@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: HE1PR0202CA0012.eurprd02.prod.outlook.com (2603:10a6:3:8c::22) To HE1PR0801MB1993.eurprd08.prod.outlook.com (2603:10a6:3:4f::23) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 49191c10-b529-4796-7856-08d52b48e574 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603258); SRVR:HE1PR0801MB1993; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB1993; 3:ZVnH7fBFXwANWFmrC/OrfkoHGqaMCy7QOuSor3dfCXXE7DwcbNCRx5wpZdar5xSuUELFrmgwNjhftg4j+FiyrC++ZQjfYgzKsJfTdHzfaeomMad6o8Ur8IfM0t2dKk7a5W8tLK9u9fglQfx2OdUmtKpOxcBS9YGlpbSGPx3l/pDU8iVw74BZi0LxemgUzTARGmJTPUY7RHltnZrXe5CDj86XSNAPGXJAh3P+qj7c5CqWMGcwnP42tx/TpTruP8EA; 25:YmrleHBW+gtfiVoZaqShsP3g9EYNV85LSOm7+mZNyNJZRL5Mix17ZcwiaGHdkLOsK2PpeqcAFfs/6oQTjke9QPk4R/PPLoJlAoWp1X5WnC6c5xJG8Y/SoAi1K6bfPvoWSkhsuU/e+/BPNeD0Zes6sH80FzH8/SKrNmoVHPMJ+sfcCYv6NQfoSQihLUViaC6Fc0r0yfvYWvpTpDWr2b9MWIr5AFy0o8z/566S6uGqlAJbQw6AyyxnuukR+UBar4Mv2mGiNpxf1M7oZZ4jn9MS7uHDMJJuC3ejZ3QcjQGcaFSJoq+BojqiqhaqNi1NoNEzjtg9O0ziti0lHP2tgmFwEmFW78gcUpMJ+lozuvCJiNc=; 31:5mR8XxPMpGRnzy6A6mrae6m9FmaGi+GG0VLhjMqi5Tf3eKBr2oYgN2u2gLp6g7HuCCRo0mzTB4XcWGRdStznLLNYpJqt7Ggha4MmQC3Z72Ec3zPYmU9rsjaqXGwWj592LlNSoUv0z5YLO8OGx/K8xkHVJZt9XlKNnQMlYlcHdbsgQd6nT4y30lPZzZK6steohRFRwEtyRljsvS4cprPBvzmFTpzczzxEgIVVe+S20To= X-MS-TrafficTypeDiagnostic: HE1PR0801MB1993: X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB1993; 20:7xzJK1tjnG7toKBgIhyHgV2VNUAi2ZXzK5BCot+eEMf+LV6BFEI4Ffl+RRwRCsY0u7P5k3dFC8PbldT5DM50ksxXyVUA/52lwKagI/jS0EEyrqm06PvUojbAU+olmD5A8YrK4puVvtjnATU0sAuCRYqublUYHaoryOQu5ZGmJ3QoXYIEYyfUKHUVK20eD+JnJtqcshCQTv4qBumMVAgf0N1APtTa1YodGiV26+HYSjLoFeLnaFdcSKj7X0F13hUKwztnpVYkY/aZXaSyZgf0jswIcmt+mO9GSA14bMB8xo+yEmMyqsmcEkupH9sHYm2R6uUwyyo5mXFxpMDyN993XXXqRq8p9GEnkRvZrk87OfoPkkWjN7qfhiceXwrgzQo5usz/drl6UvreAc6xpQbgo0LI4DMiaql5aHVbuHAdQKE=; 4:8Ye346jMRDjsIKvA78o1v8PIYbgpK5ni/3xO6APmgbjoI4KxITbIkvliPtoE5Xk/mEmY0tlkyeEvI+134KlLhPIqblaWFuXlzuwy+tYX4VYAo1nPPwUUry+2YDOUVGcPcnnd9DlI82s7wIJpNPL+LK2BnZtm3Sff8wUJ4RsgxGFtHIrj74DoCoE4mvoaN346i8KUJX+XPWzKhv4s0PQP1KgH1aNoF/JNw5FGevS+S3kmvOH77r8wHCUVFsoskfnOzQWVtHMYaYQUt4J4+fXmVA== 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)(5005006)(8121501046)(3231022)(3002001)(10201501046)(100000703101)(100105400095)(93006095)(93001095)(6041248)(20161123562025)(20161123558100)(20161123564025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:HE1PR0801MB1993; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:HE1PR0801MB1993; X-Forefront-PRVS: 04916EA04C X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(376002)(346002)(39830400002)(189002)(199003)(97736004)(5003940100001)(6916009)(3846002)(2361001)(5660300001)(69596002)(6116002)(8936002)(8676002)(81156014)(2950100002)(48376002)(33646002)(81166006)(2351001)(25786009)(6666003)(189998001)(50226002)(47776003)(575784001)(6506006)(16526018)(106356001)(105586002)(68736007)(478600001)(305945005)(36756003)(76176999)(50986999)(101416001)(316002)(16586007)(50466002)(4326008)(6512007)(2906002)(6486002)(53416004)(66066001)(53936002)(7736002)(7416002)(86362001); DIR:OUT; SFP:1102; SCL:1; SRVR:HE1PR0801MB1993; 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; HE1PR0801MB1993; 23:LHWVagkIX6xjQu0l5tjHsdyOTiS3Qf+gPotEqjy?= =?us-ascii?Q?bFCPxYlgNYdjcrT20h4eG/tcJpCMjJ8SnESZkibhuZjC76VaiugvtJ3oYls6?= =?us-ascii?Q?zj8bg39F+VgLGr6DdZYF+YqBDtv0wQoAdT1zHyKzP5/sDtiMl0pO6iYruodR?= =?us-ascii?Q?Yx10F6hs4Kp0Mg1Wl7mqjzSWZXfiosLMLOszgXsVfKw/HO4vlTQ8ISZR7oao?= =?us-ascii?Q?Pg40HCzpLSOYnaGKJbFnwUJm/whMOhQIvH6zPkEJ8wvEuB3o/XGshEd7/3K0?= =?us-ascii?Q?9zRlBcFxGnML7rxwAOWIehUm7Nxjc606+BfhlpWHijvqgUeluHO4JwD4F6KL?= =?us-ascii?Q?3BKtFngUvyxsCgGCawpr2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CgPd48Fc/GsvFCKoLPOGVUWeJw4N6Be4tQdy6wicVUKqhB9+rhWWWy8DzRQ6gaAcQapHQJgkiMyCx2AGDBBnZ+Cs6abg= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Nov 2017 10:17:22.3017 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 49191c10-b529-4796-7856-08d52b48e574 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0801MB1993 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.2.91 Subject: [Qemu-devel] [PATCH 4/5] 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, jcody@redhat.com, armbru@redhat.com, mreitz@redhat.com, stefanha@redhat.com, dgilbert@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Anton Nefedov --- 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..b0d022f 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, 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..18a56d9 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", + bdrv_get_device_name(bs)); + 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, },