btrfs/124: add balance --full-balance option

btrfs balance needs --full-balance option since 4.6, so check the
version and then use it.

As this may be useful for other btrfs tests as well, so this patch
also adds _run_btrfs_balance_start() to the common/btrfs file.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
This commit is contained in:
Anand Jain
2017-12-05 19:36:32 +08:00
committed by Eryu Guan
parent bfef1cdccf
commit 9ba09767dd
2 changed files with 12 additions and 1 deletions
+11
View File
@@ -356,3 +356,14 @@ _btrfs_compression_algos()
echo "${feature#/sys/fs/btrfs/features/compress_}"
done
}
# run btrfs balance start with required --full-balance if available.
_run_btrfs_balance_start()
{
local bal_opt=""
$BTRFS_UTIL_PROG balance start --help | grep -q "full-balance"
(( $? == 0 )) && bal_opt="--full-balance"
run_check $BTRFS_UTIL_PROG balance start $bal_opt $*
}