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_ENABLE_OVERSTRIPE=${RACER_ENABLE_OVERSTRIPE:-true}
8 RACER_LOV_MAX_STRIPECOUNT=${RACER_LOV_MAX_STRIPECOUNT:-$LOV_MAX_STRIPE_COUNT}
9 RACER_EXTRA_LAYOUT=${RACER_EXTRA_LAYOUT:-""}
12 MAX_MB=${RACER_MAX_MB:-8}
16 # check if it supports PFL layout
17 $RACER_ENABLE_PFL && layout+=(pfl pfl pfl)
19 # check if it supports DoM
20 $RACER_ENABLE_DOM && layout+=(dom dom dom)
22 # check if it supports FLR
23 $RACER_ENABLE_FLR && layout+=(flr flr flr)
25 # check if it supports PFL layout
26 $RACER_ENABLE_SEL && layout+=(sel sel sel)
27 [[ -n "$RACER_EXTRA_LAYOUT" ]] && layout+=(extra extra extra)
29 echo "layout: ${layout[*]}"
32 file=$((RANDOM % MAX))
33 (( RANDOM % 100 < 25 )) && file+="/$((RANDOM % MAX))"
34 # $RANDOM is between 0 and 32767, and we want $blockcount in 64kB units
35 blockcount=$((RANDOM * MAX_MB / 32 / 64))
36 $RACER_ENABLE_OVERSTRIPE &&
37 stripecount="-C $((RANDOM %
38 (RACER_LOV_MAX_STRIPECOUNT + 1)))" ||
39 stripecount="-c $((RANDOM % (OSTCOUNT + 1)))"
41 [ ${stripecount:2} -gt 0 ] && {
42 stripesize=$(((1 << (RANDOM % 5)) * 64))K
43 comp_end=$((${stripesize%K} * (RANDOM % 8 + 1)))K
44 pattern=${layout[$RANDOM % ${#layout[*]}]}
47 dom) opt="setstripe -E $stripesize -L mdt -E eof $stripecount -S 1M" ;;
48 pfl) opt="setstripe -E $comp_end -S $stripesize -E eof $stripecount -S 2M" ;;
49 flr) opt="mirror create -N2 -E $comp_end -S $stripesize -E eof $stripecount -S 2M" ;;
50 sel) opt="setstripe -E 128M -S $stripesize -z 64M -E eof $stripecount -S 2M -z 128M" ;;
51 raid0) opt="setstripe -S $stripesize $stripecount" ;;
52 extra) opt="setstripe $RACER_EXTRA_LAYOUT" ;;
55 if $RACER_ENABLE_FILE_MIGRATE && (( RANDOM % 20 == 0 )); then
56 if [ "$pattern" = "flr" ]; then
57 opt=${opt/create/extend}
59 opt=${opt/setstripe/migrate}
60 (( file % 8 == 0 )) && opt+=" --block"
63 $LFS $opt $DIR/$file 2> /dev/null || true
66 # offset between 0 and 16MB (256 64k chunks), with 1/2 at offset 0
67 seek=$((RANDOM / 64)); [ $seek -gt 256 ] && seek=0
68 dd if=/dev/zero of=$DIR/$file bs=64k count=$blockcount \
69 seek=$seek 2> /dev/null || true