btrfs-progs: fragments: use btrfs_open_dir for btrfs-fragments command
authorZhao Lei <zhaolei@cn.fujitsu.com>
Mon, 12 Oct 2015 13:23:04 +0000 (21:23 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 2 Nov 2015 08:35:02 +0000 (09:35 +0100)
commit14ac9851462c29f3f97355df5b4c3c9f1953c043
tree2cb62539b0eb9a368cc5d0508a06b65b86319155
parent0b4e2d0c8a02e3eaaeca47bb306692ab76a0a200
btrfs-progs: fragments: use btrfs_open_dir for btrfs-fragments 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
deeper code, and return fuzzy error message.

Before patch:
  ./btrfs-fragments -o 123 /mnt/tmp1
  ERROR: can't perform the search

After patch:
  # ./btrfs-fragments -o 123 /mnt/tmp1
  ERROR: not a btrfs filesystem: /mnt/tmp1

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