+++ This bug was initially created as a clone of Bug #1647104 +++ Description of problem: qemu-img convert and map are much slower when accessing an image using qemu-nbd compared with accessing an image directly. Version-Release number of selected component (if applicable): qemu-kvm-4.0.0-4.module+el8.1.0+3523+b348b848 kernel-4.18.0-107.el8 How reproducible: Always Steps to reproduce: Local: # time qemu-img map --output=json /dev/nvme0n1p1 > test.json real 0m0.014s user 0m0.006s sys 0m0.007s # time qemu-img convert -f qcow2 -O raw /dev/nvme0n1p1 /dev/shm/tgt.img real 0m0.013s user 0m0.007s sys 0m0.006s Over NBD: # time qemu-img map -f raw --output=json nbd:unix:/home/test/my.socket:exportname=export > test_nbd.json real 0m0.732s user 0m0.295s sys 0m0.242s # time qemu-img convert -f raw -O raw nbd:unix:/home/test/my.socket:exportname=export /dev/shm/tgt.img real 0m5.023s user 0m0.981s sys 0m2.808s Additional info: Source image info: 1. Partition info: nvme0n1 259:0 0 745.2G 0 disk └─nvme0n1p1 259:1 0 5G 0 part 2. Mount the partition and write 1.5G data to it # mount /dev/nvme0n1p1 /mnt/ # cd /mnt/ # dd if=/dev/urandom of=f1 bs=1M count=1024 # dd if=/dev/urandom of=f2 bs=1M count=1024 # umount /mnt # qemu-img create -f qcow2 /dev/nvme0n1p1 5G Export image via below CML: # qemu-nbd -k /home/test/my.socket -v -f raw -x export --cache=none --aio=threads --persistent /dev/nvme0n1p1
Patch is accepted upstream: https://git.qemu.org/?p=qemu.git;a=commit;h=867eccfed84f96b54f4a432c510a02c2ce03b430
Tried to verify this bug as below: Tested with: qemu-kvm-4.1.0-4.module+el8.1.0+4020+16089f93 kernel-4.18.0-134.el8 Steps: Local: # time qemu-img map --output=json /dev/nvme0n1p1 > tt.json real 0m0.012s user 0m0.008s sys 0m0.004s # time qemu-img convert -f qcow2 -O raw /dev/nvme0n1p1 /dev/shm/tgt.img real 0m0.014s user 0m0.008s sys 0m0.006s Over NBD: # time qemu-img map -f raw --output=json nbd:unix:/home/test/my.socket:exportname=export > test_nbd.json real 0m0.019s user 0m0.009s sys 0m0.007s # time qemu-img convert -f raw -O raw nbd:unix:/home/test/my.socket:exportname=export /dev/shm/tgt.img real 0m3.276s user 0m0.334s sys 0m2.203s Additional info: Source image info: 1. Partition info: nvme0n1 259:0 0 745.2G 0 disk └─nvme0n1p1 259:1 0 5G 0 part 2. Mount the partition and write 1.5G data to it # mkfs.xfs /dev/nvme0n1p1 # mount /dev/nvme0n1p1 /mnt/ # cd /mnt/ # dd if=/dev/urandom of=f1 bs=1M count=1024 # dd if=/dev/urandom of=f2 bs=1M count=1024 # umount /mnt # qemu-img create -f qcow2 /dev/nvme0n1p1 5G Export image via below CML: # qemu-nbd -k /home/test/my.socket -v -f raw -x export --cache=none --aio=threads --persistent /dev/nvme0n1p1
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2019:3723