Whamcloud - gitweb
LU-2291 tests: add "lfs setstripe" to racer
[fs/lustre-release.git] / lustre / tests / racer / file_create.sh
index 70ba0fd..828e69c 100755 (executable)
@@ -4,14 +4,14 @@ DIR=$1
 MAX=$2
 MAX_MB=256
 
-create() {
-    SIZE=$((RANDOM * MAX_MB / 32))
-    echo "file_create: SIZE=$SIZE"
-    dd if=/dev/zero of=$DIR/$file bs=1k count=$SIZE
-}
+OSTCOUNT=${OSTCOUNT:-$(lfs df $DIR 2> /dev/null | grep -c OST)}
 
 while /bin/true ; do 
-    file=$((RANDOM % MAX))
-    create 2> /dev/null
+       file=$((RANDOM % MAX))
+       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
 done