2 trap 'kill $(jobs -p)' EXIT
3 RACER_ENABLE_PFL=${RACER_ENABLE_PFL:-true}
4 RACER_ENABLE_DOM=${RACER_ENABLE_DOM:-false}
5 RACER_ENABLE_FLR=${RACER_ENABLE_FLR:-true}
8 MAX_MB=${RACER_MAX_MB:-8}
12 # check if it supports PFL layout
13 $RACER_ENABLE_PFL && layout+=(pfl pfl pfl)
15 # check if it supports DoM
16 $RACER_ENABLE_DOM && layout+=(dom dom dom)
18 # check if it supports FLR
19 $RACER_ENABLE_FLR && layout+=(flr flr flr)
21 echo "layout: ${layout[*]}"
24 file=$((RANDOM % MAX))
25 # $RANDOM is between 0 and 32767, and we want $blockcount in 64kB units
26 blockcount=$((RANDOM * MAX_MB / 32 / 64))
27 stripecount=$((RANDOM % (OSTCOUNT + 1)))
29 [ $stripecount -gt 0 ] && {
30 stripesize=$(((RANDOM % 16 + 1) * 64))K
31 pattern=${layout[$RANDOM % ${#layout[*]}]}
34 dom) opt="setstripe -E $stripesize -L mdt -E eof -c $stripecount -S 1M" ;;
35 pfl) opt="setstripe -E 1M -S $stripesize -E eof -c $stripecount -S 2M" ;;
36 flr) opt="mirror create -N2 -E 1M -S $stripesize -E eof -c $stripecount -S 2M" ;;
37 raid0) opt="setstripe -S $stripesize -c $stripecount" ;;
40 $LFS $opt $DIR/$file 2> /dev/null || true
43 # offset between 0 and 16MB (256 64k chunks), with 1/2 at offset 0
44 seek=$((RANDOM / 64)); [ $seek -gt 256 ] && seek=0
45 dd if=/dev/zero of=$DIR/$file bs=64k count=$blockcount \
46 seek=$seek 2> /dev/null || true