Received: from eggs.gnu.org ([2001:4830:134:3::10]:33012) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XcYkY-0005vG-QY for qemu-devel@nongnu.org; Fri, 10 Oct 2014 07:52:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XcYkS-0005uL-M8 for qemu-devel@nongnu.org; Fri, 10 Oct 2014 07:52:46 -0400 Received: from lputeaux-656-01-25-125.w80-12.abo.wanadoo.fr ([80.12.84.125]:58574 helo=paradis.irqsave.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XcYkS-0005uD-Fn for qemu-devel@nongnu.org; Fri, 10 Oct 2014 07:52:40 -0400 Date: Fri, 10 Oct 2014 13:50:11 +0200 From: =?iso-8859-1?Q?Beno=EEt?= Canet Message-ID: <20141010115011.GB10091@irqsave.net> References: <1408215258-12545-1-git-send-email-mreitz@redhat.com> <1408215258-12545-2-git-send-email-mreitz@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <1408215258-12545-2-git-send-email-mreitz@redhat.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 1/3] block: Ignore allocation size in underlying file List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz Cc: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi The Saturday 16 Aug 2014 =E0 20:54:16 (+0200), Max Reitz wrote : > When falling through to the underlying file in > bdrv_co_get_block_status(), do not let the number of sectors for which > information could be obtained be overwritten. >=20 > Signed-off-by: Max Reitz > --- > block.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) >=20 > diff --git a/block.c b/block.c > index 3e252a2..c922664 100644 > --- a/block.c > +++ b/block.c > @@ -3991,9 +3991,11 @@ static int64_t coroutine_fn bdrv_co_get_block_st= atus(BlockDriverState *bs, > if (bs->file && > (ret & BDRV_BLOCK_DATA) && !(ret & BDRV_BLOCK_ZERO) && > (ret & BDRV_BLOCK_OFFSET_VALID)) { > + int backing_pnum; > + > ret2 =3D bdrv_co_get_block_status(bs->file, ret >> BDRV_SECTOR= _BITS, > - *pnum, pnum); > - if (ret2 >=3D 0) { > + *pnum, &backing_pnum); > + if (ret2 >=3D 0 && backing_pnum >=3D *pnum) { About backing_pnum >=3D *pnum. The documentation of bdrv_co_get_block_status says: * 'nb_sectors' is the max value 'pnum' should be set to. If nb_sectors = goes =20 * beyond the end of the disk image it will be clamped. = =20 */ = =20 static int64_t coroutine_fn bdrv_co_get_block_status(BlockDriverState *bs= , =20 int64_t sector_num, = =20 int nb_sectors, int = *pnum)=20 So clearly after the bdrv_co_get_block_status *pnum >=3D backing_pnum. This means that backing_pnum > *pnum will never happen. I think either this test is wrong or the doc is wrong. Best regards Beno=EEt > /* Ignore errors. This is just providing extra informatio= n, it > * is useful but not necessary. > */ > --=20 > 2.0.4 >=20 >=20