From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53872) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XBmaJ-000412-8W for qemu-devel@nongnu.org; Mon, 28 Jul 2014 11:11:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XBma7-0000tU-51 for qemu-devel@nongnu.org; Mon, 28 Jul 2014 11:11:31 -0400 Received: from mail-wg0-x230.google.com ([2a00:1450:400c:c00::230]:40185) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XBma6-0000t0-U5 for qemu-devel@nongnu.org; Mon, 28 Jul 2014 11:11:19 -0400 Received: by mail-wg0-f48.google.com with SMTP id x13so7394778wgg.31 for ; Mon, 28 Jul 2014 08:11:15 -0700 (PDT) Date: Mon, 28 Jul 2014 16:11:10 +0100 From: Stefan Hajnoczi Message-ID: <20140728151110.GG13872@stefanha-thinkpad.redhat.com> References: <1401180562-29680-1-git-send-email-famz@redhat.com> <1401180562-29680-3-git-send-email-famz@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="1giRMj6yz/+FOIRq" Content-Disposition: inline In-Reply-To: <1401180562-29680-3-git-send-email-famz@redhat.com> Subject: Re: [Qemu-devel] [PATCH v5 2/2] vmdk: Optimize cluster allocation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi --1giRMj6yz/+FOIRq Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, May 27, 2014 at 04:49:22PM +0800, Fam Zheng wrote: > + if (!bs->backing_hd) { > + memset(whole_grain, 0, skip_start_sector << BDRV_SECTOR_BITS); > + memset(whole_grain + (skip_end_sector << BDRV_SECTOR_BITS), 0, > + cluster_bytes - (skip_end_sector << BDRV_SECTOR_BITS)); > + } > + > + assert(skip_end_sector <= sector_num + extent->cluster_sectors); Does this assertion make sense? skip_end_sector is a small number of sectors (relative to start of cluster), while sector_num + extent->cluster_sectors is a large absolute sector offset. > +/** > + * get_cluster_offset > + * > + * Look up cluster offset in extent file by sector number, and store in > + * @cluster_offset. > + * > + * For flat extent, the start offset as parsed from the description file is s/extent/extents/ > + * returned. > + * > + * For sparse extent, look up in L1, L2 table. If allocate is true, return an s/extent/extents/ > + * offset for a new cluster and update L2 cache. If there is a backing file, > + * COW is done before returning; otherwise, zeroes are written to the allocated > + * cluster. Both COW and zero writting skips the sector range s/writting/writing/ --1giRMj6yz/+FOIRq Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJT1mgOAAoJEJykq7OBq3PI2p8H/ieawamK+nTDHW/iGiKlepFG mKjWkkCKUvyqCYDGcV74E24dWB91DWo8CzQCAAour3V0AhqeKNa8sbv630emYnjr kzg3uAu+kv22Q0HJAhFj9Taa4XZGMhikCBZZXJf2afDKDJb6g5nqOYjCciYKYHEi Lwaa3wgrom+p83/3KaWpgHY53huSfwmqgGAtVfKxsGkC8dvLuVY4w36is9EAn9Qn bj6b/JpA1HLV42WQ4W71Ar5lqziM4aAXmZTLf6SE+cxIOa6qCN7nB2ne+r75CS4N fII1TGd0x2S0JDs1VvkHBw4YYm2NVPlzGzjbrkYR/kXoU6mxjbZkPDZPHQXmNOI= =vZqc -----END PGP SIGNATURE----- --1giRMj6yz/+FOIRq--