From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54468) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b7qmX-0003uP-Jb for qemu-devel@nongnu.org; Tue, 31 May 2016 17:00:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b7qmT-0002NG-Gk for qemu-devel@nongnu.org; Tue, 31 May 2016 17:00:57 -0400 Received: from mail-db3on0146.outbound.protection.outlook.com ([157.55.234.146]:27191 helo=emea01-db3-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b7qmS-0002N4-QL for qemu-devel@nongnu.org; Tue, 31 May 2016 17:00:53 -0400 References: <1463229957-14253-1-git-send-email-den@openvz.org> <1463229957-14253-3-git-send-email-den@openvz.org> <20160527173335.GF27946@stefanha-x1.localdomain> <574C0404.9040507@virtuozzo.com> <574C38D9.8020709@virtuozzo.com> <574DDB2E.9070801@redhat.com> From: "Denis V. Lunev" Message-ID: <574DFB7D.6010205@openvz.org> Date: Wed, 1 Jun 2016 00:00:45 +0300 MIME-Version: 1.0 In-Reply-To: <574DDB2E.9070801@redhat.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 02/10] qcow2: add qcow2_co_write_compressed List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake , Pavel Butsykin , Stefan Hajnoczi Cc: Kevin Wolf , Jeff Cody , qemu-devel@nongnu.org, Markus Armbruster , Stefan Hajnoczi , John Snow On 05/31/2016 09:42 PM, Eric Blake wrote: > On 05/30/2016 06:58 AM, Pavel Butsykin wrote: > >> Sorry, but it seems this will never happen, because the second write >> will not pass this check: >> >> uint64_t qcow2_alloc_compressed_cluster_offset(BlockDriverState *bs, >> uint64_t offset, >> int compressed_size) >> { >> ... >> /* Compression can't overwrite anything. Fail if the cluster was >> already >> * allocated. */ >> cluster_offset = be64_to_cpu(l2_table[l2_index]); >> if (cluster_offset & L2E_OFFSET_MASK) { >> qcow2_cache_put(bs, s->l2_table_cache, (void**) &l2_table); >> return 0; >> } >> ... >> >> As you can see we can't do the compressed write in the already allocated >> cluster. > Umm, doesn't that defeat the point of compression, if every compressed > cluster becomes the head of a new cluster? The whole goal of > compression is to be able to fit multiple clusters within one. > AFAIK the file will be sparse in that unused areas