diff --git a/config/zfs-build.m4 b/config/zfs-build.m4 index f8ae21eeee..e3b527bced 100644 --- a/config/zfs-build.m4 +++ b/config/zfs-build.m4 @@ -53,16 +53,21 @@ CMDDIR=${CMDDIR} MODDIR=${MODDIR} SCRIPTDIR=${SCRIPTDIR} ZPOOLDIR=\${TOPDIR}/scripts/zpool-config +ZPIOSDIR=\${TOPDIR}/scripts/zpios-test +ZPIOSPROFILEDIR=\${TOPDIR}/scripts/zpios-profile ZDB=\${CMDDIR}/zdb/zdb ZFS=\${CMDDIR}/zfs/zfs ZINJECT=\${CMDDIR}/zinject/zinject ZPOOL=\${CMDDIR}/zpool/zpool ZTEST=\${CMDDIR}/ztest/ztest +ZPIOS=\${CMDDIR}/zpios/zpios COMMON_SH=\${SCRIPTDIR}/common.sh ZFS_SH=\${SCRIPTDIR}/zfs.sh ZPOOL_CREATE_SH=\${SCRIPTDIR}/zpool-create.sh +ZPIOS_SH=\${SCRIPTDIR}/zpios.sh +ZPIOS_SURVEY_SH=\${SCRIPTDIR}/zpios-survey.sh LDMOD=/sbin/insmod @@ -82,6 +87,10 @@ ZFS_MODULES=( \\ \${MODDIR}/zfs/zfs.ko \\ ) +ZPIOS_MODULES=( \\ + \${MODDIR}/zpios/zpios.ko \\ +) + MODULES=( \\ \${KERNEL_MODULES[[*]]} \\ \${SPL_MODULES[[*]]} \\ diff --git a/scripts/Makefile.am b/scripts/Makefile.am index c3ddb82eb9..ef3e889a44 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -3,6 +3,10 @@ nobase_pkglibexec_SCRIPTS = common.sh nobase_pkglibexec_SCRIPTS += zfs.sh nobase_pkglibexec_SCRIPTS += zpool-create.sh nobase_pkglibexec_SCRIPTS += zpool-config/* +nobase_pkglibexec_SCRIPTS += zpios.sh +nobase_pkglibexec_SCRIPTS += zpios-survey.sh +nobase_pkglibexec_SCRIPTS += zpios-test/* +nobase_pkglibexec_SCRIPTS += zpios-profile/* EXTRA_DIST = zfs-update.sh $(nobase_pkglibexec_SCRIPTS) ZFS=${top_srcdir}/scripts/zfs.sh diff --git a/scripts/common.sh b/scripts/common.sh index 75f811e83c..592b04f852 100755 --- a/scripts/common.sh +++ b/scripts/common.sh @@ -19,16 +19,21 @@ DUMP_LOG= ERROR= ZPOOLDIR=${ZPOOLDIR:-/usr/libexec/zfs/zpool-config} +ZPIOSDIR=${ZPIOSDIR:-/usr/libexec/zfs/zpios-test} +ZPIOSPROFILEDIR=${ZPIOSPROFILEDIR:-/usr/libexec/zfs/zpios-profile} ZDB=${ZDB:-/usr/sbin/zdb} ZFS=${ZFS:-/usr/sbin/zfs} ZINJECT=${ZINJECT:-/usr/sbin/zinject} ZPOOL=${ZPOOL:-/usr/sbin/zpool} ZTEST=${ZTEST:-/usr/sbin/ztest} +ZPIOS=${ZPIOS:-/usr/sbin/zpios} COMMON_SH=${COMMON_SH:-/usr/libexec/zfs/common.sh} ZFS_SH=${ZFS_SH:-/usr/libexec/zfs/zfs.sh} ZPOOL_CREATE_SH=${ZPOOL_CREATE_SH:-/usr/libexec/zfs/zpool-create.sh} +ZPIOS_SH=${ZPIOS_SH:-/usr/libexec/zfs/zpios.sh} +ZPIOS_SURVEY_SH=${ZPIOS_SURVEY_SH:-/usr/libexec/zfs/zpios-survey.sh} LDMOD=${LDMOD:-/sbin/modprobe} LSMOD=${LSMOD:-/sbin/lsmod} diff --git a/scripts/zpios-profile/Makefile.am b/scripts/zpios-profile/Makefile.am deleted file mode 100644 index 07cf7ead3a..0000000000 --- a/scripts/zpios-profile/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -EXTRA_DIST = *.sh diff --git a/scripts/zpios-survey.sh b/scripts/zpios-survey.sh index 0594f13873..0b16d1bb82 100755 --- a/scripts/zpios-survey.sh +++ b/scripts/zpios-survey.sh @@ -3,7 +3,15 @@ # Wrapper script for easily running a survey of zpios based tests # -. ./common.sh +SCRIPT_COMMON=common.sh +if [ -f ./${SCRIPT_COMMON} ]; then +. ./${SCRIPT_COMMON} +elif [ -f /usr/libexec/zfs/${SCRIPT_COMMON} ]; then +. /usr/libexec/zfs/${SCRIPT_COMMON} +else +echo "Missing helper script ${SCRIPT_COMMON}" && exit 1 +fi + PROG=zpios-survey.sh usage() { @@ -40,11 +48,11 @@ zpios_survey_base() { TEST_NAME="${ZPOOL_CONFIG}+${ZPIOS_TEST}+baseline" print_header ${TEST_NAME} - ./zfs.sh ${VERBOSE_FLAG} | \ + ${ZFS_SH} ${VERBOSE_FLAG} | \ tee -a ${ZPIOS_SURVEY_LOG} - ./zpios.sh ${VERBOSE_FLAG} -c ${ZPOOL_CONFIG} -t ${ZPIOS_TEST} | \ + ${ZPIOS_SH} ${VERBOSE_FLAG} -c ${ZPOOL_CONFIG} -t ${ZPIOS_TEST} | \ tee -a ${ZPIOS_SURVEY_LOG} - ./zfs.sh -u ${VERBOSE_FLAG} | \ + ${ZFS_SH} -u ${VERBOSE_FLAG} | \ tee -a ${ZPIOS_SURVEY_LOG} } @@ -56,12 +64,12 @@ zpios_survey_prefetch() { TEST_NAME="${ZPOOL_CONFIG}+${ZPIOS_TEST}+prefetch" print_header ${TEST_NAME} - ./zfs.sh ${VERBOSE_FLAG} \ + ${ZFS_SH} ${VERBOSE_FLAG} \ tee -a ${ZPIOS_SURVEY_LOG} - ./zpios.sh ${VERBOSE_FLAG} -c ${ZPOOL_CONFIG} -t ${ZPIOS_TEST} \ + ${ZPIOS_SH} ${VERBOSE_FLAG} -c ${ZPOOL_CONFIG} -t ${ZPIOS_TEST} \ -o "--noprefetch" | \ tee -a ${ZPIOS_SURVEY_LOG} - ./zfs.sh -u ${VERBOSE_FLAG} | \ + ${ZFS_SH} -u ${VERBOSE_FLAG} | \ tee -a ${ZPIOS_SURVEY_LOG} } @@ -71,12 +79,12 @@ zpios_survey_zerocopy() { TEST_NAME="${ZPOOL_CONFIG}+${ZPIOS_TEST}+zerocopy" print_header ${TEST_NAME} - ./zfs.sh ${VERBOSE_FLAG} | \ + ${ZFS_SH} ${VERBOSE_FLAG} | \ tee -a ${ZPIOS_SURVEY_LOG} - ./zpios.sh ${VERBOSE_FLAG} -c ${ZPOOL_CONFIG} -t ${ZPIOS_TEST} \ + ${ZPIOS_SH} ${VERBOSE_FLAG} -c ${ZPOOL_CONFIG} -t ${ZPIOS_TEST} \ -o "--zerocopy" | \ tee -a ${ZPIOS_SURVEY_LOG} - ./zfs.sh -u ${VERBOSE_FLAG} | \ + ${ZFS_SH} -u ${VERBOSE_FLAG} | \ tee -a ${ZPIOS_SURVEY_LOG} } @@ -86,12 +94,12 @@ zpios_survey_checksum() { TEST_NAME="${ZPOOL_CONFIG}+${ZPIOS_TEST}+checksum" print_header ${TEST_NAME} - ./zfs.sh ${VERBOSE_FLAG} | \ + ${ZFS_SH} ${VERBOSE_FLAG} | \ tee -a ${ZPIOS_SURVEY_LOG} - ./zpios.sh ${VERBOSE_FLAG} -c ${ZPOOL_CONFIG} -t ${ZPIOS_TEST} \ + ${ZPIOS_SH} ${VERBOSE_FLAG} -c ${ZPOOL_CONFIG} -t ${ZPIOS_TEST} \ -s "set checksum=off" | \ tee -a ${ZPIOS_SURVEY_LOG} - ./zfs.sh -u ${VERBOSE_FLAG} | \ + ${ZFS_SH} -u ${VERBOSE_FLAG} | \ tee -a ${ZPIOS_SURVEY_LOG} } @@ -103,12 +111,12 @@ zpios_survey_pending() { TEST_NAME="${ZPOOL_CONFIG}+${ZPIOS_TEST}+pending" print_header ${TEST_NAME} - ./zfs.sh ${VERBOSE_FLAG} \ + ${ZFS_SH} ${VERBOSE_FLAG} \ zfs="zfs_vdev_max_pending=1024" | \ tee -a ${ZPIOS_SURVEY_LOG} - ./zpios.sh ${VERBOSE_FLAG} -c ${ZPOOL_CONFIG} -t ${ZPIOS_TEST} | \ + ${ZPIOS_SH} ${VERBOSE_FLAG} -c ${ZPOOL_CONFIG} -t ${ZPIOS_TEST} | \ tee -a ${ZPIOS_SURVEY_LOG} - ./zfs.sh -u ${VERBOSE_FLAG} | \ + ${ZFS_SH} -u ${VERBOSE_FLAG} | \ tee -a ${ZPIOS_SURVEY_LOG} } @@ -129,12 +137,12 @@ zpios_survey_kmem() { TEST_NAME="${ZPOOL_CONFIG}+${ZPIOS_TEST}+kmem" print_header ${TEST_NAME} - ./zfs.sh ${VERBOSE_FLAG} \ + ${ZFS_SH} ${VERBOSE_FLAG} \ zfs="zio_bulk_flags=0x100" | \ tee -a ${ZPIOS_SURVEY_LOG} - ./zpios.sh ${VERBOSE_FLAG} -c ${ZPOOL_CONFIG} -t ${ZPIOS_TEST} | \ + ${ZPIOS_SH} ${VERBOSE_FLAG} -c ${ZPOOL_CONFIG} -t ${ZPIOS_TEST} | \ tee -a ${ZPIOS_SURVEY_LOG} - ./zfs.sh -u ${VERBOSE_FLAG} | \ + ${ZFS_SH} -u ${VERBOSE_FLAG} | \ tee -a ${ZPIOS_SURVEY_LOG} } @@ -143,15 +151,15 @@ zpios_survey_all() { TEST_NAME="${ZPOOL_CONFIG}+${ZPIOS_TEST}+all" print_header ${TEST_NAME} - ./zfs.sh ${VERBOSE_FLAG} \ + ${ZFS_SH} ${VERBOSE_FLAG} \ zfs="zfs_vdev_max_pending=1024" \ zfs="zio_bulk_flags=0x100" | \ tee -a ${ZPIOS_SURVEY_LOG} - ./zpios.sh ${VERBOSE_FLAG} -c ${ZPOOL_CONFIG} -t ${ZPIOS_TEST} \ + ${ZPIOS_SH} ${VERBOSE_FLAG} -c ${ZPOOL_CONFIG} -t ${ZPIOS_TEST} \ -o "--noprefetch --zerocopy" \ -s "set checksum=off" | \ tee -a ${ZPIOS_SURVEY_LOG} - ./zfs.sh -u ${VERBOSE_FLAG} | \ + ${ZFS_SH} -u ${VERBOSE_FLAG} | \ tee -a ${ZPIOS_SURVEY_LOG} } diff --git a/scripts/zpios-test/16th-8192rc-4rs-1cs-4off.sh b/scripts/zpios-test/16th-8192rc-4rs-1cs-4off.sh index 7a1d8feac5..cbd9c697ad 100755 --- a/scripts/zpios-test/16th-8192rc-4rs-1cs-4off.sh +++ b/scripts/zpios-test/16th-8192rc-4rs-1cs-4off.sh @@ -38,7 +38,7 @@ # --verbose -v =increase verbosity # --help -? =this help -ZPIOS_CMD="${CMDDIR}/zpios/zpios \ +ZPIOS_CMD="${ZPIOS} \ --load=dmuio \ --pool=${ZPOOL_NAME} \ --name=${ZPOOL_CONFIG} \ diff --git a/scripts/zpios-test/1th-16rc-4rs-1cs-4off.sh b/scripts/zpios-test/1th-16rc-4rs-1cs-4off.sh index 2a7bf646f9..cd3c50b773 100755 --- a/scripts/zpios-test/1th-16rc-4rs-1cs-4off.sh +++ b/scripts/zpios-test/1th-16rc-4rs-1cs-4off.sh @@ -39,7 +39,7 @@ # --help -? =this help -ZPIOS_CMD="${CMDDIR}/zpios/zpios \ +ZPIOS_CMD="${ZPIOS} \ --load=dmuio \ --pool=${ZPOOL_NAME} \ --name=${ZPOOL_CONFIG} \ diff --git a/scripts/zpios-test/1x256th-65536rc-4rs-1cs-4off.sh b/scripts/zpios-test/1x256th-65536rc-4rs-1cs-4off.sh index 51451991d3..743e97b648 100755 --- a/scripts/zpios-test/1x256th-65536rc-4rs-1cs-4off.sh +++ b/scripts/zpios-test/1x256th-65536rc-4rs-1cs-4off.sh @@ -38,7 +38,7 @@ # --verbose -v =increase verbosity # --help -? =this help -ZPIOS_CMD="${CMDDIR}/zpios/zpios \ +ZPIOS_CMD="${ZPIOS} \ --load=dmuio \ --pool=${ZPOOL_NAME} \ --name=${ZPOOL_CONFIG} \ diff --git a/scripts/zpios-test/256th-65536rc-4rs-1cs-4off.sh b/scripts/zpios-test/256th-65536rc-4rs-1cs-4off.sh index 34f7ea64e0..92a3b77b48 100755 --- a/scripts/zpios-test/256th-65536rc-4rs-1cs-4off.sh +++ b/scripts/zpios-test/256th-65536rc-4rs-1cs-4off.sh @@ -38,7 +38,7 @@ # --verbose -v =increase verbosity # --help -? =this help -ZPIOS_CMD="${CMDDIR}/zpios/zpios \ +ZPIOS_CMD="${ZPIOS} \ --load=dmuio \ --pool=${ZPOOL_NAME} \ --name=${ZPOOL_CONFIG} \ diff --git a/scripts/zpios-test/4th-1024rc-4rs-1cs-4off.sh b/scripts/zpios-test/4th-1024rc-4rs-1cs-4off.sh index 740908a439..0db952cd65 100755 --- a/scripts/zpios-test/4th-1024rc-4rs-1cs-4off.sh +++ b/scripts/zpios-test/4th-1024rc-4rs-1cs-4off.sh @@ -38,7 +38,7 @@ # --verbose -v =increase verbosity # --help -? =this help -ZPIOS_CMD="${CMDDIR}/zpios/zpios \ +ZPIOS_CMD="${ZPIOS} \ --load=dmuio \ --pool=${ZPOOL_NAME} \ --name=${ZPOOL_CONFIG} \ diff --git a/scripts/zpios-test/Makefile.am b/scripts/zpios-test/Makefile.am deleted file mode 100644 index 07cf7ead3a..0000000000 --- a/scripts/zpios-test/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -EXTRA_DIST = *.sh diff --git a/scripts/zpios.sh b/scripts/zpios.sh index f98c826073..6e9b3f50d5 100755 --- a/scripts/zpios.sh +++ b/scripts/zpios.sh @@ -3,13 +3,22 @@ # Wrapper script for easily running zpios based tests # -. ./common.sh +SCRIPT_COMMON=common.sh +if [ -f ./${SCRIPT_COMMON} ]; then +. ./${SCRIPT_COMMON} +elif [ -f /usr/libexec/zfs/${SCRIPT_COMMON} ]; then +. /usr/libexec/zfs/${SCRIPT_COMMON} +else +echo "Missing helper script ${SCRIPT_COMMON}" && exit 1 +fi + PROG=zpios.sh DATE=`date +%Y%m%d-%H%M%S` - -MODULES=( \ - ${MODDIR}/zpios/zpios.ko \ -) +if [ "${ZPIOS_MODULES}" ]; then + MODULES=(${ZPIOS_MODULES[*]}) +else + MODULES=(zpios) +fi usage() { cat << EOF @@ -43,7 +52,7 @@ print_header() { print_spl_info() { echo --------------------- SPL Tunings ------------------------------ - sysctl -A | grep spl + ${SYSCTL} -A | grep spl if [ -d /sys/module/spl/parameters ]; then grep [0-9] /sys/module/spl/parameters/* @@ -56,7 +65,7 @@ print_spl_info() { print_zfs_info() { echo --------------------- ZFS Tunings ------------------------------ - sysctl -A | grep zfs + ${SYSCTL} -A | grep zfs if [ -d /sys/module/zfs/parameters ]; then grep [0-9] /sys/module/zfs/parameters/* @@ -69,7 +78,7 @@ print_zfs_info() { print_stats() { echo ---------------------- Statistics ------------------------------- - sysctl -A | grep spl | grep stack_max + ${SYSCTL} -A | grep spl | grep stack_max if [ -d /proc/spl/kstat/ ]; then if [ -f /proc/spl/kstat/zfs/arcstats ]; then @@ -100,7 +109,7 @@ check_test() { local NAME=`basename ${ZPIOS_TEST} .sh` ERROR="Unknown test '${NAME}', available tests are:\n" - for TST in `ls ${TOPDIR}/scripts/zpios-test/`; do + for TST in `ls ${ZPIOSDIR}/ | grep ".sh"`; do local NAME=`basename ${TST} .sh` ERROR="${ERROR}${NAME}\n" done @@ -118,18 +127,18 @@ cat > ${PROFILE_DIR}/zpios-config.sh << EOF # PROFILE_DIR=/tmp/zpios/${ZPOOL_CONFIG}+${ZPIOS_TEST_ARG}+${DATE} -PROFILE_PRE=${TOPDIR}/scripts/zpios-profile/zpios-profile-pre.sh -PROFILE_POST=${TOPDIR}/scripts/zpios-profile/zpios-profile-post.sh -PROFILE_USER=${TOPDIR}/scripts/zpios-profile/zpios-profile.sh -PROFILE_PIDS=${TOPDIR}/scripts/zpios-profile/zpios-profile-pids.sh -PROFILE_DISK=${TOPDIR}/scripts/zpios-/profile/zpios-profile-disk.sh +PROFILE_PRE=${ZPIOSPROFILEDIR}/zpios-profile-pre.sh +PROFILE_POST=${ZPIOSPROFILEDIR}/zpios-profile-post.sh +PROFILE_USER=${ZPIOSPROFILEDIR}/zpios-profile.sh +PROFILE_PIDS=${ZPIOSPROFILEDIR}/zpios-profile-pids.sh +PROFILE_DISK=${ZPIOSPROFILEDIR}/zpios-profile-disk.sh PROFILE_ARC_PROC=/proc/spl/kstat/zfs/arcstats PROFILE_VDEV_CACHE_PROC=/proc/spl/kstat/zfs/vdev_cache_stats OPROFILE_KERNEL="/boot/vmlinux-`uname -r`" OPROFILE_KERNEL_DIR="/lib/modules/`uname -r`/kernel/" -OPROFILE_SPL_DIR="${SPLBUILD}/module/" -OPROFILE_ZFS_DIR="${TOPDIR}/module/" +OPROFILE_SPL_DIR=${SPLBUILD}/module/ +OPROFILE_ZFS_DIR=${MODDIR} EOF } @@ -180,7 +189,7 @@ while getopts 'hvpc:t:o:l:s:' OPTION; do ;; t) ZPIOS_TEST_ARG=${OPTARG} - ZPIOS_TEST=${TOPDIR}/scripts/zpios-test/${OPTARG}.sh + ZPIOS_TEST=${ZPIOSDIR}/${OPTARG}.sh ;; o) ZPIOS_OPTIONS=${OPTARG} @@ -226,7 +235,7 @@ if [ ${VERBOSE} ]; then fi # Create the zpool configuration -./zpool-create.sh ${VERBOSE_FLAG} -p ${ZPOOL_NAME} -c ${ZPOOL_CONFIG} \ +${ZPOOL_CREATE_SH} ${VERBOSE_FLAG} -p ${ZPOOL_NAME} -c ${ZPOOL_CONFIG} \ -l "${ZPOOL_OPTIONS}" -s "${ZFS_OPTIONS}" || exit 1 if [ ${PROFILE} ]; then @@ -245,7 +254,8 @@ if [ ${VERBOSE} ]; then fi # Destroy the zpool configuration -./zpool-create.sh ${VERBOSE_FLAG} -p ${ZPOOL_NAME} -c ${ZPOOL_CONFIG} -d || exit 1 +${ZPOOL_CREATE_SH} ${VERBOSE_FLAG} -p ${ZPOOL_NAME} \ + -c ${ZPOOL_CONFIG} -d || exit 1 # Unload the test module stack and wait for device removal unload_modules