qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Lieven <pl@kamp.de>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: kwolf@redhat.com, stefanha@redhat.com, qemu-devel@nongnu.org,
	ronniesahlberg@gmail.com
Subject: Re: [Qemu-devel] [RFC][PATCH 1.8] block/iscsi: set bdi->cluster_size
Date: Mon, 25 Nov 2013 10:01:15 +0100	[thread overview]
Message-ID: <529311DB.5090909@kamp.de> (raw)
In-Reply-To: <5293105E.9010705@redhat.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 <pl@kamp.de>
>> ---
>>   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

      reply	other threads:[~2013-11-25  9:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-25  8:29 [Qemu-devel] [RFC][PATCH 1.8] block/iscsi: set bdi->cluster_size Peter Lieven
2013-11-25  8:54 ` Paolo Bonzini
2013-11-25  9:01   ` Peter Lieven [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=529311DB.5090909@kamp.de \
    --to=pl@kamp.de \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=ronniesahlberg@gmail.com \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).