From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60379) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vkrwd-0000st-O3 for qemu-devel@nongnu.org; Mon, 25 Nov 2013 03:55:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VkrwY-0003ap-5x for qemu-devel@nongnu.org; Mon, 25 Nov 2013 03:55:03 -0500 Received: from mail-wg0-x22c.google.com ([2a00:1450:400c:c00::22c]:42056) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VkrwX-0003af-VR for qemu-devel@nongnu.org; Mon, 25 Nov 2013 03:54:58 -0500 Received: by mail-wg0-f44.google.com with SMTP id a1so1632992wgh.11 for ; Mon, 25 Nov 2013 00:54:57 -0800 (PST) Sender: Paolo Bonzini Message-ID: <5293105E.9010705@redhat.com> Date: Mon, 25 Nov 2013 09:54:54 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1385368158-4364-1-git-send-email-pl@kamp.de> In-Reply-To: <1385368158-4364-1-git-send-email-pl@kamp.de> Content-Type: text/plain; charset=ISO-8859-1 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: Peter Lieven Cc: kwolf@redhat.com, stefanha@redhat.com, qemu-devel@nongnu.org, ronniesahlberg@gmail.com 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). Paolo