qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Fam Zheng <famz@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	qemu-block@nongnu.org, qemu-devel@nongnu.org,
	Stefan Hajnoczi <stefanha@redhat.com>,
	jsnow@redhat.com, wangxiaolong@ucloud.cn
Subject: Re: [Qemu-devel] [PATCH 1/4] block: Fix dirty bitmap in bdrv_co_discard
Date: Wed, 06 May 2015 12:21:23 +0200	[thread overview]
Message-ID: <5549EB23.70300@redhat.com> (raw)
In-Reply-To: <20150506095048.GA9991@ad.nay.redhat.com>



On 06/05/2015 11:50, Fam Zheng wrote:
>  #   src can_write_zeroes_with_unmap       target can_write_zeroes_with_unmap
> --------------------------------------------------------------------------------
>  1              true                                   true
>  2              true                                   false
>  3              false                                  true
>  4              false                                  false

1 should replicate WRITE SAME, in case the unmap granularity of the
target is different from that of the source.  In that case, a discard on
the target might leave some sectors untouched.  Writing zeroes would
ensure matching data between the source and the target.

2 should _not_ discard: it should write zeroes even at the cost of
making the target fully provisioned.  Perhaps you can optimize it by
looking at bdrv_get_block_status for the target, and checking the answer
for BDRV_ZERO.

3 and 4 can use discard on the target.

So it looks like only the source setting matters.

We need to check the cost of bdrv_co_get_block_status for "raw", too.
If it's too expensive, that can be a problem.

Paolo

> For case 2 & 3 it's probably better to mirror the actual reading of source.
> 
> I'm not sure about 4.

Even in case 1, discard could be "UNMAP" and write zeroes could be
"WRITE SAME".  If the unmap granularity of the target is For unaligned
sectors, UNMAP might leave some sectors aside while WRITE SAME will
write with zeroes.

  reply	other threads:[~2015-05-06 10:21 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-05 12:46 [Qemu-devel] [PATCH 0/4] block: Mirror discarded sectors Fam Zheng
2015-05-05 12:46 ` [Qemu-devel] [PATCH 1/4] block: Fix dirty bitmap in bdrv_co_discard Fam Zheng
2015-05-05 13:06   ` Paolo Bonzini
2015-05-06  1:45     ` Fam Zheng
2015-05-06  8:59       ` Paolo Bonzini
2015-05-06  9:50         ` Fam Zheng
2015-05-06 10:21           ` Paolo Bonzini [this message]
2015-05-11  8:02             ` Fam Zheng
2015-05-11  8:33               ` Paolo Bonzini
2015-05-05 12:46 ` [Qemu-devel] [PATCH 2/4] block: Remove bdrv_reset_dirty Fam Zheng
2015-05-05 21:57   ` Eric Blake
2015-05-05 12:46 ` [Qemu-devel] [PATCH 3/4] qemu-iotests: Make block job methods common Fam Zheng
2015-05-05 22:17   ` John Snow
2015-05-06  1:48     ` Fam Zheng
2015-05-05 12:46 ` [Qemu-devel] [PATCH 4/4] qemu-iotests: Add test case for mirror with unmap Fam Zheng

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=5549EB23.70300@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=famz@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=wangxiaolong@ucloud.cn \
    /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).