- SIZE=$((RANDOM * MAX_MB / 32))
- echo "file_create: FILE=$DIR/$file SIZE=$SIZE"
- [ $OSTCOUNT -gt 0 ] &&
- lfs setstripe -c $((RANDOM % OSTCOUNT)) $DIR/$file 2> /dev/null
- dd if=/dev/zero of=$DIR/$file bs=1k count=$SIZE 2> /dev/null
+ # $RANDOM is between 0 and 32767, and we want $blockcount in 64kB units
+ blockcount=$((RANDOM * MAX_MB / 32 / 64))
+ stripecount=$((RANDOM % (OSTCOUNT + 1)))
+
+ [ $stripecount -gt 0 ] && {
+ stripesize=$(((1 << (RANDOM % 5)) * 64))K
+ comp_end=$((${stripesize%K} * (RANDOM % 8 + 1)))K
+ pattern=${layout[$RANDOM % ${#layout[*]}]}
+
+ case $pattern in
+ dom) opt="setstripe -E $stripesize -L mdt -E eof -c $stripecount -S 1M" ;;
+ pfl) opt="setstripe -E $comp_end -S $stripesize -E eof -c $stripecount -S 2M" ;;
+ flr) opt="mirror create -N2 -E $comp_end -S $stripesize -E eof -c $stripecount -S 2M" ;;
+ sel) opt="setstripe -E 128M -S $stripesize -z 64M -E eof -c $stripecount -S 2M -z 128M" ;;
+ raid0) opt="setstripe -S $stripesize -c $stripecount" ;;
+ extra) opt="setstripe $RACER_EXTRA_LAYOUT" ;;
+ esac
+
+ $LFS $opt $DIR/$file 2> /dev/null || true
+ }
+
+ # offset between 0 and 16MB (256 64k chunks), with 1/2 at offset 0
+ seek=$((RANDOM / 64)); [ $seek -gt 256 ] && seek=0
+ dd if=/dev/zero of=$DIR/$file bs=64k count=$blockcount \
+ seek=$seek 2> /dev/null || true