|
Pablo Greco |
e6a3ae |
From b4841fd40fefcffc99c4b52c8a06720edb4ef9ef Mon Sep 17 00:00:00 2001
|
|
Pablo Greco |
e6a3ae |
From: Thomas Huth <thuth@redhat.com>
|
|
Pablo Greco |
e6a3ae |
Date: Fri, 30 Aug 2019 12:56:28 +0100
|
|
Pablo Greco |
e6a3ae |
Subject: [PATCH 10/10] iotests: Test allocate_first_block() with O_DIRECT
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
RH-Author: Thomas Huth <thuth@redhat.com>
|
|
Pablo Greco |
e6a3ae |
Message-id: <20190830125628.23668-6-thuth@redhat.com>
|
|
Pablo Greco |
e6a3ae |
Patchwork-id: 90212
|
|
Pablo Greco |
e6a3ae |
O-Subject: [RHEL-8.1.0 qemu-kvm PATCH v2 5/5] iotests: Test allocate_first_block() with O_DIRECT
|
|
Pablo Greco |
e6a3ae |
Bugzilla: 1738839
|
|
Pablo Greco |
e6a3ae |
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
|
|
Pablo Greco |
e6a3ae |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
Pablo Greco |
e6a3ae |
RH-Acked-by: David Hildenbrand <david@redhat.com>
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
From: Nir Soffer <nirsof@gmail.com>
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
Using block_resize we can test allocate_first_block() with file
|
|
Pablo Greco |
e6a3ae |
descriptor opened with O_DIRECT, ensuring that it works for any size
|
|
Pablo Greco |
e6a3ae |
larger than 4096 bytes.
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
Testing smaller sizes is tricky as the result depends on the filesystem
|
|
Pablo Greco |
e6a3ae |
used for testing. For example on NFS any size will work since O_DIRECT
|
|
Pablo Greco |
e6a3ae |
does not require any alignment.
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
Signed-off-by: Nir Soffer <nsoffer@redhat.com>
|
|
Pablo Greco |
e6a3ae |
Reviewed-by: Max Reitz <mreitz@redhat.com>
|
|
Pablo Greco |
e6a3ae |
Message-id: 20190827010528.8818-3-nsoffer@redhat.com
|
|
Pablo Greco |
e6a3ae |
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
|
Pablo Greco |
e6a3ae |
(cherry picked from commit 4656fb5ebbece8c7bbca0bef56bea882c94b9132)
|
|
Pablo Greco |
e6a3ae |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
Pablo Greco |
e6a3ae |
---
|
|
Pablo Greco |
e6a3ae |
tests/qemu-iotests/175 | 28 ++++++++++++++++++++++++++++
|
|
Pablo Greco |
e6a3ae |
tests/qemu-iotests/175.out | 8 ++++++++
|
|
Pablo Greco |
e6a3ae |
2 files changed, 36 insertions(+)
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
diff --git a/tests/qemu-iotests/175 b/tests/qemu-iotests/175
|
|
Pablo Greco |
e6a3ae |
index b3b7712..74ca49d 100755
|
|
Pablo Greco |
e6a3ae |
--- a/tests/qemu-iotests/175
|
|
Pablo Greco |
e6a3ae |
+++ b/tests/qemu-iotests/175
|
|
Pablo Greco |
e6a3ae |
@@ -50,6 +50,23 @@ _filter_blocks()
|
|
Pablo Greco |
e6a3ae |
-e "s/blocks=$((extra_blocks + img_size / 512))\\(\$\\|[^0-9]\\)/max allocation/"
|
|
Pablo Greco |
e6a3ae |
}
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
+# Resize image using block_resize.
|
|
Pablo Greco |
e6a3ae |
+# Parameter 1: image path
|
|
Pablo Greco |
e6a3ae |
+# Parameter 2: new size
|
|
Pablo Greco |
e6a3ae |
+_block_resize()
|
|
Pablo Greco |
e6a3ae |
+{
|
|
Pablo Greco |
e6a3ae |
+ local path=$1
|
|
Pablo Greco |
e6a3ae |
+ local size=$2
|
|
Pablo Greco |
e6a3ae |
+
|
|
Pablo Greco |
e6a3ae |
+ $QEMU -qmp stdio -nographic -nodefaults \
|
|
Pablo Greco |
e6a3ae |
+ -blockdev file,node-name=file,filename=$path,cache.direct=on \
|
|
Pablo Greco |
e6a3ae |
+ <
|
|
Pablo Greco |
e6a3ae |
+{'execute': 'qmp_capabilities'}
|
|
Pablo Greco |
e6a3ae |
+{'execute': 'block_resize', 'arguments': {'node-name': 'file', 'size': $size}}
|
|
Pablo Greco |
e6a3ae |
+{'execute': 'quit'}
|
|
Pablo Greco |
e6a3ae |
+EOF
|
|
Pablo Greco |
e6a3ae |
+}
|
|
Pablo Greco |
e6a3ae |
+
|
|
Pablo Greco |
e6a3ae |
# get standard environment, filters and checks
|
|
Pablo Greco |
e6a3ae |
. ./common.rc
|
|
Pablo Greco |
e6a3ae |
. ./common.filter
|
|
Pablo Greco |
e6a3ae |
@@ -58,6 +75,9 @@ _supported_fmt raw
|
|
Pablo Greco |
e6a3ae |
_supported_proto file
|
|
Pablo Greco |
e6a3ae |
_supported_os Linux
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
+_default_cache_mode none
|
|
Pablo Greco |
e6a3ae |
+_supported_cache_modes none directsync
|
|
Pablo Greco |
e6a3ae |
+
|
|
Pablo Greco |
e6a3ae |
size=$((1 * 1024 * 1024))
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
touch "$TEST_DIR/empty"
|
|
Pablo Greco |
e6a3ae |
@@ -80,6 +100,14 @@ for mode in off full falloc; do
|
|
Pablo Greco |
e6a3ae |
stat -c "size=%s, blocks=%b" $TEST_IMG | _filter_blocks $extra_blocks $min_blocks $size
|
|
Pablo Greco |
e6a3ae |
done
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
+for new_size in 4096 1048576; do
|
|
Pablo Greco |
e6a3ae |
+ echo
|
|
Pablo Greco |
e6a3ae |
+ echo "== resize empty image with block_resize =="
|
|
Pablo Greco |
e6a3ae |
+ _make_test_img 0 | _filter_imgfmt
|
|
Pablo Greco |
e6a3ae |
+ _block_resize $TEST_IMG $new_size >/dev/null
|
|
Pablo Greco |
e6a3ae |
+ stat -c "size=%s, blocks=%b" $TEST_IMG | _filter_blocks $extra_blocks $min_blocks $new_size
|
|
Pablo Greco |
e6a3ae |
+done
|
|
Pablo Greco |
e6a3ae |
+
|
|
Pablo Greco |
e6a3ae |
# success, all done
|
|
Pablo Greco |
e6a3ae |
echo "*** done"
|
|
Pablo Greco |
e6a3ae |
rm -f $seq.full
|
|
Pablo Greco |
e6a3ae |
diff --git a/tests/qemu-iotests/175.out b/tests/qemu-iotests/175.out
|
|
Pablo Greco |
e6a3ae |
index 263e521..39c2ee0 100644
|
|
Pablo Greco |
e6a3ae |
--- a/tests/qemu-iotests/175.out
|
|
Pablo Greco |
e6a3ae |
+++ b/tests/qemu-iotests/175.out
|
|
Pablo Greco |
e6a3ae |
@@ -15,4 +15,12 @@ size=1048576, max allocation
|
|
Pablo Greco |
e6a3ae |
== creating image with preallocation falloc ==
|
|
Pablo Greco |
e6a3ae |
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 preallocation=falloc
|
|
Pablo Greco |
e6a3ae |
size=1048576, max allocation
|
|
Pablo Greco |
e6a3ae |
+
|
|
Pablo Greco |
e6a3ae |
+== resize empty image with block_resize ==
|
|
Pablo Greco |
e6a3ae |
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=0
|
|
Pablo Greco |
e6a3ae |
+size=4096, min allocation
|
|
Pablo Greco |
e6a3ae |
+
|
|
Pablo Greco |
e6a3ae |
+== resize empty image with block_resize ==
|
|
Pablo Greco |
e6a3ae |
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=0
|
|
Pablo Greco |
e6a3ae |
+size=1048576, min allocation
|
|
Pablo Greco |
e6a3ae |
*** done
|
|
Pablo Greco |
e6a3ae |
--
|
|
Pablo Greco |
e6a3ae |
1.8.3.1
|
|
Pablo Greco |
e6a3ae |
|