From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38351) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YpwSQ-0006QY-6F for qemu-devel@nongnu.org; Wed, 06 May 2015 06:21:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YpwSL-00079l-Hp for qemu-devel@nongnu.org; Wed, 06 May 2015 06:21:38 -0400 Message-ID: <5549EB23.70300@redhat.com> Date: Wed, 06 May 2015 12:21:23 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1430830009-29839-1-git-send-email-famz@redhat.com> <1430830009-29839-2-git-send-email-famz@redhat.com> <5548C071.1050805@redhat.com> <20150506014533.GA9341@fam-t430.nay.redhat.com> <5549D809.5070804@redhat.com> <20150506095048.GA9991@ad.nay.redhat.com> In-Reply-To: <20150506095048.GA9991@ad.nay.redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH 1/4] block: Fix dirty bitmap in bdrv_co_discard List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: Kevin Wolf , qemu-block@nongnu.org, qemu-devel@nongnu.org, Stefan Hajnoczi , jsnow@redhat.com, wangxiaolong@ucloud.cn 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.