From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36969) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKMUQ-0007RI-KN for qemu-devel@nongnu.org; Thu, 21 Aug 2014 03:09:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XKMUK-0006IL-F1 for qemu-devel@nongnu.org; Thu, 21 Aug 2014 03:08:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:1787) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKMUK-0006IB-6Y for qemu-devel@nongnu.org; Thu, 21 Aug 2014 03:08:48 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s7L78lIk022754 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 21 Aug 2014 03:08:47 -0400 Date: Thu, 21 Aug 2014 15:09:02 +0800 From: Fam Zheng Message-ID: <20140821070902.GL2943@T430.nay.redhat.com> References: <1408554429-22341-1-git-send-email-armbru@redhat.com> <20140821011523.GC2943@T430.nay.redhat.com> <8738cql4vo.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8738cql4vo.fsf@blackfin.pond.sub.org> Subject: Re: [Qemu-devel] [PATCH 1/1] vmdk: Use bdrv_nb_sectors() where sectors, not bytes are wanted List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: kwolf@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com On Thu, 08/21 08:43, Markus Armbruster wrote: > Fam Zheng writes: > > > On Wed, 08/20 19:07, Markus Armbruster wrote: > >> Instead of bdrv_getlength(). > >> > >> Commit 57322b7 did this all over block, but one more bdrv_getlength() > >> has crept in since. > >> > >> Signed-off-by: Markus Armbruster > >> --- > >> block/vmdk.c | 11 +++++------ > >> 1 file changed, 5 insertions(+), 6 deletions(-) > >> > >> diff --git a/block/vmdk.c b/block/vmdk.c > >> index 01412a8..3b74e85 100644 > >> --- a/block/vmdk.c > >> +++ b/block/vmdk.c > >> @@ -397,7 +397,7 @@ static int vmdk_add_extent(BlockDriverState *bs, > >> { > >> VmdkExtent *extent; > >> BDRVVmdkState *s = bs->opaque; > >> - int64_t length; > >> + int64_t nb_sectors; > >> > >> if (cluster_sectors > 0x200000) { > >> /* 0x200000 * 512Bytes = 1GB for one cluster is unrealistic */ > >> @@ -413,9 +413,9 @@ static int vmdk_add_extent(BlockDriverState *bs, > >> return -EFBIG; > >> } > >> > >> - length = bdrv_getlength(file); > >> - if (length < 0) { > >> - return length; > >> + nb_sectors = bdrv_getlength(file); > > > > Should be bdrv_nb_sectors. > > Brown paperbag... I shouldn't do "trivial" patches when tired. > > I wish "make check-block" covered a bit more, or there was something > that does while being trivial enough for me to run it unthinkingly. > The test case here would be "write a little more data to the image, assert that the file size (EOF offset) doesn't explode". :) Fam