qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Zhenyu Ye <yezhenyu2@huawei.com>
To: Eric Blake <eblake@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	qemu-block@nongnu.org, pl@kamp.de, qemu-devel@nongnu.org,
	Xiexiangyou <xiexiangyou@huawei.com>,
	mreitz@redhat.com, zhengchuan <zhengchuan@huawei.com>,
	lichuan18@huawei.com
Subject: Re: [Question] qemu-img convert block alignment
Date: Wed, 4 Aug 2021 15:18:59 +0800	[thread overview]
Message-ID: <3e4b8fb0-0d3b-a99b-c603-ac3f0b0d3d9d@huawei.com> (raw)
In-Reply-To: <20210803150316.eo5gm3xqxuetqahq@redhat.com>

On 2021/8/3 23:03, Eric Blake wrote:
> On Fri, Apr 02, 2021 at 11:52:25AM +0800, Zhenyu Ye wrote:
>> Hi all,
>>
>> commit 8dcd3c9b91 ("qemu-img: align result of is_allocated_sectors")
>> introduces block alignment when doing qemu-img convert. However, the
>> alignment is:
>>
>> 	s.alignment = MAX(pow2floor(s.min_sparse),
>>                       DIV_ROUND_UP(out_bs->bl.request_alignment,
>>                                    BDRV_SECTOR_SIZE));
>>
>> (where the default s.min_sparse is 8)
>> When the target device's bl.request_alignment is smaller than 4K, this
>> will cause additional write-zero overhead and makes the size of target
>> file larger.
>>
>> Is this as expected?  Should we change the MAX() to MIN()?
> 
> Yes it is expected, and no we shouldn't change it.  Even when a target
> advertises a bl.request_alignment of 512, our goal is to avoid needing
> read-modify-write cycles when that target is really on top of a 4k
> sector disk.  Writing extra 0s out to the 4k boundaries does not
> change the fact that allocation is in 4k chunks anyways, regardless of
> whether the disk supports smaller 512-byte reads.
> 

Thanks for your reply.

Zhenyu


      reply	other threads:[~2021-08-04  7:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-02  3:52 [Question] qemu-img convert block alignment Zhenyu Ye
2021-08-03  1:53 ` Zhenyu Ye
2021-08-03 15:03 ` Eric Blake
2021-08-04  7:18   ` Zhenyu Ye [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=3e4b8fb0-0d3b-a99b-c603-ac3f0b0d3d9d@huawei.com \
    --to=yezhenyu2@huawei.com \
    --cc=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=lichuan18@huawei.com \
    --cc=mreitz@redhat.com \
    --cc=pl@kamp.de \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=xiexiangyou@huawei.com \
    --cc=zhengchuan@huawei.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).