generic/619: a better way to get tot_avail_size
authorSun Ke <sunke32@huawei.com>
Mon, 19 Apr 2021 12:34:37 +0000 (08:34 -0400)
committerEryu Guan <guaneryu@gmail.com>
Sun, 25 Apr 2021 00:56:58 +0000 (08:56 +0800)
When FSTYP is tmpfs, $DF_PROG --block-size=1 $SCRATCH_DEV is not suitted.

Signed-off-by: Sun Ke <sunke32@huawei.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
tests/generic/619

index 3c43fe7..460699d 100755 (executable)
@@ -89,7 +89,7 @@ calc_thread_cnt()
        IFS=',' read -ra fratio <<< $file_ratio
        file_ratio_cnt=${#fratio[@]}
 
-       tot_avail_size=$($DF_PROG --block-size=1 $SCRATCH_DEV | awk 'FNR == 2 { print $5 }')
+       tot_avail_size=$($DF_PROG --block-size=1 $SCRATCH_MNT | $AWK_PROG 'FNR == 2 { print $5 }')
        avail_size=$(echo $tot_avail_size*$disk_saturation | $BC_PROG)
        thread_cnt=$(echo "$file_ratio_cnt*($avail_size/$file_ratio_unit)" | $BC_PROG)