Skip to contentSkip to conversation

qemu-iotests: Variable cluster size

PATCH In review Kevin Wolf 2 participants 5 messages Sep 28, 2009 – Oct 1, 2009

lore
Share & tools
lore

Kevin Wolf

author
#0 lore raw

cover qemu-iotests: Variable cluster size

Currently, all qcow2 tests align their test requests to hit the critical spots in images that use 4k clusters. By default we are using 64k clusters now for a while, so we need to make the tests more dynamic.

This patch series makes the cluster size variable in some of the generic code like common.pattern and adds a test case for the non-4k cluster case.

Kevin Wolf (3):
qemu-iotests: Align test requests according to cluster size
qemu-iotests: 019: Make cluster size dynamic
qemu-iotests: Tests on non-4k clusters

 013            |    9 +-
 013.out        |  682 +-
 014            |    6 +-
 014.out        |  818 +-
 019            |   13 +-
 019.out        |    4 +-
 022            |    5 +-
 022.out        |  138 +-
 023            |  119 +
 023.out        |25706 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 common.pattern |   69 +-
 common.rc      |    4 +
 group          |    1 +
 13 files changed, 26709 insertions(+), 865 deletions(-)
 mode change 100644 => 100755 021
 create mode 100755 023
 create mode 100644 023.out
author
#1 lore raw

PATCH 1/3 qemu-iotests: Align test requests according to cluster size

Change the io_test and io_test2 functions to take the cluster size of the image and the number of test requests to issue. Tests are changed to specify a cluster size (usually 4k), but expected test results stay the same for now (apart from qemu-img printing the cluster size now).

Based on a patch written by Christoph Hellwig.

---
 013            |    9 ++++---
 013.out        |    2 +-
 014            |    6 +++-
 014.out        |    2 +-
 019            |    1 +
 019.out        |    4 +-
 022            |    5 ++-
 022.out        |    2 +-
 common.pattern |   68 +++++++++++++++++++++++++++++++------------------------
 common.rc      |    4 +++
 10 files changed, 60 insertions(+), 43 deletions(-)
013 +5 -4
index 565071f..bd9fdef 100755
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# qcow2 pattern test, empty and compressed image
+# qcow2 pattern test, empty and compressed image - 4k cluster patterns
 #
 # Copyright (C) 2009 Red Hat, Inc.
 #
@@ -45,6 +45,7 @@ _supported_os Linux
 
 TEST_OFFSETS="0 4294967296"
 TEST_OPS="writev read write readv"
+CLUSTER_SIZE=4096
 
 _make_test_img 6G
 
@@ -54,7 +55,7 @@ echo
 for offset in $TEST_OFFSETS; do
     echo "At offset $offset:"
     for op in $TEST_OPS; do
-        io_test $op $offset
+        io_test $op $offset $CLUSTER_SIZE 8
     done
     _check_test_img
 done
@@ -72,7 +73,7 @@ echo
 for offset in $TEST_OFFSETS; do
     echo "With offset $offset:"
     for op in read readv; do
-        io_test $op $offset
+        io_test $op $offset $CLUSTER_SIZE 8
     done
     _check_test_img
 done
@@ -85,7 +86,7 @@ for offset in $TEST_OFFSETS; do
     offset=$((offset + 512))
     echo "With offset $offset:"
     for op in $TEST_OPS; do
-        io_test $op $offset
+        io_test $op $offset $CLUSTER_SIZE 8
     done
     _check_test_img
 done
013.out +1 -1
index 01d306d..4072e8d 100644
@@ -1,5 +1,5 @@
 QA output created by 013
-Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=6442450944 
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=6442450944 cluster_size=4096 
 Testing empty image
 
 At offset 0:
014 +4 -2
index d7f50af..ee7bf21 100755
@@ -1,6 +1,7 @@
 #!/bin/sh
 #
 # qcow2 pattern test, complex patterns including compression and snapshots
+# Using patterns for 4k cluster size.
 #
 #
 # Copyright (C) 2009 Red Hat, Inc.
@@ -46,13 +47,14 @@ _supported_os Linux
 
 TEST_OFFSETS="0 4294967296"
 TEST_OPS="writev read write readv"
+CLUSTER_SIZE=4096
 
 _make_test_img 6G
 
 echo "Testing empty image:"
 for offset in $TEST_OFFSETS; do
     echo test2: With offset $offset
-    io_test2 $offset
+    io_test2 $offset $CLUSTER_SIZE 256
     _check_test_img
 done
 
@@ -62,7 +64,7 @@ for i in `seq 1 3`; do
     for offset in $TEST_OFFSETS; do
         echo With snapshot test$i, offset $offset
         for op in $TEST_OPS; do
-            io_test $op $offset
+            io_test $op $offset $CLUSTER_SIZE 8
         done
         _check_test_img
     done
014.out +1 -1
index b2c0176..3fbc3a5 100644
@@ -1,5 +1,5 @@
 QA output created by 014
-Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=6442450944 
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=6442450944 cluster_size=4096 
 Testing empty image:
 test2: With offset 0
 === Clusters to be compressed [1]
019 +1 -0
index 0c84d2f..c3bf950 100755
@@ -48,6 +48,7 @@ _supported_fmt qcow qcow2 vmdk
 _supported_os Linux
 
 TEST_OFFSETS="0 4294967296"
+CLUSTER_SIZE=65536
 
 _make_test_img 6G
 
019.out +2 -2
index 9ac1a21..ef82d02 100644
@@ -1,5 +1,5 @@
 QA output created by 019
-Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=6442450944 
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=6442450944 cluster_size=65536 
 Filling base image
 
 === IO: pattern 0
@@ -269,7 +269,7 @@ qemu-io> wrote 65536/65536 bytes at offset 4296081408
 qemu-io> No errors were found on the image.
 Creating test image with backing file
 
-Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=6442450944 backing_file='TEST_DIR/t.IMGFMT.base' 
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=6442450944 backing_file='TEST_DIR/t.IMGFMT.base' cluster_size=65536 
 Filling test image
 
 === IO: pattern 1
022 +3 -2
index ca5df99..ccf2319 100755
@@ -46,6 +46,7 @@ _supported_fmt qcow2
 _supported_os Linux
 
 TEST_OFFSETS="10485760 4294967296"
+CLUSTER_SIZE="4096"
 
 _make_test_img 6G
 
@@ -54,8 +55,8 @@ echo
 
 for offset in $TEST_OFFSETS; do
     echo "At offset $offset:"
-    io_test "write -b" $offset
-    io_test "read -b" $offset
+    io_test "write -b" $offset $CLUSTER_SIZE 8
+    io_test "read -b" $offset $CLUSTER_SIZE 8
     _check_test_img
 done
 
022.out +1 -1
index 0100f67..d1a610d 100644
@@ -1,5 +1,5 @@
 QA output created by 022
-Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=6442450944 
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=6442450944 cluster_size=4096 
 Testing empty image
 
 At offset 10485760:
common.pattern +38 -30

111 lines not on this page · raw message

common.rc +4 -0
index 6ef6b51..0a7ba00 100644
@@ -55,6 +55,10 @@ _make_test_img()
     # at least one argument (the image size) needs to be added
     local extra_img_options=$*
 
+    if [ "$IMGFMT" = "qcow2" -a -n "$CLUSTER_SIZE" ]; then
+        extra_img_options="-o cluster_size=$CLUSTER_SIZE $extra_img_options"
+    fi
+
     # XXX(hch): have global image options?
     $QEMU_IMG create -f $IMGFMT $TEST_IMG $extra_img_options | \
     	sed -e "s#$TEST_DIR#TEST_DIR#g" | \
Signature · 1 line
1.6.2.5
author
#2 lore raw

PATCH 2/3 qemu-iotests: 019: Make cluster size dynamic

In reply to Kevin Wolf

Change the offsets for test requests according to CLUSTER_SIZE.

---
 019 |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
 mode change 100644 => 100755 021
019 +6 -6
index c3bf950..20893c5 100755
@@ -60,7 +60,7 @@ for offset in $TEST_OFFSETS; do
     io writev $(( offset )) 512 1024 64
 
     # Complete backing clusters
-    io writev $(( offset  + 1024 * 1024))  65536 65536 1
+    io writev $(( offset  + 1024 * 1024))  $CLUSTER_SIZE $CLUSTER_SIZE 1
 done
 _check_test_img
 
@@ -78,7 +78,7 @@ for offset in $TEST_OFFSETS; do
     io writev $(( offset + 512 )) 512 1024 64
 
     # Complete test image clusters
-    io writev $(( offset + 1024 * 1024 + 65536))  65536 65536 1
+    io writev $(( offset + 1024 * 1024 + $CLUSTER_SIZE))  $CLUSTER_SIZE $CLUSTER_SIZE 1
 done
 _check_test_img
 
@@ -89,7 +89,7 @@ echo "Checking if backing clusters are allocated when they shouldn't"
 echo
 for offset in $TEST_OFFSETS; do
     # Complete backing clusters
-    is_allocated $(( offset  + 1024 * 1024))  65536 65536 1
+    is_allocated $(( offset  + 1024 * 1024))  $CLUSTER_SIZE $CLUSTER_SIZE 1
 done
 
 echo "Reading"
@@ -101,11 +101,11 @@ for offset in $TEST_OFFSETS; do
     io readv $(( offset + 512 )) 512 1024 64
 
     # Complete test image clusters
-    io readv $(( offset  + 1024 * 1024))  65536 65536 1
-    io readv $(( offset + 1024 * 1024 + 65536))  65536 65536 1
+    io readv $(( offset  + 1024 * 1024))  $CLUSTER_SIZE $CLUSTER_SIZE 1
+    io readv $(( offset + 1024 * 1024 + $CLUSTER_SIZE))  $CLUSTER_SIZE $CLUSTER_SIZE 1
 
     # Empty sectors
-    io_zero readv $(( offset + 1024 * 1024 + 65536 * 4 )) 65536 65536 1
+    io_zero readv $(( offset + 1024 * 1024 + $CLUSTER_SIZE * 4 )) $CLUSTER_SIZE $CLUSTER_SIZE 1
 done
 _check_test_img
 
021 +0 -0
old mode 100644
new mode 100755
Signature · 1 line
1.6.2.5
author
#3 lore raw

PATCH 3/3 qemu-iotests: Tests on non-4k clusters

In reply to Kevin Wolf

This one is a bit larger (1,5 MB) as it contains lots of expected test output. So I decided it might be inappropriate to send an email of this size to the list. Please find the compressed patch attached.

Quoted 1 line

From 0f6107fa4f4f58245b8fdd46f63dbba129bf9da3 Mon Sep 17 00:00:00 2001

From: Kevin Wolf <[email protected]>
Date: Fri, 25 Sep 2009 19:19:44 +0200
Subject: [PATCH 3/3] qemu-iotests: Tests on non-4k clusters

This patch adds test case 023 which tests some more cluster sizes. For anythinger larger than 4k clusters we can't use requests that are l2_size or more (128k for 1k clusters, 2 MB for 4k clusters, 512 MB for 64k clusters). Therefore one of the common.pattern cases is changed and needs new expected results for some old test cases.

---
 013.out        |  680 +-
 014.out        |  816 +-
 022.out        |  136 +-
 023            |  119 +
 023.out        |25706
++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 common.pattern |    5 +-
 group          |    1 +
 7 files changed, 26645 insertions(+), 818 deletions(-)
 create mode 100755 023
 create mode 100644 023.out
#4 lore raw
In reply to Kevin Wolf
Quoted 6 lines · Kevin Wolf

Currently, all qcow2 tests align their test requests to hit the critical spots in images that use 4k clusters. By default we are using 64k clusters now for a while, so we need to make the tests more dynamic.

This patch series makes the cluster size variable in some of the generic code like common.pattern and adds a test case for the non-4k cluster case.

Thanks, I've put all three patches in.