2 trap 'kill $(jobs -p)' EXIT
3 RACER_ENABLE_PFL=${RACER_ENABLE_PFL:-true}
4 RACER_ENABLE_DOM=${RACER_ENABLE_DOM:-true}
5 RACER_ENABLE_FLR=${RACER_ENABLE_FLR:-true}
6 RACER_ENABLE_SEL=${RACER_ENABLE_SEL:-true}
9 MAX_MB=${RACER_MAX_MB:-8}
13 # check if it supports PFL layout
14 $RACER_ENABLE_PFL && layout+=(pfl pfl pfl)
16 # check if it supports DoM
17 $RACER_ENABLE_DOM && layout+=(dom dom dom)
19 # check if it supports FLR
20 $RACER_ENABLE_FLR && layout+=(flr flr flr)
22 # check if it supports PFL layout
23 $RACER_ENABLE_SEL && layout+=(sel sel sel)
25 echo "layout: ${layout[*]}"
28 file=$((RANDOM % MAX))
29 # $RANDOM is between 0 and 32767, and we want $blockcount in 64kB units
30 blockcount=$((RANDOM * MAX_MB / 32 / 64))
31 stripecount=$((RANDOM % (OSTCOUNT + 1)))
33 [ $stripecount -gt 0 ] && {
34 stripesize=$(((1 << (RANDOM % 5)) * 64))K
35 comp_end=$((${stripesize%K} * (RANDOM % 8 + 1)))K
36 pattern=${layout[$RANDOM % ${#layout[*]}]}
39 dom) opt="setstripe -E $stripesize -L mdt -E eof -c $stripecount -S 1M" ;;
40 pfl) opt="setstripe -E $comp_end -S $stripesize -E eof -c $stripecount -S 2M" ;;
41 flr) opt="mirror create -N2 -E $comp_end -S $stripesize -E eof -c $stripecount -S 2M" ;;
42 sel) opt="setstripe -E 128M -S $stripesize -z 64M -E eof -c $stripecount -S 2M -z 128M" ;;
43 raid0) opt="setstripe -S $stripesize -c $stripecount" ;;
46 $LFS $opt $DIR/$file 2> /dev/null || true
49 # offset between 0 and 16MB (256 64k chunks), with 1/2 at offset 0
50 seek=$((RANDOM / 64)); [ $seek -gt 256 ] && seek=0
51 dd if=/dev/zero of=$DIR/$file bs=64k count=$blockcount \
52 seek=$seek 2> /dev/null || true