From 5545adeadf17dc7ef4f85c3090205e382c7d7892 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 30 Jul 2010 21:40:49 -0700 Subject: [PATCH] Use sparse files for loopback+file configurations Using sparse files for the test configurations had atleast three significant advantages. 1) Actually test sparse files to ensure they work. 2) Drastically reduce required disk space for the regression test suite. This turns out to be fairly important when running the test suite in a virtualized environment. 3) Significantly speed of the test suite. Run time of zconfig.sh dropped from 2m:56s to 1m:00s on my test system, zpios-sanity.sh nows runs in only 0m:26s. --- scripts/zpool-config/file-raid0.sh | 4 ++-- scripts/zpool-config/file-raid10.sh | 4 ++-- scripts/zpool-config/file-raidz.sh | 4 ++-- scripts/zpool-config/file-raidz2.sh | 4 ++-- scripts/zpool-config/lo-raid0.sh | 4 ++-- scripts/zpool-config/lo-raid10.sh | 8 ++++---- scripts/zpool-config/lo-raidz.sh | 4 ++-- scripts/zpool-config/lo-raidz2.sh | 4 ++-- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/scripts/zpool-config/file-raid0.sh b/scripts/zpool-config/file-raid0.sh index 14429c43d9..5ec80b05c1 100644 --- a/scripts/zpool-config/file-raid0.sh +++ b/scripts/zpool-config/file-raid0.sh @@ -12,8 +12,8 @@ zpool_create() { for FILE in ${FILES}; do msg "Creating ${FILE}" rm -f ${FILE} || exit 1 - dd if=/dev/zero of=${FILE} bs=1024k count=256 &>/dev/null || - die "Error $? creating ${FILE}" + dd if=/dev/zero of=${FILE} bs=1024k count=0 seek=256 \ + &>/dev/null || die "Error $? creating ${FILE}" done msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${FILES} diff --git a/scripts/zpool-config/file-raid10.sh b/scripts/zpool-config/file-raid10.sh index a632a4f4cd..ae7f0ae07b 100644 --- a/scripts/zpool-config/file-raid10.sh +++ b/scripts/zpool-config/file-raid10.sh @@ -13,8 +13,8 @@ zpool_create() { for FILE in ${FILES}; do msg "Creating ${FILE}" rm -f ${FILE} || exit 1 - dd if=/dev/zero of=${FILE} bs=1024k count=256 &>/dev/null || - die "Error $? creating ${FILE}" + dd if=/dev/zero of=${FILE} bs=1024k count=0 seek=256 \ + &>/dev/null || die "Error $? creating ${FILE}" done msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} \ diff --git a/scripts/zpool-config/file-raidz.sh b/scripts/zpool-config/file-raidz.sh index 9302c85e97..5b6c3ea2c2 100644 --- a/scripts/zpool-config/file-raidz.sh +++ b/scripts/zpool-config/file-raidz.sh @@ -12,8 +12,8 @@ zpool_create() { for FILE in ${FILES}; do msg "Creating ${FILE}" rm -f ${FILE} || exit 1 - dd if=/dev/zero of=${FILE} bs=1024k count=256 &>/dev/null || - die "Error $? creating ${FILE}" + dd if=/dev/zero of=${FILE} bs=1024k count=0 seek=256 \ + &>/dev/null || die "Error $? creating ${FILE}" done msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz ${FILES} diff --git a/scripts/zpool-config/file-raidz2.sh b/scripts/zpool-config/file-raidz2.sh index 681352783c..bc0e5ec8af 100644 --- a/scripts/zpool-config/file-raidz2.sh +++ b/scripts/zpool-config/file-raidz2.sh @@ -12,8 +12,8 @@ zpool_create() { for FILE in ${FILES}; do msg "Creating ${FILE}" rm -f ${FILE} || exit 1 - dd if=/dev/zero of=${FILE} bs=1024k count=256 &>/dev/null || - die "Error $? creating ${FILE}" + dd if=/dev/zero of=${FILE} bs=1024k count=0 seek=256 \ + &>/dev/null || die "Error $? creating ${FILE}" done msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz2 ${FILES} diff --git a/scripts/zpool-config/lo-raid0.sh b/scripts/zpool-config/lo-raid0.sh index d37d5138f7..321d9b1f71 100644 --- a/scripts/zpool-config/lo-raid0.sh +++ b/scripts/zpool-config/lo-raid0.sh @@ -14,8 +14,8 @@ zpool_create() { DEVICE=`unused_loop_device` msg "Creating ${FILE} using loopback device ${DEVICE}" rm -f ${FILE} || exit 1 - dd if=/dev/zero of=${FILE} bs=1024k count=256 &>/dev/null || - die "Error $? creating ${FILE}" + dd if=/dev/zero of=${FILE} bs=1024k count=0 seek=256 \ + &>/dev/null || die "Error $? creating ${FILE}" ${LOSETUP} ${DEVICE} ${FILE} || die "Error $? creating ${FILE} -> ${DEVICE} loopback" DEVICES="${DEVICES} ${DEVICE}" diff --git a/scripts/zpool-config/lo-raid10.sh b/scripts/zpool-config/lo-raid10.sh index 8d3672dd1b..f9c47cd1e1 100644 --- a/scripts/zpool-config/lo-raid10.sh +++ b/scripts/zpool-config/lo-raid10.sh @@ -16,8 +16,8 @@ zpool_create() { DEVICE=`unused_loop_device` msg "Creating ${FILE} using loopback device ${DEVICE}" rm -f ${FILE} || exit 1 - dd if=/dev/zero of=${FILE} bs=1024k count=256 &>/dev/null || - die "Error $? creating ${FILE}" + dd if=/dev/zero of=${FILE} bs=1024k count=0 seek=256 \ + &>/dev/null || die "Error $? creating ${FILE}" ${LOSETUP} ${DEVICE} ${FILE} || die "Error $? creating ${FILE} -> ${DEVICE} loopback" DEVICES_M1="${DEVICES_M1} ${DEVICE}" @@ -27,8 +27,8 @@ zpool_create() { DEVICE=`unused_loop_device` msg "Creating ${FILE} using loopback device ${DEVICE}" rm -f ${FILE} || exit 1 - dd if=/dev/zero of=${FILE} bs=1024k count=256 &>/dev/null || - die "Error $? creating ${FILE}" + dd if=/dev/zero of=${FILE} bs=1024k count=0 seek=256 \ + &>/dev/null || die "Error $? creating ${FILE}" ${LOSETUP} ${DEVICE} ${FILE} || die "Error $? creating ${FILE} -> ${DEVICE} loopback" DEVICES_M2="${DEVICES_M2} ${DEVICE}" diff --git a/scripts/zpool-config/lo-raidz.sh b/scripts/zpool-config/lo-raidz.sh index 6efcd1041a..509f6ee1d7 100644 --- a/scripts/zpool-config/lo-raidz.sh +++ b/scripts/zpool-config/lo-raidz.sh @@ -14,8 +14,8 @@ zpool_create() { DEVICE=`unused_loop_device` msg "Creating ${FILE} using loopback device ${DEVICE}" rm -f ${FILE} || exit 1 - dd if=/dev/zero of=${FILE} bs=1024k count=256 &>/dev/null || - die "Error $? creating ${FILE}" + dd if=/dev/zero of=${FILE} bs=1024k count=0 seek=256 \ + &>/dev/null || die "Error $? creating ${FILE}" ${LOSETUP} ${DEVICE} ${FILE} || die "Error $? creating ${FILE} -> ${DEVICE} loopback" DEVICES="${DEVICES} ${DEVICE}" diff --git a/scripts/zpool-config/lo-raidz2.sh b/scripts/zpool-config/lo-raidz2.sh index f59c7f2d65..6e61293c0b 100644 --- a/scripts/zpool-config/lo-raidz2.sh +++ b/scripts/zpool-config/lo-raidz2.sh @@ -14,8 +14,8 @@ zpool_create() { DEVICE=`unused_loop_device` msg "Creating ${FILE} using loopback device ${DEVICE}" rm -f ${FILE} || exit 1 - dd if=/dev/zero of=${FILE} bs=1024k count=256 &>/dev/null || - die "Error $? creating ${FILE}" + dd if=/dev/zero of=${FILE} bs=1024k count=0 seek=256 \ + &>/dev/null || die "Error $? creating ${FILE}" ${LOSETUP} ${DEVICE} ${FILE} || die "Error $? creating ${FILE} -> ${DEVICE} loopback" DEVICES="${DEVICES} ${DEVICE}"