#!/bin/ksh93 function createPools { integer N=0 C T cp /dev/null /tmp/pooldo.sh for (( T=0; T < 8; T++ )); do for (( C=7; C <= 12; C++ )); do (( N++ )) (( ((C == 7 || C == 8) && T == 0) || (T == 4) )) && continue print "zpool destroy pool${N}" >>/tmp/pooldo.sh print "zpool create -f pool${N} c${C}t${T}d0" >>/tmp/pooldo.sh print "chown admin /pool${N}" >>/tmp/pooldo.sh done done + sh /tmp/pooldo.sh } typeset -a PIDS=( 0 0 0 0 0 0 ) function getSLOT { typeset -n S=$1 for (( I=0; I < ${#PIDS[@]} ; I++ )); do (( ! PIDS[I] )) && S=$I && return [[ -d /proc/${PIDS[I]} ]] && continue PIDS[I]=0 S=$I return done S=-1 } typeset -a TPIDS=( 0 0 0 0 0 0 ) function runTests { integer S P typeset X TAIL POOL set -- /pool{0..48} while [[ -n $1 ]]; do ZFS=$1 [[ ! -d ${ZFS} ]] && shift && continue getSLOT S (( S == -1 )) && sleep 10 && continue # no slots available P=${TPIDS[S]} (( P )) && kill $P && sleep 1 # kill the monitor DEV='' zpool status ${ZFS:1} | while read X TAIL ; do [[ ${X} =~ ^c[0-9]+t[0-9]+d0$ ]] && DEV=$X && break done if [[ -n ${DEV} ]]; then iostat -xrn ${DEV} 1 >/var/tmp/${DEV}.io 2>&1 & TPIDS[S]=$! time mkfile 900g ${ZFS}/test >/var/tmp/${DEV}.out 2>&1 & PIDS[S]=$! fi shift done } function wait4finish { integer I N=1 while (( N )); do N=${#PIDS[@]} sleep 10 for (( I=0; I < ${#PIDS[@]} ; I++, N-- )); do (( ! PIDS[I] )) && continue [[ -d /proc/${PIDS[I]} ]] && break PIDS[I]=0 kill ${TPIDS[I]} TPIDS[I]=0 done done } createPools #typeset -ft ${ typeset +f ; } sync runTests >times.out 2>&1 wait4finish >>times.out 2>&1