X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Ftests%2Fracer%2Ffile_create.sh;h=78d68e5edb85d9c80663922fe64f96ec40ef2059;hp=b1704d3c6f841a9978c923d4b4b95f739fc40550;hb=6d9e74580ee391c27cf9a2dc249030f170217ffe;hpb=dd48eb801321ab87c89dfbe3dd89fa487cf874b8 diff --git a/lustre/tests/racer/file_create.sh b/lustre/tests/racer/file_create.sh index b1704d3..78d68e5 100755 --- a/lustre/tests/racer/file_create.sh +++ b/lustre/tests/racer/file_create.sh @@ -1,19 +1,57 @@ #!/bin/bash trap 'kill $(jobs -p)' EXIT - +RACER_ENABLE_PFL=${RACER_ENABLE_PFL:-true} +RACER_ENABLE_DOM=${RACER_ENABLE_DOM:-true} +RACER_ENABLE_FLR=${RACER_ENABLE_FLR:-true} +RACER_ENABLE_SEL=${RACER_ENABLE_SEL:-true} +RACER_EXTRA_LAYOUT=${RACER_EXTRA_LAYOUT:-""} DIR=$1 MAX=$2 MAX_MB=${RACER_MAX_MB:-8} -OSTCOUNT=${OSTCOUNT:-$($LFS df $DIR 2> /dev/null | grep -c OST)} +layout=(raid0 raid0) + +# check if it supports PFL layout +$RACER_ENABLE_PFL && layout+=(pfl pfl pfl) + +# check if it supports DoM +$RACER_ENABLE_DOM && layout+=(dom dom dom) + +# check if it supports FLR +$RACER_ENABLE_FLR && layout+=(flr flr flr) + +# check if it supports PFL layout +$RACER_ENABLE_SEL && layout+=(sel sel sel) +[[ -n "$RACER_EXTRA_LAYOUT" ]] && layout+=(extra extra extra) + +echo "layout: ${layout[*]}" while /bin/true; do file=$((RANDOM % MAX)) # $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 $stripecount $DIR/$file 2> /dev/null - dd if=/dev/zero of=$DIR/$file bs=64k count=$blockcount 2> /dev/null + + [ $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 done