local migrate_dir2=$DIR2/$tdir/migrate_dir
local migrate_run=$LUSTRE/tests/migrate.sh
local start_time
- local end_time
local show_time=1
local mdt_idx
local rc=0
mdt_idx=$((RANDOM % MDSCOUNT))
$LFS migrate -m $mdt_idx $migrate_dir1 &>/dev/null ||
rc=$?
- [ $rc -ne 0 -o $rc -ne 16 ] || break
+ (( $rc != 0 && $rc != 16 )) || break
done
) &
migrate_pid=$!
echo "start migration thread $migrate_pid"
#Access the files at the same time
- start_time=$(date +%s)
+ start_time=$SECONDS
echo "accessing the migrating directory for 5 minutes..."
while true; do
ls $migrate_dir2 > /dev/null || {
}
touch $migrate_dir2/source_file > /dev/null || rc1=$?
- [ $rc1 -ne 0 -o $rc1 -ne 1 ] || {
+ (( $rc != 0 && $rc != 1 )) || {
echo "touch file failed with $rc1"
break;
}
mrename $migrate_dir2/source_file \
$migrate_dir2/target_file &>/dev/null || rc1=$?
- [ $rc1 -ne 0 -o $rc1 -ne 1 ] || {
+ (( $rc != 0 && $rc != 1 )) || {
echo "rename failed with $rc1"
break
}
rm -rf $migrate_dir2/source_file &>/dev/null ||
rc1=$?
fi
- [ $rc1 -ne 0 -o $rc1 -ne 1 ] || {
+ (( $rc != 0 && $rc != 1 )) || {
echo "unlink failed with $rc1"
break
}
fi
- end_time=$(date +%s)
- duration=$((end_time - start_time))
- if [ $((duration % 10)) -eq 0 ]; then
- if [ $show_time -eq 1 ]; then
+ local duration=$((SECONDS - start_time))
+ if (( duration % 10 == 0 )); then
+ if (( $show_time == 1 )); then
echo "...$duration seconds"
show_time=0
fi
break
}
- [ $duration -ge 300 ] && break
+ (( $duration < 300 )) || break
done
#check migration are still there