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 <d...@openvz.org>
> CC: Paolo Bonzini <pbonz...@redhat.com>
> ---
>  block/nbd-client.c | 10 ++++++++++
>  block/nbd-client.h |  2 ++
>  block/nbd.c        |  9 +++++++++
>  3 files changed, 21 insertions(+)


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to