common: helper to print raw byte output from qgroup show

Newer versions of btrfs-progs change the default output of 'qgroup
show', we have to check what version is running and use the right option
if needed.

Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Dave Chinner <david@fromorbit.com>
This commit is contained in:
David Sterba
2015-02-12 14:13:15 +11:00
committed by Dave Chinner
parent ed48b428c6
commit 2b2fe1a658
4 changed files with 18 additions and 7 deletions
+7
View File
@@ -2799,6 +2799,13 @@ _btrfs_stress_replace()
done
}
# find the right option to force output in bytes, older versions of btrfs-progs
# print that by default, newer print human readable numbers with unit suffix
_btrfs_qgroup_units()
{
$BTRFS_UTIL_PROG qgroup show --help 2>&1 | grep -q -- --raw && echo "--raw"
}
# return device size in kb
_get_device_size()
{