From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51349) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aW4xm-0008GQ-If for qemu-devel@nongnu.org; Wed, 17 Feb 2016 11:28:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aW4xj-0007jx-4P for qemu-devel@nongnu.org; Wed, 17 Feb 2016 11:28:26 -0500 Received: from mx2.parallels.com ([199.115.105.18]:43182) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aW4xi-0007iz-UE for qemu-devel@nongnu.org; Wed, 17 Feb 2016 11:28:23 -0500 References: <1455721691-14802-1-git-send-email-den@openvz.org> <56C48FEC.7010901@redhat.com> From: "Denis V. Lunev" Message-ID: <56C49F9B.8090902@openvz.org> Date: Wed, 17 Feb 2016 19:28:11 +0300 MIME-Version: 1.0 In-Reply-To: <56C48FEC.7010901@redhat.com> Content-Type: text/plain; charset="iso-8859-15"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/1] nbd: fix block-mirror NBD target List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz Cc: Paolo Bonzini , qemu-devel@nongnu.org On 02/17/2016 06:21 PM, Max Reitz wrote: > On 17.02.2016 16:08, Denis V. Lunev wrote: >> There is VM with 8 GB QCOW2 storage. Real size of the image file is 2 GB. >> 'drive-mirror' redirected to NBD target creates 8 GB image at destination. >> The situation is even worse as zeroes are sent through the channel. >> >> The patch simply adds .bdrv_co_write_zeroes callback to NBD block driver >> which works though NBD_TRIM to avoid transfer of zeroes. > The specification[1] says the following about TRIM: > >> After issuing this command, a client MUST NOT make any assumptions >> about the contents of the export affected by this command, until >> overwriting it again with NBD_CMD_WRITE. > So I don't think this is correct. > > The correct solution would probably to introduce a specific command to > write zeroes, or at least to use detect-zeroes on the NBD server side > (but this will still lead to the zeroes being sent over the line). > > Max > > [1] https://github.com/yoe/nbd/blob/master/doc/proto.md > >> Signed-off-by: Denis V. Lunev >> CC: Paolo Bonzini >> --- >> block/nbd-client.c | 10 ++++++++++ >> block/nbd-client.h | 2 ++ >> block/nbd.c | 9 +++++++++ >> 3 files changed, 21 insertions(+) > This sounds not that good. OK. At least there is correct lengthy way for this. White-outs must be supported by the protocol. Den