22.08.2020 20:04, Vladimir Sementsov-Ogievskiy wrote:
22.08.2020 20:03, Vladimir Sementsov-Ogievskiy wrote:
01.11.2019 18:25, Max Reitz wrote:
The XFS kernel driver has a bug that may cause data corruption for qcow2
images as of qemu commit c8bb23cbdbe32f. We can work around it by
treating post-EOF fallocates as serializing up until infinity (INT64_MAX
in practice).
Hi! I'm doing some investigation, and here is an interesting result:
Consider the following test:
img=/ssd/x.qcow2; ./qemu-img create -f qcow2 $img 16G; ./qemu-img bench -c
50000 -d 64 -f qcow2 -o 1k -s 64k -t none -w $img
Bisecting results changes between 2.12 and 5.1, I found the following:
2.12: ~20s
....
c8bb23cbdbe32 "qcow2: skip writing zero buffers to empty COW areas" -> becomes
~12s [1]
....
292d06b925b27 "block/file-posix: Let post-EOF fallocate serialize" -> becomes
~9s [2]
....
v5.1 ~9s
And [1] is obvious, it is the main purpose of c8bb23cbdbe32. But [2] is a
surprise for me.. Any ideas?
===
just to check: staying at c8bb23cbdbe32 I revert c8bb23cbdbe32 and get again
~19.7s. So [2] doesn't substitute [1].
Note, it's all ext4.
Let's go further:
If I add -n, to use aio native:
./qemu-img create -f qcow2 $img 16G; ./qemu-img bench -c 50000 -d 64 -f qcow2
-o 1k -s 64k -t none -n -w $img;
Then this patch doesn't have such effect..
But if consider the test without an offset on hdd, the effect is very
significant:
./qemu-img create -f qcow2 $img 16G; ./qemu-img bench -c 45000 -d 64 -f qcow2
-s 16k -t none -n -w $img;
v2.12 ~10.4s
c8bb23cbdbe32^ ~10.6s
c8bb23cbdbe32 qcow2: skip writing zero buffers to empty COW areas: ~16.7s :
degradation!!!
292d06b925b27^ ~16.4s
292d06b925 block/file-posix: Let post-EOF fallocate serialize: ~7.6s: great
improvement !
--
Best regards,
Vladimir