From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38706) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ya3SJ-0001zt-5E for qemu-devel@nongnu.org; Mon, 23 Mar 2015 10:35:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ya3SG-0007D0-3O for qemu-devel@nongnu.org; Mon, 23 Mar 2015 10:35:51 -0400 Received: from mx-v6.kamp.de ([2a02:248:0:51::16]:50794 helo=mx01.kamp.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ya3SF-0007CR-Pa for qemu-devel@nongnu.org; Mon, 23 Mar 2015 10:35:48 -0400 Message-ID: <551024BE.1050506@kamp.de> Date: Mon, 23 Mar 2015 15:35:42 +0100 From: Peter Lieven MIME-Version: 1.0 References: <1427085970-23823-1-git-send-email-famz@redhat.com> <1427085970-23823-2-git-send-email-famz@redhat.com> <20150323141443.GJ9268@stefanha-thinkpad.redhat.com> In-Reply-To: <20150323141443.GJ9268@stefanha-thinkpad.redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [Qemu-stable] [PATCH 1/2] block: Fix unaligned zero write List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi , Fam Zheng Cc: Kevin Wolf , qemu-block@nongnu.org, qemu-devel@nongnu.org, Stefan Hajnoczi , qemu-stable@nongnu.org Am 23.03.2015 um 15:14 schrieb Stefan Hajnoczi: > On Mon, Mar 23, 2015 at 12:46:09PM +0800, Fam Zheng wrote: >> @@ -3435,6 +3446,10 @@ static int coroutine_fn bdrv_co_do_pwritev(BlockDriverState *bs, >> bytes = ROUND_UP(bytes, align); >> } >> >> + if (use_local_qiov) { >> + /* Local buffer may have non-zero data. */ >> + flags &= ~BDRV_REQ_ZERO_WRITE; >> + } >> ret = bdrv_aligned_pwritev(bs, &req, offset, bytes, >> use_local_qiov ? &local_qiov : qiov, >> flags); >> @@ -3475,14 +3490,32 @@ int coroutine_fn bdrv_co_write_zeroes(BlockDriverState *bs, >> int64_t sector_num, int nb_sectors, >> BdrvRequestFlags flags) >> { >> + int ret; >> + >> trace_bdrv_co_write_zeroes(bs, sector_num, nb_sectors, flags); >> >> - if (!(bs->open_flags & BDRV_O_UNMAP)) { >> - flags &= ~BDRV_REQ_MAY_UNMAP; >> - } > Why is it okay to drop this when the request is aligned? I also think it is not. This is the only point in the code that clears the MAY_UNMAP flag when we do not open with discard=on Peter