- if [ $((space * 1024)) -le $size ]; then
- echo "Need free space atleast $size, have $((space * 1024))"
- return 10
+ # we can not use pios --cleanup|-x because we need the files exist for pios --verify,
+ # so, we need space available for each of pios_THREADCOUNT value run
+ local num_runs=$(echo ${pios_THREADCOUNT//,/ } | wc -w)
+ size=$(( size * $num_runs))
+ space=$((space * 1024))
+ echo size=$size space=$space
+ if [ $space -le $size ]; then
+ local ratio=$(( size / space + 1 ))
+ echo "Need free space atleast $size, available $space, ratio=$ratio"
+ local rgcount=$(( pios_REGIONCOUNT / ratio ))
+ echo "reducing pios_REGIONCOUNT=$pios_REGIONCOUNT on $ratio"
+ if [ $rgcount -eq 0 ]; then
+ echo "fs is too small, reduced pios_REGIONCOUNT=$rgcount"
+ return 10
+ fi
+ pios_REGIONCOUNT=$(( pios_REGIONCOUNT / ratio ))
+ echo using pios_REGIONCOUNT=$pios_REGIONCOUNT size=$(pios_file_size)