From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57418) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b7qys-0002sA-SC for qemu-devel@nongnu.org; Tue, 31 May 2016 17:13:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b7qyo-00051u-IW for qemu-devel@nongnu.org; Tue, 31 May 2016 17:13:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57490) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b7qyo-00051m-Ah for qemu-devel@nongnu.org; Tue, 31 May 2016 17:13:38 -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> <574DFB7D.6010205@openvz.org> From: Eric Blake Message-ID: <574DFE80.9030802@redhat.com> Date: Tue, 31 May 2016 15:13:36 -0600 MIME-Version: 1.0 In-Reply-To: <574DFB7D.6010205@openvz.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="EKWEd3cBRAFsnNVg7bdBNt5IxeaVNrL1H" 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: "Denis V. Lunev" , Pavel Butsykin , Stefan Hajnoczi Cc: Kevin Wolf , Jeff Cody , qemu-devel@nongnu.org, Markus Armbruster , Stefan Hajnoczi , John Snow This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --EKWEd3cBRAFsnNVg7bdBNt5IxeaVNrL1H Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 05/31/2016 03:00 PM, Denis V. Lunev wrote: > 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 =3D 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 alloca= ted >>> 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 IIRC, on the NTFS file system, the minimum hole size is 64k. If you also have 64k clusters, then you don't have a sparse file - every tail of zero sectors will be explicit in the filesystem, if you are using 1:1 clusters for compression. Other file systems may have finer granularity for holes, but it's still rather awkward to be relying on sparseness when a better solution is to pack compressed sectors consecutively. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --EKWEd3cBRAFsnNVg7bdBNt5IxeaVNrL1H Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJXTf6AAAoJEKeha0olJ0NqOwIH/1kKdzZ3tkbPwuZWVexFgmQG BZv9N1odd2EPUfWC+mNiJALv5NhN/sM9ARxyLD9F2mtKQxFofwcwPP2fRtpTEg32 kQnNUcZBceRMjmgw1igrCO83B5ZGwup3yIApKpxkZq93rS7s9YbjLBDaCv7dLHQQ IE8Q3WSJkspFXFGKDl3eusmy7tGnC4cq2Xk3TJtnOE4PbmrMEtC8trcoh82QbJt+ Nj6tuRlzFVsXANC07Ghm1aquvpje4BPQgArOEDoENSz3vAmZ+PVrCRd20i4O10/w XHWRHv0Z7LQtpEmnrKBYpn0S2I1szfN0P1aKujKr0mnONKQJK0dGsFYNovRYrdM= =Oqh2 -----END PGP SIGNATURE----- --EKWEd3cBRAFsnNVg7bdBNt5IxeaVNrL1H--