Received: from eggs.gnu.org ([2001:4830:134:3::10]:40145) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFH30-0005Ga-TN for qemu-devel@nongnu.org; Thu, 16 Nov 2017 05:05:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eFH2w-0008El-SM for qemu-devel@nongnu.org; Thu, 16 Nov 2017 05:05:26 -0500 References: <1510654613-47868-1-git-send-email-anton.nefedov@virtuozzo.com> <1510654613-47868-4-git-send-email-anton.nefedov@virtuozzo.com> From: Anton Nefedov Message-ID: Date: Thu, 16 Nov 2017 13:05:09 +0300 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 3/5] block: support compressed write for copy-on-read List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz , qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, kwolf@redhat.com, eblake@redhat.com, stefanha@redhat.com, famz@redhat.com, den@virtuozzo.com On 15/11/2017 9:49 PM, Max Reitz wrote: > On 2017-11-14 11:16, Anton Nefedov wrote: >> Signed-off-by: Anton Nefedov >> --- >> block/io.c | 30 ++++++++++++++++++++++++------ >> block/trace-events | 2 +- >> 2 files changed, 25 insertions(+), 7 deletions(-) >> >> diff --git a/block/io.c b/block/io.c >> index 3d5ef2c..93c6b24 100644 >> --- a/block/io.c >> +++ b/block/io.c > > [...] > >> @@ -1209,6 +1220,13 @@ int coroutine_fn bdrv_co_preadv(BdrvChild *child, >> return ret; >> } >> >> + /* write compressed only makes sense with copy on read */ >> + if ((flags & BDRV_REQ_WRITE_COMPRESSED) && >> + !(flags & BDRV_REQ_COPY_ON_READ)) >> + { >> + return -EINVAL; >> + } >> + > > I think the assertion in bdrv_aligned_preadv() should be enough, but > either way: > > Reviewed-by: Max Reitz > Ok, and it will fail more loudly. Will remove. >> bdrv_inc_in_flight(bs); >> >> /* Don't do copy-on-read if we read data before write operation */ >