btrfs-progs: balance: use btrfs_open_dir for btrfs balance command
authorZhao Lei <zhaolei@cn.fujitsu.com>
Mon, 12 Oct 2015 13:22:56 +0000 (21:22 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 2 Nov 2015 08:35:00 +0000 (09:35 +0100)
commit45401669b099893b41919f9c707b8ea528bcdfa5
tree8756083440d099f4da428caa65bd2f4438350b16
parentd0c0f90b3885125c2c6e55eed097617a5f1baa15
btrfs-progs: balance: use btrfs_open_dir for btrfs balance command

We can use btrfs_open_dir() to check whether target dir is
in btrfs's mount point before open, instead of checking it in
kernel space of ioctl, and return fuzzy error message.

Before patch:
  # btrfs balance start /mnt/tmp
  ERROR: error during balancing '/mnt/tmp' - Inappropriate ioctl for device
  There may be more info in syslog - try dmesg | tail
  #

After patch:
  # btrfs balance start /mnt/tmp
  ERROR: not btrfs filesystem: /mnt/tmp
  #

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
cmds-balance.c