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