load_device_info queries the FS_INFO ioctl and this may fail with EPERM
on older kernels. The check did not verify the ioctl return value and
incorrectly returned EPERM if it was previously stored in errno.
This fixes 'btrfs fi usage' that will print the overall summary for all
users (provided that the FS_INFO ioctl is already unprivileged).
Signed-off-by: David Sterba <dsterba@suse.com>
Move to use get_unit_mode_from_arg() for cmds-filesystem.c,
to make "btrfs filesystem df/show/usage"'s unit argument same.
Also have cleanup effect: 19 insertions(+), 181 deletions(-)
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>