From patchwork Fri Jun 8 19:20:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 926992 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 AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 412XMV1hKzz9s0W for ; Sat, 9 Jun 2018 05:21:26 +1000 (AEST) Received: from localhost ([::1]:37772 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRMwt-0006h3-OB for incoming@patchwork.ozlabs.org; Fri, 08 Jun 2018 15:21:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38860) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRMwA-0006fN-43 for qemu-devel@nongnu.org; Fri, 08 Jun 2018 15:20:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fRMw5-0004mD-6W for qemu-devel@nongnu.org; Fri, 08 Jun 2018 15:20:38 -0400 Received: from relay.sw.ru ([195.214.232.25]:46434) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fRMw4-0004k9-TG; Fri, 08 Jun 2018 15:20:33 -0400 Received: from msk-vpn.virtuozzo.com ([195.214.232.6] helo=kvm.sw.ru) by relay.sw.ru with esmtp (Exim 4.90_1) (envelope-from ) id 1fRMw0-0000OY-5N; Fri, 08 Jun 2018 22:20:28 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Fri, 8 Jun 2018 22:20:24 +0300 Message-Id: <20180608192027.284601-1-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.11.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 195.214.232.25 Subject: [Qemu-devel] [PATCH 0/3] qcow2 compress threads 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, stefanha@gmail.com, pl@kamp.de, mreitz@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Hi all! Here are compress threads for qcow2, to increase performance of compressed writes. I've created the following test: []# cat ../gen.sh #!/bin/bash echo 'create pattern-file t_pat' ./qemu-img create -f raw t_pat 1000m ./qemu-io -c 'write -P 0xab 0 1000m' t_pat echo 'create randod t_rand' dd if=/dev/urandom of=t_rand bs=1M count=1000 []# cat ../test.sh #!/bin/bash rm -f t_out echo 'test pattern-file compression' time ./qemu-img convert -W -f raw -O qcow2 -c t_pat t_out rm -f t_out echo 'test random-file compression' time ./qemu-img convert -W -f raw -O qcow2 -c t_rand t_out rm -f t_out and results before the series (and without -W flag): test pattern-file compression real 0m16.658s user 0m16.450s sys 0m0.628s test random-file compression real 0m24.194s user 0m24.361s sys 0m0.395s results with -W flag, after first patch: test pattern-file compression real 0m16.242s user 0m16.895s sys 0m0.080s test random-file compression real 0m23.450s user 0m23.767s sys 0m1.085s results with -W flag, after third patch: test pattern-file compression real 0m5.747s user 0m22.637s sys 0m0.393s test random-file compression real 0m8.402s user 0m33.315s sys 0m0.926s So, we see significant performance gain. But this of course don't work without -W flag. results without -W flag, after third patch: test pattern-file compression real 0m16.908s user 0m16.775s sys 0m0.589s test random-file compression real 0m24.913s user 0m24.586s sys 0m0.898s Note: my cpu is 4-cores 8-threads i7-4790 Vladimir Sementsov-Ogievskiy (3): qemu-img: allow compressed not-in-order writes qcow2: refactor data compression qcow2: add compress threads block/qcow2.h | 3 ++ block/qcow2.c | 134 ++++++++++++++++++++++++++++++++++++++++++++++------------ qemu-img.c | 5 --- 3 files changed, 110 insertions(+), 32 deletions(-)