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}
7 RACER_EXTRA_LAYOUT=${RACER_EXTRA_LAYOUT:-""}
10 MAX_MB=${RACER_MAX_MB:-8}
14 # check if it supports PFL layout
15 $RACER_ENABLE_PFL && layout+=(pfl pfl pfl)
17 # check if it supports DoM
18 $RACER_ENABLE_DOM && layout+=(dom dom dom)
20 # check if it supports FLR
21 $RACER_ENABLE_FLR && layout+=(flr flr flr)
23 # check if it supports PFL layout
24 $RACER_ENABLE_SEL && layout+=(sel sel sel)
25 [[ -n "$RACER_EXTRA_LAYOUT" ]] && layout+=(extra extra extra)
27 echo "layout: ${layout[*]}"
30 file=$((RANDOM % MAX))
31 # $RANDOM is between 0 and 32767, and we want $blockcount in 64kB units
32 blockcount=$((RANDOM * MAX_MB / 32 / 64))
33 stripecount=$((RANDOM % (OSTCOUNT + 1)))
35 [ $stripecount -gt 0 ] && {
36 stripesize=$(((1 << (RANDOM % 5)) * 64))K
37 comp_end=$((${stripesize%K} * (RANDOM % 8 + 1)))K
38 pattern=${layout[$RANDOM % ${#layout[*]}]}
41 dom) opt="setstripe -E $stripesize -L mdt -E eof -c $stripecount -S 1M" ;;
42 pfl) opt="setstripe -E $comp_end -S $stripesize -E eof -c $stripecount -S 2M" ;;
43 flr) opt="mirror create -N2 -E $comp_end -S $stripesize -E eof -c $stripecount -S 2M" ;;
44 sel) opt="setstripe -E 128M -S $stripesize -z 64M -E eof -c $stripecount -S 2M -z 128M" ;;
45 raid0) opt="setstripe -S $stripesize -c $stripecount" ;;
46 extra) opt="setstripe $RACER_EXTRA_LAYOUT" ;;
49 $LFS $opt $DIR/$file 2> /dev/null || true
52 # offset between 0 and 16MB (256 64k chunks), with 1/2 at offset 0
53 seek=$((RANDOM / 64)); [ $seek -gt 256 ] && seek=0
54 dd if=/dev/zero of=$DIR/$file bs=64k count=$blockcount \
55 seek=$seek 2> /dev/null || true