btrfs: fix computation of max fs size for multiple device fs tests
PATCH 1/1 btrfs: fix computation of max fs size for multiple device fs tests
From: Filipe Manana <[email protected]>
We were sorting numerical values with the 'sort' tool without telling it that we are sorting numbers, giving us unexpected ordering. So just pass the '-n' option to the 'sort' tool.
Example:
$ echo -e "11\n9\n20" | sort 11 20 9
$ echo -e "11\n9\n20" | sort -n 9 11 20
Signed-off-by Filipe Manana <[email protected]>
--- tests/btrfs/124 | 2 +- tests/btrfs/125 | 2 +- tests/btrfs/154 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
tests/btrfs/124 +1 -1
@@ -61,7 +61,7 @@ dev2=`echo $SCRATCH_DEV_POOL | awk '{print $2}'` dev1_sz=`blockdev --getsize64 $dev1` dev2_sz=`blockdev --getsize64 $dev2` # get min of both -max_fs_sz=`echo -e "$dev1_sz\n$dev2_sz" | sort | head -1` +max_fs_sz=`echo -e "$dev1_sz\n$dev2_sz" | sort -n | head -1` # Need disks with more than 2G. if [ $max_fs_sz -lt 2000000000 ]; then _scratch_dev_pool_put
tests/btrfs/125 +1 -1
@@ -68,7 +68,7 @@ dev2_sz=`blockdev --getsize64 $dev2` dev3_sz=`blockdev --getsize64 $dev3` # get min of both. -max_fs_sz=`echo -e "$dev1_sz\n$dev2_sz\n$dev3_sz" | sort | head -1` +max_fs_sz=`echo -e "$dev1_sz\n$dev2_sz\n$dev3_sz" | sort -n | head -1` # Need disks with more than 2G if [ $max_fs_sz -lt 2000000000 ]; then _scratch_dev_pool_put
tests/btrfs/154 +1 -1
@@ -51,7 +51,7 @@ DEV1_SZ=`blockdev --getsize64 $DEV1` DEV2_SZ=`blockdev --getsize64 $DEV2` # get min -MAX_FS_SZ=`echo -e "$DEV1_SZ\n$DEV2_SZ" | sort | head -1` +MAX_FS_SZ=`echo -e "$DEV1_SZ\n$DEV2_SZ" | sort -n | head -1` # Need disks with more than 2G if [ $MAX_FS_SZ -lt 2000000000 ]; then _scratch_dev_pool_put
Signature · 1 line
2.11.0
Quoted 13 lines · On 11/06/2018 11:34 PM, [email protected] wrote:
From: Filipe Manana <[email protected]>
We were sorting numerical values with the 'sort' tool without telling it that we are sorting numbers, giving us unexpected ordering. So just pass the '-n' option to the 'sort' tool.
Example:
$ echo -e "11\n9\n20" | sort 11 20 9
Quoted 6 lines
$ echo -e "11\n9\n20" | sort -n 9 11 20Signed-off-by Filipe Manana <[email protected]>
Thanks for the fix.
Reviewed-by Anand Jain <[email protected]>
Quoted 46 lines
--- tests/btrfs/124 | 2 +- tests/btrfs/125 | 2 +- tests/btrfs/154 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)tests/btrfs/124 +1
-1@@ -61,7 +61,7 @@ dev2=`echo $SCRATCH_DEV_POOL | awk '{print $2}'` dev1_sz=`blockdev --getsize64 $dev1` dev2_sz=`blockdev --getsize64 $dev2` # get min of both -max_fs_sz=`echo -e "$dev1_sz\n$dev2_sz" | sort | head -1` +max_fs_sz=`echo -e "$dev1_sz\n$dev2_sz" | sort -n | head -1` # Need disks with more than 2G. if [ $max_fs_sz -lt 2000000000 ]; then _scratch_dev_pool_puttests/btrfs/125 +1
-1@@ -68,7 +68,7 @@ dev2_sz=`blockdev --getsize64 $dev2` dev3_sz=`blockdev --getsize64 $dev3` # get min of both. -max_fs_sz=`echo -e "$dev1_sz\n$dev2_sz\n$dev3_sz" | sort | head -1` +max_fs_sz=`echo -e "$dev1_sz\n$dev2_sz\n$dev3_sz" | sort -n | head -1` # Need disks with more than 2G if [ $max_fs_sz -lt 2000000000 ]; then _scratch_dev_pool_puttests/btrfs/154 +1
-1@@ -51,7 +51,7 @@ DEV1_SZ=`blockdev --getsize64 $DEV1` DEV2_SZ=`blockdev --getsize64 $DEV2` # get min -MAX_FS_SZ=`echo -e "$DEV1_SZ\n$DEV2_SZ" | sort | head -1` +MAX_FS_SZ=`echo -e "$DEV1_SZ\n$DEV2_SZ" | sort -n | head -1` # Need disks with more than 2G if [ $MAX_FS_SZ -lt 2000000000 ]; then _scratch_dev_pool_put