From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38546) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UzOw0-0002kF-MX for qemu-devel@nongnu.org; Wed, 17 Jul 2013 06:26:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UzOvy-00064m-7w for qemu-devel@nongnu.org; Wed, 17 Jul 2013 06:26:12 -0400 Received: from ssl.dlhnet.de ([91.198.192.8]:48094 helo=ssl.dlh.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UzOvx-00064g-Vm for qemu-devel@nongnu.org; Wed, 17 Jul 2013 06:26:10 -0400 Content-Type: text/plain; charset=iso-8859-1 Mime-Version: 1.0 (Mac OS X Mail 6.3 \(1503\)) From: Peter Lieven In-Reply-To: <51E4F3F0.9030200@redhat.com> Date: Wed, 17 Jul 2013 12:26:12 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <8087D627-B40A-43E3-8070-1BC0371CBE84@kamp.de> References: <1372862071-28225-1-git-send-email-pbonzini@redhat.com> <1372862071-28225-17-git-send-email-pbonzini@redhat.com> <51E4EC9C.70602@kamp.de> <51E4F3F0.9030200@redhat.com> Subject: Re: [Qemu-devel] [PATCH 16/17] block: add default get_block_status implementation for protocols List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: kwolf@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com Am 16.07.2013 um 09:19 schrieb Paolo Bonzini : > Il 16/07/2013 08:47, Peter Lieven ha scritto: >>>=20 >>> @@ -2977,7 +2977,11 @@ static int64_t coroutine_fn >>> bdrv_co_get_block_status(BlockDriverState *bs, >>> if (!bs->drv->bdrv_co_get_block_status) { >>> *pnum =3D nb_sectors; >>> - return BDRV_BLOCK_DATA; >>> + ret =3D BDRV_BLOCK_DATA; >>> + if (bs->drv->protocol_name) { >>> + ret |=3D BDRV_BLOCK_OFFSET_VALID | (sector_num * >>> BDRV_SECTOR_SIZE); >>> + } >>> + return ret; >>> } >>> ret =3D bs->drv->bdrv_co_get_block_status(bs, sector_num, >>> nb_sectors, pnum); >> I am curious if this is right. Doesn't this mean we say that at = offset >> sector_num * BDRV_SECTOR_SIZE are nb_sectors of linear data? This is >> something we do not know for sure. >=20 > Only for protocols. In this case, we do know, or format=3Draw = wouldn't > work. This is not propagated up to the actual BDS for the image, = except > for format=3Draw. Wouldn't it be better to add this general tweak in to = raw_co_is_allocated rather than at the block level? What you write above is true, but you will never know what will happen = in the future. For raw this tweak is right, but for anything developed in the = future it might not be and in the end nobody remembers to fix it at this = position. I was just thinking of the has_zero_init =3D 1 thing. At the time it was = written the code was correct and then came more and more extensions like extends on a block device or iscsi and nobody remembered. Peter=