DIR=$1
MAX=$2
-MAX_MB=256
+MAX_MB=${RACER_MAX_MB:-8}
OSTCOUNT=${OSTCOUNT:-$(lfs df $DIR 2> /dev/null | grep -c OST)}
while /bin/true ; do
file=$((RANDOM % MAX))
- SIZE=$((RANDOM * MAX_MB / 32))
- echo "file_create: FILE=$DIR/$file SIZE=$SIZE"
+ # $RANDOM is between 0 and 32767, and we want $blockcount in 64kB units
+ blockcount=$((RANDOM * MAX_MB / 32 / 64))
+ stripecount=$((RANDOM % (OSTCOUNT + 1)))
[ $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
+ lfs setstripe -c $stripecount $DIR/$file 2> /dev/null
+ dd if=/dev/zero of=$DIR/$file bs=64k count=$blockcount 2> /dev/null
done
{
echo "racer cleanup"
for P in $RACER_PROGS; do
- killall $P.sh
+ killall -q $P.sh
done
trap 0
done
if [[ $rc -eq 0 ]]; then
echo there should be NO racer processes:
- ps aux | grep -E "${RACER_PROGS// /|}"
+ ps uww -C "${RACER_PROGS// /,}"
return 0
fi
echo -n "Waited $(( TOT_WAIT + SHORT_WAIT)), rc=$rc "
(( SHORT_WAIT+=SHORT_WAIT ))
(( TOT_WAIT+=SHORT_WAIT ))
done
- ps aux | grep -E "${RACER_PROGS// /|}"
+ ps uww -C "${RACER_PROGS// /,}"
return 1
}
# Check our to see whether our test DIR is still available.
df $DIR
(( RC+=$? ))
-if [ $RC -eq 0 ]; then
- echo "We survived $0 for $DURATION seconds."
-fi
+[ $RC -eq 0 ] && echo "We survived $0 for $DURATION seconds."
exit $RC