From patchwork Thu Mar 23 13:28:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Denis V. Lunev" X-Patchwork-Id: 742663 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vpnTQ3dd0z9s2Q for ; Fri, 24 Mar 2017 00:29:30 +1100 (AEDT) Received: from localhost ([::1]:56495 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cr2nv-00021X-Un for incoming@patchwork.ozlabs.org; Thu, 23 Mar 2017 09:29:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33424) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cr2ne-00021E-Tp for qemu-devel@nongnu.org; Thu, 23 Mar 2017 09:29:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cr2nY-0006V1-Uv for qemu-devel@nongnu.org; Thu, 23 Mar 2017 09:29:10 -0400 Received: from mailhub.sw.ru ([195.214.232.25]:2918 helo=relay.sw.ru) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cr2nY-0006Tt-Jy for qemu-devel@nongnu.org; Thu, 23 Mar 2017 09:29:04 -0400 Received: from iris.sw.ru (msk-vpn.virtuozzo.com [195.214.232.6]) by relay.sw.ru (8.13.4/8.13.4) with ESMTP id v2NDSxSW031031; Thu, 23 Mar 2017 16:29:00 +0300 (MSK) From: "Denis V. Lunev" To: qemu-devel@nongnu.org Date: Thu, 23 Mar 2017 16:28:59 +0300 Message-Id: <1490275739-14940-1-git-send-email-den@openvz.org> X-Mailer: git-send-email 2.7.4 X-detected-operating-system: by eggs.gnu.org: OpenBSD 3.x [fuzzy] X-Received-From: 195.214.232.25 Subject: [Qemu-devel] [RFC 1/1] qcow2: add ZSTD compression feature 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: Kevin Wolf , "Denis V. Lunev" , Fam Zheng , Stefan Hajnoczi , Max Reitz Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" ZSDT compression algorithm consumes 3-5 times less CPU power with a comparable comression ratio with zlib. It would be wise to use it for data compression f.e. for backups. The patch adds incompatible ZSDT feature into QCOW2 header that indicates that compressed clusters must be decoded using ZSTD. Signed-off-by: Denis V. Lunev CC: Kevin Wolf CC: Max Reitz CC: Stefan Hajnoczi CC: Fam Zheng --- Actually this is very straightforward. May be we should implement 2 stage scheme, i.e. add bit that indicates presence of the "compression extension", which will actually define the compression algorithm. Though at my opinion we will not have too many compression algorithms and proposed one tier scheme is good enough. docs/specs/qcow2.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/specs/qcow2.txt b/docs/specs/qcow2.txt index 80cdfd0..eb5c41b 100644 --- a/docs/specs/qcow2.txt +++ b/docs/specs/qcow2.txt @@ -85,7 +85,10 @@ in the description of a field. be written to (unless for regaining consistency). - Bits 2-63: Reserved (set to 0) + Bits 2: ZSDT compression bit. ZSDT algorithm is used + for cluster compression/decompression. + + Bits 3-63: Reserved (set to 0) 80 - 87: compatible_features Bitmask of compatible features. An implementation can