From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59893) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XIj7a-0003Yw-Ob for qemu-devel@nongnu.org; Sat, 16 Aug 2014 14:54:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XIj7Q-0001wN-Ti for qemu-devel@nongnu.org; Sat, 16 Aug 2014 14:54:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55677) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XIj7Q-0001wJ-Lm for qemu-devel@nongnu.org; Sat, 16 Aug 2014 14:54:24 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s7GIsNLK005360 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sat, 16 Aug 2014 14:54:24 -0400 From: Max Reitz Date: Sat, 16 Aug 2014 20:54:16 +0200 Message-Id: <1408215258-12545-2-git-send-email-mreitz@redhat.com> In-Reply-To: <1408215258-12545-1-git-send-email-mreitz@redhat.com> References: <1408215258-12545-1-git-send-email-mreitz@redhat.com> Subject: [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: qemu-devel@nongnu.org Cc: Kevin Wolf , Stefan Hajnoczi , Max Reitz 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. Signed-off-by: Max Reitz --- block.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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_status(BlockDriverState *bs, if (bs->file && (ret & BDRV_BLOCK_DATA) && !(ret & BDRV_BLOCK_ZERO) && (ret & BDRV_BLOCK_OFFSET_VALID)) { + int backing_pnum; + ret2 = bdrv_co_get_block_status(bs->file, ret >> BDRV_SECTOR_BITS, - *pnum, pnum); - if (ret2 >= 0) { + *pnum, &backing_pnum); + if (ret2 >= 0 && backing_pnum >= *pnum) { /* Ignore errors. This is just providing extra information, it * is useful but not necessary. */ -- 2.0.4