Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
nbd: Implement zero
Add zero(start, length) method sending NBD_CMD_WRITE_ZEROES command.
Update the example nbd tool to map data and zero ranges in the source
image and send zero areas efficiently.
Here is an example session uploading sparse images.
Creating 6g sparse source image:
$ virt-builder fedora-27 -o /var/tmp/fedora-27.img
Creating qcow2 destination image:
$ qemu-img create -f qcow2 /var/tmp/fedora-27.qcow2 6g
Serving image with qemu-nbd, supporting discard:
$ qemu-nbd \
--socket /tmp/nbd.sock \
--format qcow2 \
--export-name= \
--persistent \
--cache=none \
--aio=native \
--discard=unmap \
/var/tmp/fedora-27.qcow2
Copying image to qcow2 image (best of 10 runs):
$ time PYTHONPATH=common examples/nbd-client upload /var/tmp/fedora-27.img /tmp/nbd.sock
[ 100.00% ] 6.00 GiB, 3.59 seconds, 1709.11 MiB/s
real 0m3.638s
user 0m0.072s
sys 0m0.688s
Same operation with qemu-img (best of 10 runs):
$ time qemu-img convert -n -p -f raw -O raw /var/tmp/fedora-27.img nbd:unix:/tmp/nbd.sock
(100.00/100%)
real 0m5.435s
user 0m0.125s
sys 0m0.772s
Change-Id: I61462a6b8692948c573114800df31914c78c2e6c
Signed-off-by: Nir Soffer <nsoffer@redhat.com>- Loading branch information
Showing
3 changed files
with
140 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters