Failing QEMU iotest 175
QEMU iotest 175 is failing for me when I run it with -raw:
$ ./check -raw 175 QEMU -- "/home/thuth/tmp/qemu-build/tests/qemu-iotests/../../x86_64-softmmu/qemu-system-x86_64" -nodefaults -machine accel=qtest QEMU_IMG -- "/home/thuth/tmp/qemu-build/tests/qemu-iotests/../../qemu-img" QEMU_IO -- "/home/thuth/tmp/qemu-build/tests/qemu-iotests/../../qemu-io" --cache writeback -f raw QEMU_NBD -- "/home/thuth/tmp/qemu-build/tests/qemu-iotests/../../qemu-nbd" IMGFMT -- raw IMGPROTO -- file PLATFORM -- Linux/x86_64 thuth 3.10.0-957.10.1.el7.x86_64 TEST_DIR -- /home/thuth/tmp/qemu-build/tests/qemu-iotests/scratch SOCKET_SCM_HELPER -- /home/thuth/tmp/qemu-build/tests/qemu-iotests/socket_scm_helper
175 - output mismatch (see 175.out.bad)
--- /home/thuth/devel/qemu/tests/qemu-iotests/175.out 2019-04-23
16:43:12.000000000 +0200
+++ /home/thuth/tmp/qemu-build/tests/qemu-iotests/175.out.bad 2019-04-28
17:17:32.000000000 +0200
@@ -2,17 +2,17 @@
== creating image with default preallocation == Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576
-size=1048576, blocks=0
+size=1048576, blocks=2
== creating image with preallocation off ==
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 preallocation=off
-size=1048576, blocks=0
+size=1048576, blocks=2
== creating image with preallocation full ==
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 preallocation=full
-size=1048576, blocks=2048
+size=1048576, blocks=2050
== creating image with preallocation falloc == Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576
preallocation=falloc
-size=1048576, blocks=2048
+size=1048576, blocks=2050
*** done
Failures: 175
Failed 1 of 1 tests
Any ideas how to fix this?
Thomas
Review
Quoted 7 lines · Thomas Huth
QEMU iotest 175 is failing for me when I run it with -raw:
== creating image with default preallocation == Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576
(quoted diff) +1
-1-size=1048576, blocks=0 +size=1048576, blocks=2
What filesystem? It should be fairly obvious that 'stat -c blocks=%b' is file-system dependent (some allocate slightly more or less space, based on granularities and on predictions of future use), so we may need to update the test to apply a filter or otherwise allow a bit of fuzz in the answer. But 0/2 is definitely different than...
Review
Quoted 10 lines
== creating image with preallocation off ==
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 preallocation=off(quoted diff) +2
-2-size=1048576, blocks=0 +size=1048576, blocks=2 == creating image with preallocation full == Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 preallocation=full -size=1048576, blocks=2048 +size=1048576, blocks=2050
2048/2050, so we DO have some indication of whether the file is sparse or fully allocated.
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Quoted 10 lines · Eric Blake
Review
Quoted 7 lines · Thomas Huth
QEMU iotest 175 is failing for me when I run it with -raw:
== creating image with default preallocation == Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576
(quoted diff) +1
-1-size=1048576, blocks=0 +size=1048576, blocks=2What filesystem?
ext4
Quoted 11 lines
It should be fairly obvious that 'stat -c blocks=%b' is file-system dependent (some allocate slightly more or less space, based on granularities and on predictions of future use), so we may need to update the test to apply a filter or otherwise allow a bit of fuzz in the answer. But 0/2 is definitely different than...
Quoted 6 lines
== creating image with preallocation off ==
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 preallocation=off(quoted diff) +1
-1-size=1048576, blocks=0 +size=1048576, blocks=2
Quoted 7 lines
Review
Quoted 4 lines
== creating image with preallocation full ==
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 preallocation=full(quoted diff) +1
-1-size=1048576, blocks=2048 +size=1048576, blocks=20502048/2050, so we DO have some indication of whether the file is sparse or fully allocated.
Maybe we could check that the value after "blocks=" is a single digit in the first case, and matches "blocks=20.." in the second case?
Thomas
Quoted 5 lines · Thomas Huth
Quoted 4 lines · Eric Blake
Quoted 2 lines · Thomas Huth
QEMU iotest 175 is failing for me when I run it with -raw:
Quoted 9 lines
Quoted 6 lines
Review
Quoted 4 lines
== creating image with default preallocation == Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576
(quoted diff) +1
-1-size=1048576, blocks=0 +size=1048576, blocks=2What filesystem?
ext4
Hmm, it's passing for me on ext4, but that probably means we have different configuration parameters. I'm not sure how to easily show what parameters a particular ext4 partition uses to compare the differences between your setup and mine (mine is tuned to whatever defaults Fedora's installer chose on my behalf), so maybe someone else can chime in.
Quoted 19 lines
Quoted 11 lines
It should be fairly obvious that 'stat -c blocks=%b' is file-system dependent (some allocate slightly more or less space, based on granularities and on predictions of future use), so we may need to update the test to apply a filter or otherwise allow a bit of fuzz in the answer. But 0/2 is definitely different than...
Quoted 6 lines
== creating image with preallocation off ==
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 preallocation=off(quoted diff) +1
-1-size=1048576, blocks=0 +size=1048576, blocks=2Quoted 7 lines
Review
Quoted 4 lines
== creating image with preallocation full ==
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 preallocation=full(quoted diff) +1
-1-size=1048576, blocks=2048 +size=1048576, blocks=20502048/2050, so we DO have some indication of whether the file is sparse or fully allocated.
Quoted 2 lines
Maybe we could check that the value after "blocks=" is a single digit in the first case, and matches "blocks=20.." in the second case?
I wonder if 'qemu-img map --output=json $TEST_IMG' might be any more reliable (at least for ignoring any extra block allocations associated with the file, if it is some journaling option or xattr or other reason why your files seem to occupy more disk sectors than just the size of the file would imply).
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Quoted 43 lines · On Fri, May 3, 2019, 23:21 Eric Blake <[email protected]> wrote:
Quoted 5 lines · Thomas Huth
Quoted 4 lines · Eric Blake
Quoted 2 lines · Thomas Huth
QEMU iotest 175 is failing for me when I run it with -raw:
Quoted 9 lines
Quoted 6 lines
Review
Quoted 4 lines
== creating image with default preallocation == Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576
(quoted diff) +1
-1-size=1048576, blocks=0 +size=1048576, blocks=2What filesystem?
ext4
Hmm, it's passing for me on ext4, but that probably means we have different configuration parameters. I'm not sure how to easily show what parameters a particular ext4 partition uses to compare the differences between your setup and mine (mine is tuned to whatever defaults Fedora's installer chose on my behalf), so maybe someone else can chime in.
Quoted 8 lines
Quoted 8 lines
It should be fairly obvious that 'stat -c blocks=%b' is file-system dependent (some allocate slightly more or less space, based on granularities and on predictions of future use), so we may need to update the test to apply a filter or otherwise allow a bit of fuzz in the answer. But 0/2 is definitely different than...
Quoted 3 lines
== creating image with preallocation off == Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576
preallocation=off
Quoted 5 lines
Quoted 5 lines
Review
Quoted 5 lines
(quoted diff) +1
-1-size=1048576, blocks=0 +size=1048576, blocks=2 == creating image with preallocation full == Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576preallocation=full
Quoted 6 lines
Quoted 5 lines
Review
Quoted 2 lines
(quoted diff) +1
-1-size=1048576, blocks=2048 +size=1048576, blocks=20502048/2050, so we DO have some indication of whether the file is sparse or fully allocated.
Quoted 9 lines
Quoted 2 lines
Maybe we could check that the value after "blocks=" is a single digit in the first case, and matches "blocks=20.." in the second case?
I wonder if 'qemu-img map --output=json $TEST_IMG' might be any more reliable (at least for ignoring any extra block allocations associated with the file, if it is some journaling option or xattr or other reason why your files seem to occupy more disk sectors than just the size of the file would imply).
I think it should work better and is more correct, testing actual sparsness instead of underlying file system implementation.
I can send a fix next week.
Nir
Quoted 6 lines
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
Quoted 12 lines · Eric Blake
Quoted 11 lines · Thomas Huth
Quoted 9 lines · Eric Blake
Review
Quoted 6 lines · Thomas Huth
QEMU iotest 175 is failing for me when I run it with -raw:
== creating image with default preallocation == Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576
(quoted diff) +1
-1-size=1048576, blocks=0 +size=1048576, blocks=2What filesystem?
Quoted 7 lines
Quoted 1 line
ext4
Hmm, it's passing for me on ext4, but that probably means we have different configuration parameters. I'm not sure how to easily show what parameters a particular ext4 partition uses to compare the differences between your setup and mine (mine is tuned to whatever defaults Fedora's installer chose on my behalf), so maybe someone else can chime in.
$ sudo tune2fs -l /dev/mapper/Home tune2fs 1.42.9 (28-Dec-2013) Filesystem volume name: <none> Last mounted on: /home Filesystem magic number: 0xEF53 Filesystem revision #: 1 (dynamic) Filesystem features: has_journal ext_attr dir_index filetype needs_recovery meta_bg extent 64bit flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize Filesystem flags: signed_directory_hash Default mount options: user_xattr acl Filesystem state: clean Errors behavior: Continue Filesystem OS type: Linux Inode count: 36700160 Block count: 146800640 Reserved block count: 5873663 Free blocks: 56266267 Free inodes: 35403275 First block: 1 Block size: 1024 Fragment size: 1024 Group descriptor size: 64 Blocks per group: 8192 Fragments per group: 8192 Inodes per group: 2048 Inode blocks per group: 256 First meta block group: 258 Flex block group size: 16 Filesystem created: Thu Apr 19 18:34:33 2018 Last mount time: Sat May 4 08:20:36 2019 Last write time: Sat May 4 08:20:36 2019 Mount count: 224 Maximum mount count: -1 Last checked: Thu Apr 19 18:34:33 2018 Check interval: 0 (<none>) Lifetime writes: 1826 GB Reserved blocks uid: 0 (user root) Reserved blocks gid: 0 (group root) First inode: 11 Inode size: 128 Journal inode: 8 First orphan inode: 11076944 Default directory hash: half_md4 Directory Hash Seed: 08e1be04-c3a3-4c37-a059-cf54af5c4bc0 Journal backup: inode blocks
IIRC I talked to stefanha on IRC about this some weeks ago already, and he was able to reproduce the problem when using a certain parameter to create the file system. However, I fail to remember which parameter it was. Maybe Stefan still remembers...
Thomas
Quoted 44 lines · Thomas Huth
Quoted 5 lines
Hmm, it's passing for me on ext4, but that probably means we have different configuration parameters. I'm not sure how to easily show what parameters a particular ext4 partition uses to compare the differences between your setup and mine (mine is tuned to whatever defaults Fedora's installer chose on my behalf), so maybe someone else can chime in.
$ sudo tune2fs -l /dev/mapper/Home tune2fs 1.42.9 (28-Dec-2013) Filesystem volume name: <none> Last mounted on: /home Filesystem magic number: 0xEF53 Filesystem revision #: 1 (dynamic) Filesystem features: has_journal ext_attr dir_index filetype needs_recovery meta_bg extent 64bit flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize Filesystem flags: signed_directory_hash Default mount options: user_xattr acl Filesystem state: clean Errors behavior: Continue Filesystem OS type: Linux Inode count: 36700160 Block count: 146800640 Reserved block count: 5873663 Free blocks: 56266267 Free inodes: 35403275 First block: 1 Block size: 1024 Fragment size: 1024 Group descriptor size: 64 Blocks per group: 8192 Fragments per group: 8192 Inodes per group: 2048 Inode blocks per group: 256 First meta block group: 258 Flex block group size: 16 Filesystem created: Thu Apr 19 18:34:33 2018 Last mount time: Sat May 4 08:20:36 2019 Last write time: Sat May 4 08:20:36 2019 Mount count: 224 Maximum mount count: -1 Last checked: Thu Apr 19 18:34:33 2018 Check interval: 0 (<none>) Lifetime writes: 1826 GB Reserved blocks uid: 0 (user root)
Quoted 9 lines
Reserved blocks gid: 0 (group root) First inode: 11 Inode size: 128 Journal inode: 8 First orphan inode: 11076944 Default directory hash: half_md4 Directory Hash Seed: 08e1be04-c3a3-4c37-a059-cf54af5c4bc0 Journal backup: inode blocks
# tune2fs -l /dev/mapper/fedora-home tune2fs 1.44.6 (5-Mar-2019) Filesystem volume name: home Last mounted on: /home Filesystem UUID: 3ef45c0b-b2a0-43da-a1d3-c4f726097eda Filesystem magic number: 0xEF53 Filesystem revision #: 1 (dynamic) Filesystem features: has_journal ext_attr resize_inode dir_index filetype needs_recovery extent 64bit flex_bg sparse_super large_file huge_file dir_nlink extra_isize metadata_csum Filesystem flags: signed_directory_hash Default mount options: user_xattr acl Filesystem state: clean Errors behavior: Continue Filesystem OS type: Linux Inode count: 13107200 Block count: 52428800 Reserved block count: 2621440 Free blocks: 27184765 Free inodes: 12049129 First block: 0 Block size: 4096 Fragment size: 4096 Group descriptor size: 64 Reserved GDT blocks: 1024 Blocks per group: 32768 Fragments per group: 32768 Inodes per group: 8192 Inode blocks per group: 512 Flex block group size: 16 Filesystem created: Thu Dec 6 16:17:23 2018 Last mount time: Wed Apr 3 10:19:05 2019 Last write time: Wed Apr 3 10:19:05 2019 Mount count: 12 Maximum mount count: -1 Last checked: Thu Dec 6 16:17:23 2018 Check interval: 0 (<none>) Lifetime writes: 1962 GB Reserved blocks uid: 0 (user root) Reserved blocks gid: 0 (group root) First inode: 11 Inode size: 256 Required extra isize: 32 Desired extra isize: 32 Journal inode: 8 First orphan inode: 5248434 Default directory hash: half_md4 Directory Hash Seed: d1bbea0e-dd2e-4df7-b7f0-f7300c524cc9 Journal backup: inode blocks Checksum type: crc32c Checksum: 0x3a8a8676
I'm definitely seeing some differences in the two configs (such as your block size of 1k vs. mine at 4k), but not sure which are the most important, nor how to easily recreate a setup that matches yours.
Quoted 5 lines
IIRC I talked to stefanha on IRC about this some weeks ago already, and he was able to reproduce the problem when using a certain parameter to create the file system. However, I fail to remember which parameter it was. Maybe Stefan still remembers...
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Quoted 51 lines · Thomas Huth
QEMU iotest 175 is failing for me when I run it with -raw:
$ ./check -raw 175 QEMU -- "/home/thuth/tmp/qemu-build/tests/qemu-iotests/../../x86_64-softmmu/qemu-system-x86_64" -nodefaults -machine accel=qtest QEMU_IMG -- "/home/thuth/tmp/qemu-build/tests/qemu-iotests/../../qemu-img" QEMU_IO -- "/home/thuth/tmp/qemu-build/tests/qemu-iotests/../../qemu-io" --cache writeback -f raw QEMU_NBD -- "/home/thuth/tmp/qemu-build/tests/qemu-iotests/../../qemu-nbd" IMGFMT -- raw IMGPROTO -- file PLATFORM -- Linux/x86_64 thuth 3.10.0-957.10.1.el7.x86_64 TEST_DIR -- /home/thuth/tmp/qemu-build/tests/qemu-iotests/scratch SOCKET_SCM_HELPER -- /home/thuth/tmp/qemu-build/tests/qemu-iotests/socket_scm_helper175 - output mismatch (see 175.out.bad)
---/home/thuth/devel/qemu/tests/qemu-iotests/175.out2019-04-23
16:43:12.000000000 +0200
+++/home/thuth/tmp/qemu-build/tests/qemu-iotests/175.out.bad2019-04-28
17:17:32.000000000 +0200(quoted diff) +3
-3@@ -2,17 +2,17 @@ == creating image with default preallocation == Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 -size=1048576, blocks=0 +size=1048576, blocks=2 == creating image with preallocation off == Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 preallocation=off -size=1048576, blocks=0 +size=1048576, blocks=2 == creating image with preallocation full == Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 preallocation=full -size=1048576, blocks=2048 +size=1048576, blocks=2050 == creating image with preallocation falloc == Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576preallocation=falloc
(quoted diff) +1
-1-size=1048576, blocks=2048 +size=1048576, blocks=2050 *** doneFailures: 175
Failed 1 of 1 tests
Quoted 1 line
Any ideas how to fix this?
Hm. What output does
$ touch foo $ stat -c "size=%s, blocks=%b" foo $ truncate -s 1M foo $ stat -c "size=%s, blocks=%b" foo
give for you?
If any of that returns blocks=2, we can probably just use that operation to fix the result, then.
Max
Quoted 61 lines · Max Reitz
Quoted 51 lines · Thomas Huth
QEMU iotest 175 is failing for me when I run it with -raw:
$ ./check -raw 175 QEMU -- "/home/thuth/tmp/qemu-build/tests/qemu-iotests/../../x86_64-softmmu/qemu-system-x86_64" -nodefaults -machine accel=qtest QEMU_IMG -- "/home/thuth/tmp/qemu-build/tests/qemu-iotests/../../qemu-img" QEMU_IO -- "/home/thuth/tmp/qemu-build/tests/qemu-iotests/../../qemu-io" --cache writeback -f raw QEMU_NBD -- "/home/thuth/tmp/qemu-build/tests/qemu-iotests/../../qemu-nbd" IMGFMT -- raw IMGPROTO -- file PLATFORM -- Linux/x86_64 thuth 3.10.0-957.10.1.el7.x86_64 TEST_DIR -- /home/thuth/tmp/qemu-build/tests/qemu-iotests/scratch SOCKET_SCM_HELPER -- /home/thuth/tmp/qemu-build/tests/qemu-iotests/socket_scm_helper175 - output mismatch (see 175.out.bad)
---/home/thuth/devel/qemu/tests/qemu-iotests/175.out2019-04-23
16:43:12.000000000 +0200
+++/home/thuth/tmp/qemu-build/tests/qemu-iotests/175.out.bad2019-04-28
17:17:32.000000000 +0200(quoted diff) +3
-3@@ -2,17 +2,17 @@ == creating image with default preallocation == Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 -size=1048576, blocks=0 +size=1048576, blocks=2 == creating image with preallocation off == Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 preallocation=off -size=1048576, blocks=0 +size=1048576, blocks=2 == creating image with preallocation full == Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 preallocation=full -size=1048576, blocks=2048 +size=1048576, blocks=2050 == creating image with preallocation falloc == Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576preallocation=falloc
(quoted diff) +1
-1-size=1048576, blocks=2048 +size=1048576, blocks=2050 *** doneFailures: 175
Failed 1 of 1 testsQuoted 1 line
Any ideas how to fix this?
Hm. What output does
$ touch foo $ stat -c "size=%s, blocks=%b" foo $ truncate -s 1M foo $ stat -c "size=%s, blocks=%b" foo
Quoted 4 lines
give for you?
If any of that returns blocks=2, we can probably just use that operation to fix the result, then.
$ stat -c "size=%s, blocks=%b" foo size=0, blocks=2 $ truncate -s 1M foo $ stat -c "size=%s, blocks=%b" foo size=1048576, blocks=2
Thomas
Quoted 64 lines · Thomas Huth
Quoted 63 lines · Max Reitz
Quoted 51 lines · Thomas Huth
QEMU iotest 175 is failing for me when I run it with -raw:
$ ./check -raw 175 QEMU -- "/home/thuth/tmp/qemu-build/tests/qemu-iotests/../../x86_64-softmmu/qemu-system-x86_64" -nodefaults -machine accel=qtest QEMU_IMG -- "/home/thuth/tmp/qemu-build/tests/qemu-iotests/../../qemu-img" QEMU_IO -- "/home/thuth/tmp/qemu-build/tests/qemu-iotests/../../qemu-io" --cache writeback -f raw QEMU_NBD -- "/home/thuth/tmp/qemu-build/tests/qemu-iotests/../../qemu-nbd" IMGFMT -- raw IMGPROTO -- file PLATFORM -- Linux/x86_64 thuth 3.10.0-957.10.1.el7.x86_64 TEST_DIR -- /home/thuth/tmp/qemu-build/tests/qemu-iotests/scratch SOCKET_SCM_HELPER -- /home/thuth/tmp/qemu-build/tests/qemu-iotests/socket_scm_helper175 - output mismatch (see 175.out.bad)
---/home/thuth/devel/qemu/tests/qemu-iotests/175.out2019-04-23
16:43:12.000000000 +0200
+++/home/thuth/tmp/qemu-build/tests/qemu-iotests/175.out.bad2019-04-28
17:17:32.000000000 +0200(quoted diff) +3
-3@@ -2,17 +2,17 @@ == creating image with default preallocation == Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 -size=1048576, blocks=0 +size=1048576, blocks=2 == creating image with preallocation off == Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 preallocation=off -size=1048576, blocks=0 +size=1048576, blocks=2 == creating image with preallocation full == Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 preallocation=full -size=1048576, blocks=2048 +size=1048576, blocks=2050 == creating image with preallocation falloc == Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576preallocation=falloc
(quoted diff) +1
-1-size=1048576, blocks=2048 +size=1048576, blocks=2050 *** doneFailures: 175
Failed 1 of 1 testsQuoted 1 line
Any ideas how to fix this?
Hm. What output does
$ touch foo $ stat -c "size=%s, blocks=%b" foo $ truncate -s 1M foo $ stat -c "size=%s, blocks=%b" foogive for you?
Quoted 8 lines
Quoted 2 lines
If any of that returns blocks=2, we can probably just use that operation to fix the result, then.
$ stat -c "size=%s, blocks=%b" foo size=0, blocks=2 $ truncate -s 1M foo $ stat -c "size=%s, blocks=%b" foo size=1048576, blocks=2
Thanks, that should be useful, then.
Max
Quoted 30 lines · Nir Soffer
Quoted 16 lines · On Fri, May 3, 2019, 23:21 Eric Blake <[email protected]> wrote:
...
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
== creating image with preallocation off == Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576
preallocation=off
Quoted 5 lines
Quoted 5 lines
Review
Quoted 5 lines
(quoted diff) +1
-1-size=1048576, blocks=0 +size=1048576, blocks=2 == creating image with preallocation full == Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576preallocation=full
Quoted 6 lines
Quoted 5 lines
Review
Quoted 2 lines
(quoted diff) +1
-1-size=1048576, blocks=2048 +size=1048576, blocks=20502048/2050, so we DO have some indication of whether the file is sparse or fully allocated.
Quoted 9 lines
Quoted 2 lines
Maybe we could check that the value after "blocks=" is a single digit in the first case, and matches "blocks=20.." in the second case?
I wonder if 'qemu-img map --output=json $TEST_IMG' might be any more reliable (at least for ignoring any extra block allocations associated with the file, if it is some journaling option or xattr or other reason why your files seem to occupy more disk sectors than just the size of the file would imply).
Quoted 5 lines
I think it should work better and is more correct, testing actual sparsness instead of underlying file system implementation.
I can send a fix next week.
I tested this change:
$ git diff
tests/qemu-iotests/175 +2 -2
@@ -43,17 +43,17 @@ _supported_os Linux size=1m echo echo "== creating image with default preallocation ==" _make_test_img $size | _filter_imgfmt -stat -c "size=%s, blocks=%b" $TEST_IMG +$QEMU_IMG map -f $IMGFMT --output json "$TEST_IMG" for mode in off full falloc; do echo echo "== creating image with preallocation $mode ==" IMGOPTS=preallocation=$mode _make_test_img $size | _filter_imgfmt - stat -c "size=%s, blocks=%b" $TEST_IMG + $QEMU_IMG map -f $IMGFMT --output json "$TEST_IMG" done # success, all done echo "*** done" rm -f $seq.full
It almost works:
$ ./check -raw 175 QEMU -- "/home/nsoffer/src/qemu/build/tests/qemu-iotests/../../x86_64-softmmu/qemu-system-x86_64" -nodefaults -machine accel=qtest QEMU_IMG -- "/home/nsoffer/src/qemu/build/tests/qemu-iotests/../../qemu-img" QEMU_IO -- "/home/nsoffer/src/qemu/build/tests/qemu-iotests/../../qemu-io" --cache writeback -f raw QEMU_NBD -- "/home/nsoffer/src/qemu/build/tests/qemu-iotests/../../qemu-nbd" IMGFMT -- raw IMGPROTO -- file PLATFORM -- Linux/x86_64 lean 5.0.11-100.fc28.x86_64 TEST_DIR -- /home/nsoffer/src/qemu/build/tests/qemu-iotests/scratch SOCKET_SCM_HELPER -- /home/nsoffer/src/qemu/build/tests/qemu-iotests/socket_scm_helper
175 - output mismatch (see 175.out.bad)
--- /home/nsoffer/src/qemu/tests/qemu-iotests/175.out 2019-03-23 18:35:17.788177871 +0200
+++ /home/nsoffer/src/qemu/build/tests/qemu-iotests/175.out.bad 2019-05-11 00:06:09.515873624 +0300
@@ -2,17 +2,17 @@
== creating image with default preallocation ==
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576
-size=1048576, blocks=0
+[{ "start": 0, "length": 1048576, "depth": 0, "zero": true, "data": false, "offset": 0}]
== creating image with preallocation off ==
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 preallocation=off
-size=1048576, blocks=0
+[{ "start": 0, "length": 1048576, "depth": 0, "zero": true, "data": false, "offset": 0}]
== creating image with preallocation full ==
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 preallocation=full
-size=1048576, blocks=2048
+[{ "start": 0, "length": 1048576, "depth": 0, "zero": false, "data": true, "offset": 0}]
== creating image with preallocation falloc ==
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576
preallocation=falloc
-size=1048576, blocks=2048
+[{ "start": 0, "length": 1048576, "depth": 0, "zero": true, "data": false, "offset": 0}]
The "falloc" test looks exactly like "off", qemu-img map does not report the allocation
status.
Nir
Quoted 108 lines · Eric Blake
Quoted 44 lines · Thomas Huth
Quoted 5 lines
Hmm, it's passing for me on ext4, but that probably means we have different configuration parameters. I'm not sure how to easily show what parameters a particular ext4 partition uses to compare the differences between your setup and mine (mine is tuned to whatever defaults Fedora's installer chose on my behalf), so maybe someone else can chime in.
$ sudo tune2fs -l /dev/mapper/Home tune2fs 1.42.9 (28-Dec-2013) Filesystem volume name: <none> Last mounted on: /home Filesystem magic number: 0xEF53 Filesystem revision #: 1 (dynamic) Filesystem features: has_journal ext_attr dir_index filetype needs_recovery meta_bg extent 64bit flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize Filesystem flags: signed_directory_hash Default mount options: user_xattr acl Filesystem state: clean Errors behavior: Continue Filesystem OS type: Linux Inode count: 36700160 Block count: 146800640 Reserved block count: 5873663 Free blocks: 56266267 Free inodes: 35403275 First block: 1 Block size: 1024 Fragment size: 1024 Group descriptor size: 64 Blocks per group: 8192 Fragments per group: 8192 Inodes per group: 2048 Inode blocks per group: 256 First meta block group: 258 Flex block group size: 16 Filesystem created: Thu Apr 19 18:34:33 2018 Last mount time: Sat May 4 08:20:36 2019 Last write time: Sat May 4 08:20:36 2019 Mount count: 224 Maximum mount count: -1 Last checked: Thu Apr 19 18:34:33 2018 Check interval: 0 (<none>) Lifetime writes: 1826 GB Reserved blocks uid: 0 (user root)Quoted 9 lines
Reserved blocks gid: 0 (group root) First inode: 11 Inode size: 128 Journal inode: 8 First orphan inode: 11076944 Default directory hash: half_md4 Directory Hash Seed: 08e1be04-c3a3-4c37-a059-cf54af5c4bc0 Journal backup: inode blocks# tune2fs -l /dev/mapper/fedora-home tune2fs 1.44.6 (5-Mar-2019) Filesystem volume name: home Last mounted on: /home Filesystem UUID: 3ef45c0b-b2a0-43da-a1d3-c4f726097eda Filesystem magic number: 0xEF53 Filesystem revision #: 1 (dynamic) Filesystem features: has_journal ext_attr resize_inode dir_index filetype needs_recovery extent 64bit flex_bg sparse_super large_file huge_file dir_nlink extra_isize metadata_csum Filesystem flags: signed_directory_hash Default mount options: user_xattr acl Filesystem state: clean Errors behavior: Continue Filesystem OS type: Linux Inode count: 13107200 Block count: 52428800 Reserved block count: 2621440 Free blocks: 27184765 Free inodes: 12049129 First block: 0 Block size: 4096 Fragment size: 4096 Group descriptor size: 64 Reserved GDT blocks: 1024 Blocks per group: 32768 Fragments per group: 32768 Inodes per group: 8192 Inode blocks per group: 512 Flex block group size: 16 Filesystem created: Thu Dec 6 16:17:23 2018 Last mount time: Wed Apr 3 10:19:05 2019 Last write time: Wed Apr 3 10:19:05 2019 Mount count: 12 Maximum mount count: -1 Last checked: Thu Dec 6 16:17:23 2018 Check interval: 0 (<none>) Lifetime writes: 1962 GB Reserved blocks uid: 0 (user root) Reserved blocks gid: 0 (group root) First inode: 11 Inode size: 256 Required extra isize: 32 Desired extra isize: 32 Journal inode: 8 First orphan inode: 5248434 Default directory hash: half_md4 Directory Hash Seed: d1bbea0e-dd2e-4df7-b7f0-f7300c524cc9 Journal backup: inode blocks Checksum type: crc32c Checksum: 0x3a8a8676
Quoted 3 lines
I'm definitely seeing some differences in the two configs (such as your block size of 1k vs. mine at 4k), but not sure which are the most important, nor how to easily recreate a setup that matches yours.
Yes, previously when we had similar issues it was the block size that caused the difference. It's worth trying it out with a test file system on a loop device.
Stefan