From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:33868) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qbwg5-0003BV-1p for qemu-devel@nongnu.org; Wed, 29 Jun 2011 11:27:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qbwg3-0005UA-JC for qemu-devel@nongnu.org; Wed, 29 Jun 2011 11:27:44 -0400 Received: from mail-yi0-f45.google.com ([209.85.218.45]:39404) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qbwg3-0005Tx-2I for qemu-devel@nongnu.org; Wed, 29 Jun 2011 11:27:43 -0400 Received: by yia25 with SMTP id 25so606008yia.4 for ; Wed, 29 Jun 2011 08:27:41 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <1309224777-31024-13-git-send-email-famcool@gmail.com> References: <1309224777-31024-1-git-send-email-famcool@gmail.com> <1309224777-31024-13-git-send-email-famcool@gmail.com> Date: Wed, 29 Jun 2011 16:27:41 +0100 Message-ID: From: Stefan Hajnoczi Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v5 12/12] BlockDriver: add bdrv_get_allocated_file_size() operation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: kwolf@redhat.com, qemu-devel@nongnu.org, hch@lst.de On Tue, Jun 28, 2011 at 2:32 AM, Fam Zheng wrote: Please use "block:" as the commit message tag instead of BlockDriver. Usually the easiest way to find out which tag to use it by doing git-log(1) on the main file you have modified and looking at previous commit messages. > +static int64_t vmdk_get_allocated_file_size(BlockDriverState *bs) > +{ > + =A0 =A0int i; > + =A0 =A0int64_t ret =3D 0; > + =A0 =A0int64_t r; > + =A0 =A0BDRVVmdkState *s =3D bs->opaque; > + > + =A0 =A0ret =3D bdrv_get_allocated_file_size(bs->file); > + =A0 =A0if (ret < 0) { > + =A0 =A0 =A0 =A0return ret; > + =A0 =A0} > + =A0 =A0for (i =3D 0; i < s->num_extents; i++) { > + =A0 =A0 =A0 =A0r =3D bdrv_get_allocated_file_size(s->extents[i].file); > + =A0 =A0 =A0 =A0if (r < 0) { > + =A0 =A0 =A0 =A0 =A0 =A0return r; > + =A0 =A0 =A0 =A0} > + =A0 =A0 =A0 =A0ret +=3D r; > + =A0 =A0} > + =A0 =A0return ret; > +} Does this count bs->file twice for images without a separate descriptor fil= e? Stefan