qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Kevin Wolf <kwolf@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] the qemu-iotests test suite is now available
Date: Mon, 6 Jul 2009 19:36:06 +0200	[thread overview]
Message-ID: <20090706173606.GA2379@lst.de> (raw)
In-Reply-To: <4A51DD6C.8030907@redhat.com>

On Mon, Jul 06, 2009 at 01:18:04PM +0200, Kevin Wolf wrote:
> I started to implement this, too. I'm attaching the current state of my
> version. It's not as complete (converts only io_test() and doesn't even
> enable different cluster sizes in the tests), but it's a pure 1:1
> conversion and it remains compatible with the old test results which is
> a hint that it's right at least for 4k clusters.
> 
> I haven't reviewed your patch in much detail, but I think my patch is
> more correct at least for the "spanning multiple L2 tables" case where
> you still use the old hard coded numbers. With 4k clusters an L2 table
> spans 2 MB, whereas with 64k clusters it spans 512 MB.

You're right.

> So maybe you just compare the two versions and take for each line
> whatever looks better suited for dynamic cluster sizes.

Done.  Below is a version of my original patch with you l2 cluster size
changes incorporate.  The problem is that I really uses up tons of disk
space for the last test in io_test() for 64k clusters, in fact more than
I can make available on the laptop I'm travelling with currently..

Index: qemu-iotests/common.pattern
===================================================================
--- qemu-iotests.orig/common.pattern	2009-07-06 16:51:59.072239848 +0200
+++ qemu-iotests/common.pattern	2009-07-06 17:22:34.402241220 +0200
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 #
 # Copyright (C) 2009 Red Hat, Inc.
 #
@@ -50,69 +50,71 @@ function io_zero() {
 function io_test() {
     local op=$1
     local offset=$2
-
-    # Complete clusters (size = 4k)
-    io $op $offset 4096 4096 256
-    offset=$((offset + 256 * 4096))
+    local cluster_size=$3
+    local half_cluster=$((cluster_size / 2))
+    local quarter_cluster=$((cluster_size / 4))
+    local l2_size=$((cluster_size * cluster_size / 8))
+
+    # Complete clusters
+    io $op $offset $cluster_size $cluster_size 256
+    offset=$((offset + 256 * $cluster_size))
 
     # From somewhere in the middle to the end of a cluster
-    io $op $((offset + 2048)) 2048 4096 256
-    offset=$((offset + 256 * 4096))
+    io $op $((offset + $half_cluster)) $half_cluster $cluster_size 256
+    offset=$((offset + 256 * $cluster_size))
 
     # From the start to somewhere in the middle of a cluster
-    io $op $offset 2048 4096 256
-    offset=$((offset + 256 * 4096))
+    io $op $offset $half_cluster $cluster_size 256
+    offset=$((offset + 256 * $cluster_size))
 
     # Completely misaligned (and small)
-    io $op $((offset + 1024)) 2048 4096 256
-    offset=$((offset + 256 * 4096))
+    io $op $((offset + $quarter_cluster)) $half_cluster $cluster_size 256
+    offset=$((offset + 256 * $cluster_size))
 
     # Spanning multiple clusters
-    io $op $((offset + 2048)) 8192 12288 64
-    offset=$((offset + 64 * 12288))
+    io $op $((offset + $half_cluster)) $((cluster_size * 2)) $((cluster_size * 3)) 64
+    offset=$((offset + 64 * 3 * $cluster_size))
 
     # Spanning multiple L2 tables
     # L2 table size: 512 clusters of 4k = 2M
-    io $op $((offset + 2048)) 4194304 4999680 8
-    offset=$((offset + 8 * 4999680))
-
-    if false; then
-        true
-    fi
+    io $op $((offset + $half_cluster)) $((2 * l2_size)) 4999680 8
+    offset=$((offset + 8 * (2 * l2_size + 512 * 1573)))
 }
 
 function io_test2() {
     local orig_offset=$1
+    local cluster_size=$2
 
     # Pattern (repeat after 9 clusters):
-    # used - used - free - used - compressed - compressed - free - free - compressed
+    #	used - used - free - used - compressed - compressed -
+    #	free - free - compressed
 
     # Write the clusters to be compressed
     echo === Clusters to be compressed [1]
-    io_pattern writev $((offset + 4 * 4096)) 4096 $((9 * 4096)) 256 165
+    io_pattern writev $((offset + 4 * $cluster_size)) $cluster_size $((9 * $cluster_size)) 256 165
     echo === Clusters to be compressed [2]
-    io_pattern writev $((offset + 5 * 4096)) 4096 $((9 * 4096)) 256 165
+    io_pattern writev $((offset + 5 * $cluster_size)) $cluster_size $((9 * $cluster_size)) 256 165
     echo === Clusters to be compressed [3]
-    io_pattern writev $((offset + 8 * 4096)) 4096 $((9 * 4096)) 256 165
+    io_pattern writev $((offset + 8 * $cluster_size)) $cluster_size $((9 * $cluster_size)) 256 165
 
     mv $TEST_IMG $TEST_IMG.orig
-    $QEMU_IMG convert -f qcow2 -O qcow2 -c $TEST_IMG.orig $TEST_IMG
+    $QEMU_IMG convert -f $IMGFMT -O $IMGFMT -c $TEST_IMG.orig $TEST_IMG
 
     # Write the used clusters
     echo === Used clusters [1]
-    io_pattern writev $((offset + 0 * 4096)) 4096 $((9 * 4096)) 256 165
+    io_pattern writev $((offset + 0 * $cluster_size)) $cluster_size $((9 * $cluster_size)) 256 165
     echo === Used clusters [2]
-    io_pattern writev $((offset + 1 * 4096)) 4096 $((9 * 4096)) 256 165
+    io_pattern writev $((offset + 1 * $cluster_size)) $cluster_size $((9 * $cluster_size)) 256 165
     echo === Used clusters [3]
-    io_pattern writev $((offset + 3 * 4096)) 4096 $((9 * 4096)) 256 165
+    io_pattern writev $((offset + 3 * $cluster_size)) $cluster_size $((9 * $cluster_size)) 256 165
 
     # Read them
     echo === Read used/compressed clusters
-    io_pattern readv $((offset + 0 * 4096)) $((2 * 4096)) $((9 * 4096)) 256 165
-    io_pattern readv $((offset + 3 * 4096)) $((3 * 4096)) $((9 * 4096)) 256 165
-    io_pattern readv $((offset + 8 * 4096)) $((1 * 4096)) $((9 * 4096)) 256 165
+    io_pattern readv $((offset + 0 * $cluster_size)) $((2 * $cluster_size)) $((9 * $cluster_size)) 256 165
+    io_pattern readv $((offset + 3 * $cluster_size)) $((3 * $cluster_size)) $((9 * $cluster_size)) 256 165
+    io_pattern readv $((offset + 8 * $cluster_size)) $((1 * $cluster_size)) $((9 * $cluster_size)) 256 165
 
     echo === Read zeros
-    io_zero readv $((offset + 2 * 4096)) $((1 * 4096)) $((9 * 4096)) 256
-    io_zero readv $((offset + 6 * 4096)) $((2 * 4096)) $((9 * 4096)) 256
+    io_zero readv $((offset + 2 * $cluster_size)) $((1 * $cluster_size)) $((9 * $cluster_size)) 256
+    io_zero readv $((offset + 6 * $cluster_size)) $((2 * $cluster_size)) $((9 * $cluster_size)) 256
 }
Index: qemu-iotests/013
===================================================================
--- qemu-iotests.orig/013	2009-07-06 16:51:59.078239705 +0200
+++ qemu-iotests/013	2009-07-06 16:52:04.029389748 +0200
@@ -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.
 #
@@ -47,6 +47,7 @@ _supported_os Linux
 
 TEST_OFFSETS="0 4294967296"
 TEST_OPS="writev read write readv"
+CLUSTER_SIZE=4096
 
 _make_test_img 6G
 
@@ -56,7 +57,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
     done
     _check_test_img
 done
@@ -74,7 +75,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
     done
     _check_test_img
 done
@@ -87,7 +88,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
     done
     _check_test_img
 done
Index: qemu-iotests/014
===================================================================
--- qemu-iotests.orig/014	2009-07-06 16:51:59.083239854 +0200
+++ qemu-iotests/014	2009-07-06 16:52:04.030397139 +0200
@@ -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.
@@ -48,13 +49,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
     _check_test_img
 done
 
@@ -64,7 +66,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
         done
         _check_test_img
     done
Index: qemu-iotests/group
===================================================================
--- qemu-iotests.orig/group	2009-07-06 16:51:59.100239157 +0200
+++ qemu-iotests/group	2009-07-06 16:52:04.434485231 +0200
@@ -22,3 +22,5 @@
 013 rw auto
 014 rw auto
 015 rw snapshot auto
+016 rw auto
+017 rw auto

  reply	other threads:[~2009-07-06 17:36 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-22 21:05 [Qemu-devel] the qemu-iotests test suite is now available Christoph Hellwig
2009-06-23  9:16 ` Kevin Wolf
2009-06-23 14:31   ` Christoph Hellwig
2009-06-23 14:36     ` Kevin Wolf
2009-06-23 16:41       ` Christoph Hellwig
2009-06-24  7:35         ` Kevin Wolf
2009-07-06 11:18         ` Kevin Wolf
2009-07-06 17:36           ` Christoph Hellwig [this message]
2009-07-07  7:30             ` Kevin Wolf
2009-09-11 14:04             ` Kevin Wolf
2009-09-11 18:40               ` Christoph Hellwig
2009-09-14  8:03                 ` Kevin Wolf
2009-06-23 16:03 ` Anthony Liguori
2009-06-23 16:36   ` Christoph Hellwig
2009-06-24  9:12     ` Kevin Wolf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090706173606.GA2379@lst.de \
    --to=hch@lst.de \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).