diff options
author | Anand Jain <anand.jain@oracle.com> | 2017-12-05 19:36:32 +0800 |
---|---|---|
committer | Eryu Guan <eguan@redhat.com> | 2017-12-06 16:05:29 +0800 |
commit | 9ba09767dd764e2b332a272465405d96a38f5108 (patch) | |
tree | 5f2052ddf9a2495e427fd83de8be6e9c4ce034a3 /common/btrfs | |
parent | bfef1cdccf6b399b01b3818784a61594249d2b73 (diff) |
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>
Diffstat (limited to 'common/btrfs')
-rw-r--r-- | common/btrfs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/common/btrfs b/common/btrfs index c09206c6..79c687f7 100644 --- a/common/btrfs +++ b/common/btrfs @@ -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 $* +} |