Whamcloud - gitweb
LU-4018 tests: improve racer file_create workload
[fs/lustre-release.git] / lustre / tests / racer / dir_remote.sh
1 #!/bin/bash
2
3 DIR=$1
4 MAX=$2
5
6 MDTCOUNT=${MDSCOUNT:-$(lfs df $DIR 2> /dev/null | grep -c MDT)}
7 while /bin/true ; do
8         remote_dir=$((RANDOM % MAX))
9         file=$((RANDOM % MAX))
10         mdt_idx=$((RANDOM % MDTCOUNT))
11         # stripe_count in range [1,MDTCOUNT]
12         # lfs mkdir treats stripe_count 0 and 1 the same
13         stripe_count=$(((RANDOM % MDTCOUNT) + 1))
14         mkdir -p $DIR 2> /dev/null
15         $LFS mkdir -i$mdt_idx -c$stripe_count $DIR/$remote_dir 2> /dev/null
16         touch $DIR/$remote_dir/$file 2> /dev/null
17         $LFS getdirstripe $DIR/$remote_dir > /dev/null 2>&1
18 done