From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33989) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VLX0y-0002id-8u for qemu-devel@nongnu.org; Mon, 16 Sep 2013 07:30:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VLX0p-0002Vf-JS for qemu-devel@nongnu.org; Mon, 16 Sep 2013 07:30:48 -0400 Received: from mx.ipv6.kamp.de ([2a02:248:0:51::16]:33066 helo=mx01.kamp.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VLX0o-0002VG-Tv for qemu-devel@nongnu.org; Mon, 16 Sep 2013 07:30:39 -0400 Message-ID: <5236EBD1.3000506@kamp.de> Date: Mon, 16 Sep 2013 13:30:25 +0200 From: Peter Lieven MIME-Version: 1.0 References: <1379067909-22984-1-git-send-email-pl@kamp.de> <1379067909-22984-6-git-send-email-pl@kamp.de> <5232EA41.3030607@redhat.com> <5232EC9C.2060301@kamp.de> <5232FAC7.7030001@redhat.com> In-Reply-To: <5232FAC7.7030001@redhat.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 05/12] block: add logical block provisioning information to BlockDriverInfo List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: kwolf@redhat.com, ronniesahlberg@gmail.com, stefanha@redhat.com, qemu-devel@nongnu.org, anthony@codemonkey.ws On 13.09.2013 13:45, Paolo Bonzini wrote: > Il 13/09/2013 12:44, Peter Lieven ha scritto: >> On 13.09.2013 12:34, Paolo Bonzini wrote: >>> Il 13/09/2013 12:25, Peter Lieven ha scritto: >>>> + /* maximum number of sectors that can be discarded at once */ >>>> + int max_discard; >>>> + /* maximum number of sectors that can zeroized at once */ >>>> + int max_write_zeroes; >>> These should not be needed outside the driver. >>> >>> If you want to make them private between block.c and block/iscsi.c, you >>> can add them to BlockDriverState. >> The question is, if the discard_zeroes or discard_write_zeroes is needed >> outside the driver as well? >> >> I can put the max_* information in the block driver state. I also thought >> to add alignment and granularity information even if they are currently >> not yet used. > Yeah, in fact bdrv_write_zeroes and bdrv_discard can be taught to split > requests according to these parameters instead of introducing a new > function bdrv_zeroize. You don't need bdrv_zeroize I think; you can > simply use bdrv_write_zeroes. This is why I don't like this information > in BlockDriverInfo. > > On the contrary, discard_write_zeroes is useful to "generic" clients, > and your qemu-img patch shows why. > > Discard_zeroes is somewhere in the middle. You only use it in > bdrv_get_block_status, but it is not something that should be hidden to > users of the high-level block.c API. So it is fine to leave it in > BlockDriverInfo. Would you also be ok to introduce bdrv_has_discard_zeroes() and bdrv_has_discard_write_zeroes() as Kevin suggested to avoid the need to add the logic to return 0 if there is a bs->backing_hd everywhere. This would also make the use of it easier as it avoids the steps necessary to invoke bdrv_get_info(). Peter