From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33513) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vks2a-0002t1-AO for qemu-devel@nongnu.org; Mon, 25 Nov 2013 04:01:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vks2U-0005RT-Nf for qemu-devel@nongnu.org; Mon, 25 Nov 2013 04:01:12 -0500 Received: from mx.ipv6.kamp.de ([2a02:248:0:51::16]:48464 helo=mx01.kamp.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vks2U-0005Pc-DP for qemu-devel@nongnu.org; Mon, 25 Nov 2013 04:01:06 -0500 Message-ID: <529311DB.5090909@kamp.de> Date: Mon, 25 Nov 2013 10:01:15 +0100 From: Peter Lieven MIME-Version: 1.0 References: <1385368158-4364-1-git-send-email-pl@kamp.de> <5293105E.9010705@redhat.com> In-Reply-To: <5293105E.9010705@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC][PATCH 1.8] block/iscsi: set bdi->cluster_size List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: kwolf@redhat.com, stefanha@redhat.com, qemu-devel@nongnu.org, ronniesahlberg@gmail.com On 25.11.2013 09:54, Paolo Bonzini wrote: > Il 25/11/2013 09:29, Peter Lieven ha scritto: >> this patch aims to set bdi->cluster_size to the internal page size >> of the iscsi target so that enabled callers can align requests >> properly. >> >> Signed-off-by: Peter Lieven >> --- >> block/iscsi.c | 6 ++++++ >> 1 file changed, 6 insertions(+) >> >> diff --git a/block/iscsi.c b/block/iscsi.c >> index b7b5238..3a4c5d4 100644 >> --- a/block/iscsi.c >> +++ b/block/iscsi.c >> @@ -1569,6 +1569,12 @@ static int iscsi_get_info(BlockDriverState *bs, BlockDriverInfo *bdi) >> IscsiLun *iscsilun = bs->opaque; >> bdi->unallocated_blocks_are_zero = !!iscsilun->lbprz; >> bdi->can_write_zeroes_with_unmap = iscsilun->lbprz && iscsilun->lbp.lbpws; >> + bdi->cluster_size = iscsilun->bl.opt_xfer_len * iscsilun->block_size; >> + /* if opt_xfer_len is not specified guess the internal page size of the >> + * iscsi target by the means of opt_unmap_gran */ >> + if (bdi->cluster_size == 0) { >> + bdi->cluster_size = iscsilun->bl.opt_unmap_gran * iscsilun->block_size; >> + } >> return 0; >> } >> >> > This is not what cluster_size does; cluster_size is the granularity of > allocations, and hence COW requests. In that sense, opt_unmap_gran is > probably a better choice than opt_xfer_len, especially if you want to > set the default cluster size of a new image (e.g. qcow2) so that the > format itself will not try to discard partial clusters. > > However, I'm not sure overloading cluster_size is a good thing; you can > already use discard_alignment. Also, I think you need some clamping > (e.g. if <4KB or >1MB). Maybe I should explain the background of this patch. I currently work on some patches optimizing qemu-img convert. And I found out that there is significant speed up if the writes to the output image are aligned to the underlying page boundaries of the iscsi_target. So I wanted to use bdi->cluster_size for aligning the requests if its available. The same that already happens for compressed images. Maybe I should put together the whole series maybe this gives a better picture. Peter