2008-12-05 19:32:34 +00:00
|
|
|
#!/bin/bash
|
2009-01-16 20:19:15 +00:00
|
|
|
#
|
|
|
|
# Wrapper script for easily running zpios based tests
|
|
|
|
#
|
|
|
|
|
|
|
|
. ./common.sh
|
|
|
|
PROG=zpios.sh
|
|
|
|
|
|
|
|
PROFILE_ZPIOS_PRE=${TOPDIR}/scripts/profile-zpios-pre.sh
|
|
|
|
PROFILE_ZPIOS_POST=${TOPDIR}/scripts/profile-zpios-post.sh
|
|
|
|
|
|
|
|
MODULES=( \
|
|
|
|
${MODDIR}/zpios/zpios.ko \
|
|
|
|
)
|
|
|
|
|
|
|
|
usage() {
|
|
|
|
cat << EOF
|
|
|
|
USAGE:
|
|
|
|
$0 [hvp] [c <config>]
|
|
|
|
|
|
|
|
DESCRIPTION:
|
|
|
|
Helper script for easy zpios benchmarking.
|
|
|
|
|
|
|
|
OPTIONS:
|
|
|
|
-h Show this message
|
|
|
|
-v Verbose
|
|
|
|
-p Enable profiling
|
|
|
|
-c Specify disk configuration
|
|
|
|
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
|
|
|
print_header() {
|
|
|
|
echo --------------------- ZPIOS RESULTS ----------------------------
|
|
|
|
echo -n "Date: "; date
|
|
|
|
echo -n "Kernel: "; uname -r
|
|
|
|
dmesg | grep "Loaded Solaris Porting Layer" | tail -n1
|
|
|
|
dmesg | grep "Loaded ZFS Filesystem" | tail -n1
|
|
|
|
echo
|
|
|
|
}
|
|
|
|
|
|
|
|
print_spl_info() {
|
|
|
|
echo --------------------- SPL Tunings ------------------------------
|
|
|
|
sysctl -A | grep spl
|
2008-12-05 19:32:34 +00:00
|
|
|
|
2009-01-16 20:19:15 +00:00
|
|
|
if [ -d /sys/module/spl/parameters ]; then
|
|
|
|
grep [0-9] /sys/module/spl/parameters/*
|
|
|
|
else
|
|
|
|
grep [0-9] /sys/module/spl/*
|
|
|
|
fi
|
2008-12-05 19:32:34 +00:00
|
|
|
|
2009-01-16 20:19:15 +00:00
|
|
|
echo
|
|
|
|
}
|
2008-12-05 19:32:34 +00:00
|
|
|
|
2009-01-16 20:19:15 +00:00
|
|
|
print_zfs_info() {
|
|
|
|
echo --------------------- ZFS Tunings ------------------------------
|
|
|
|
sysctl -A | grep zfs
|
2008-12-05 19:32:34 +00:00
|
|
|
|
2009-01-16 20:19:15 +00:00
|
|
|
if [ -d /sys/module/zfs/parameters ]; then
|
|
|
|
grep [0-9] /sys/module/zfs/parameters/*
|
|
|
|
else
|
|
|
|
grep [0-9] /sys/module/zfs/*
|
|
|
|
fi
|
2008-12-05 19:32:34 +00:00
|
|
|
|
2009-01-16 20:19:15 +00:00
|
|
|
echo
|
|
|
|
}
|
|
|
|
|
|
|
|
print_stats() {
|
|
|
|
echo ---------------------- Statistics -------------------------------
|
|
|
|
sysctl -A | grep spl | grep stack_max
|
|
|
|
|
|
|
|
if [ -d /proc/spl/kstat/ ]; then
|
|
|
|
if [ -f /proc/spl/kstat/zfs/arcstats ]; then
|
|
|
|
echo "* ARC"
|
|
|
|
cat /proc/spl/kstat/zfs/arcstats
|
|
|
|
echo
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -f /proc/spl/kstat/zfs/vdev_cache_stats ]; then
|
|
|
|
echo "* VDEV Cache"
|
|
|
|
cat /proc/spl/kstat/zfs/vdev_cache_stats
|
|
|
|
echo
|
|
|
|
fi
|
|
|
|
fi
|
2009-01-14 17:18:16 +00:00
|
|
|
|
2009-01-16 20:19:15 +00:00
|
|
|
if [ -f /proc/spl/kmem/slab ]; then
|
|
|
|
echo "* SPL SLAB"
|
|
|
|
cat /proc/spl/kmem/slab
|
|
|
|
echo
|
|
|
|
fi
|
|
|
|
}
|
2009-01-14 18:40:50 +00:00
|
|
|
|
2009-01-16 20:19:15 +00:00
|
|
|
check_test() {
|
|
|
|
|
|
|
|
if [ ! -f ${ZPIOS_TEST} ]; then
|
|
|
|
local NAME=`basename ${ZPIOS_TEST} .cfg`
|
|
|
|
ERROR="Unknown test '${NAME}', available tests are:\n"
|
|
|
|
|
|
|
|
for TST in `ls ${TOPDIR}/scripts/zpios-test/`; do
|
|
|
|
local NAME=`basename ${TST} .cfg`
|
|
|
|
ERROR="${ERROR}${NAME}\n"
|
|
|
|
done
|
|
|
|
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
PROFILE=
|
|
|
|
ZPOOL_CONFIG="zpool-config.cfg"
|
|
|
|
ZPIOS_TEST="zpios-test.cfg"
|
|
|
|
|
|
|
|
while getopts 'hvpc:t:' OPTION; do
|
|
|
|
case $OPTION in
|
|
|
|
h)
|
|
|
|
usage
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
v)
|
|
|
|
VERBOSE=1
|
|
|
|
;;
|
|
|
|
p)
|
|
|
|
PROFILE=1
|
|
|
|
;;
|
|
|
|
c)
|
2009-01-16 20:23:53 +00:00
|
|
|
ZPOOL_CONFIG=${OPTARG}
|
2009-01-16 20:19:15 +00:00
|
|
|
;;
|
|
|
|
t)
|
|
|
|
ZPIOS_TEST=${TOPDIR}/scripts/zpios-test/${OPTARG}.cfg
|
|
|
|
;;
|
|
|
|
?)
|
|
|
|
usage
|
|
|
|
exit
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ $(id -u) != 0 ]; then
|
|
|
|
die "Must run as root"
|
2009-01-13 19:16:12 +00:00
|
|
|
fi
|
|
|
|
|
2009-01-16 20:23:53 +00:00
|
|
|
# Validate your using a known test
|
2009-01-16 20:19:15 +00:00
|
|
|
check_test || die "${ERROR}"
|
|
|
|
|
|
|
|
# Pull in the zpios test module is not loaded. If this fails it is
|
|
|
|
# likely because the full module stack was not yet loaded with zfs.sh
|
|
|
|
if check_modules; then
|
|
|
|
if ! load_modules; then
|
|
|
|
die "Run 'zfs.sh' to ensure the full module stack is loaded"
|
|
|
|
fi
|
2008-12-05 19:32:34 +00:00
|
|
|
fi
|
|
|
|
|
2009-01-16 20:19:15 +00:00
|
|
|
if [ ${VERBOSE} ]; then
|
|
|
|
print_header
|
|
|
|
print_spl_info
|
|
|
|
print_zfs_info
|
|
|
|
fi
|
|
|
|
|
2009-01-16 20:23:53 +00:00
|
|
|
# Create the zpool configuration
|
|
|
|
./zpool-create.sh -c ${ZPOOL_CONFIG} || exit 1
|
2008-12-05 19:32:34 +00:00
|
|
|
|
2009-01-16 20:19:15 +00:00
|
|
|
msg "${CMDDIR}/zpool/zpool status zpios"
|
|
|
|
${CMDDIR}/zpool/zpool status zpios || exit 1
|
2008-12-05 19:32:34 +00:00
|
|
|
|
2009-01-16 20:19:15 +00:00
|
|
|
msg "Waiting for /dev/zpios to come up..."
|
2008-12-05 19:32:34 +00:00
|
|
|
while [ ! -c /dev/zpios ]; do
|
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ -n "${ZPIOS_PRE}" ]; then
|
2009-01-16 20:19:15 +00:00
|
|
|
msg "Executing ${ZPIOS_PRE}"
|
2009-01-09 00:53:29 +00:00
|
|
|
${ZPIOS_PRE} || exit 1
|
2008-12-05 19:32:34 +00:00
|
|
|
fi
|
|
|
|
|
2009-01-16 20:19:15 +00:00
|
|
|
# Source the zpios test configuration
|
|
|
|
. ${ZPIOS_TEST}
|
|
|
|
|
|
|
|
if [ $PROFILE ]; then
|
|
|
|
ZPIOS_CMD="${ZPIOS_CMD} --log=${PROFILE_ZPIOS_LOGS}"
|
|
|
|
ZPIOS_CMD="${ZPIOS_CMD} --prerun=${PROFILE_ZPIOS_PRE}"
|
|
|
|
ZPIOS_CMD="${ZPIOS_CMD} --postrun=${PROFILE_ZPIOS_POST}"
|
|
|
|
fi
|
|
|
|
|
2008-12-05 19:32:34 +00:00
|
|
|
echo
|
|
|
|
date
|
2009-01-16 20:19:15 +00:00
|
|
|
echo ${ZPIOS_CMD}
|
|
|
|
$ZPIOS_CMD || exit 1
|
2008-12-05 19:32:34 +00:00
|
|
|
|
|
|
|
if [ -n "${ZPIOS_POST}" ]; then
|
2009-01-16 20:19:15 +00:00
|
|
|
msg "Executing ${ZPIOS_POST}"
|
2009-01-09 00:53:29 +00:00
|
|
|
${ZPIOS_POST} || exit 1
|
2008-12-05 19:32:34 +00:00
|
|
|
fi
|
|
|
|
|
2009-01-16 20:19:15 +00:00
|
|
|
msg "${CMDDIR}/zpool/zpool destroy zpios"
|
|
|
|
${CMDDIR}/zpool/zpool destroy zpios
|
2008-12-05 19:32:34 +00:00
|
|
|
|
2009-01-16 20:19:15 +00:00
|
|
|
print_stats
|
2009-01-09 00:53:29 +00:00
|
|
|
|
|
|
|
exit 0
|