26.08.2020 11:23, Vladimir Sementsov-Ogievskiy wrote:
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 !
Hmm, a bit more accurate results (use separate partition on non-root hard
drive). I post just numbers I get from iterations, not calculating the average.
v2.12.0 9.227 8.999 9.059 8.793
c8bb23cbdbe32^ 9.264 8.996 8.969
c8bb23cbdbe32 20.694 16.050 15.898 15.918 16.136
292d06b925b27^ 15.509 15.343 16.549
292d06b925 8.368 8.529 8.342 7.503 8.361 8.353 8.416 13.043 12.594 7.898 7.907
11.914
292d06b925 + don't-handle-alloc 18.730 9.321 9.016 9.037 18.286 18.268
(don't handle alloc is don't call qcow2_handle_alloc function which is actual
revert of c8bb23cbdbe32)
very interesting..
292d06b925^ + don't-handle-alloc 9.200 9.285 9.297 9.296 9.194 9.332 9.155
--
Best regards,
Vladimir