>From ddacd8285b140427ced9b61c5a74e47ed1d067b6 Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Fri, 3 Jul 2009 16:21:12 +0200 Subject: [PATCH] qemu-iotests: Allow varying cluster sizes in io_test() The offsets for qemu-io test requests in io_test() are meant to touch different cases in the cluster allocation. To actually test what they are meant for, the cluster size the tests assume and the actual cluster size of the image must match. Currently, the offsets are calculated to fit 4k clusters. This patch introduces a CLUSTER_SIZE variable and makes the offset calculation dependent on the cluster size, allowing varying cluster sizes. If the variable is not set, the default is still 4k. Signed-off-by: Kevin Wolf --- common.pattern | 34 ++++++++++++++++++++-------------- 1 files changed, 20 insertions(+), 14 deletions(-) diff --git a/common.pattern b/common.pattern index f1b1829..4178c0b 100644 --- a/common.pattern +++ b/common.pattern @@ -51,30 +51,36 @@ function io_test() { local op=$1 local offset=$2 - # Complete clusters (size = 4k) - io $op $offset 4096 4096 256 - offset=$((offset + 256 * 4096)) + if [ -z "$CLUSTER_SIZE" ]; then + CLUSTER_SIZE=4096 + fi + + quarter=$((CLUSTER_SIZE / 4)) + 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 + 2 * quarter)) $((2 * quarter)) $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 $((2 * quarter)) $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)) $((2 * quarter)) $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 + 2 * quarter)) $((2 * CLUSTER_SIZE)) $((3 * CLUSTER_SIZE)) 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)) + io $op $((offset + 2 * quarter)) $((2 * l2_size)) $((2 * l2_size + 512 * 1573)) 8 + offset=$((offset + 8 * (2 * l2_size + 512 * 1573) )) if false; then true -- 1.6.0.6