Btrfs-progs: filter the deleted subvolumes when listing snapshots

btrfs snapshot list command will stop by the deleted subvolumes.

The problem may happen by two ways:
1. a subvolume deletion is not commited, that is ROOT_BACKREF has been deleted,
   but ROOT_ITEM still exists. The command will fail to fill the path of
   the deleted subvolumes because we can not get the parent fs/file tree.
2. a subvolume is possibly deleted when we fill the path, For example,
   Fs tree
     |->subv0
	  |->subv1

   We may fill the path of subv1 firstly, after that, some user deletes subv1
   and subv0, and then we fill the path of subv0. The command will fail to
   fill the path of subv0 because we can not get path of subv0. And the command
   also will fail to make the full path of subv1 because we don't have the path
   of subv0.

Since these subvolumes have been deleted, we should filter them. This patch
fixed the above problem by this way.

For the 1st case, ->ref_tree of the deleted subvolumes are 0.
For the 2nd case, if we found the error number that ioctl() returns is ENOENT,
we will set ->ref_tree to 0.
And when we make the full path of the subvolumes, we will check ->ref_tree of
them and their parent. If someone's ->ref_tree or its parent's ->ref_tree is 0,
we will filter it.

Reported-by: Stefan Priebe <s.priebe@profihost.ag>
Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
Btrfs-progs: Improve the command help system of btrfs

Btrfs's command help system allow you to show only one line short usage.
But in some case we need to use two or more lines to show
the short usage of a complicated command.

This patch add a filed 'lines' in cmd_struct, which is the number of the
extra short usage lines you want to append.

For example you have N lines short usage; you should set the field 'lines'
to N-1.

Signed-off-by: Cheng Yang <chenyang.fnst@cn.fujitsu.com>
Btrfs-progs: Introduce another form of btrfs subvolume set-default command

This patch introduces another form of btrfs subvolume set-default command.
In command "btrfs subvolume set-default", we used subvolume <id> and <path>
to set the default subvolume of a filesystem.
By the new form, we can use subvolume path to set the default subvolume.

The new form:
	subvolume set-default [-p] [-f] <path>

For example:
	If <path> is a subvolume, no option needed.
		#btrfs subvolume set-default /mnt/subvol

	If <path> is not a subvolume, -p option makes btrfs enter interactive mode
		# btrfs subvolume set-default -p /mnt/subvol/dir
		'/mnt/subvol/dir' is not a subvolume, use parent tree instead? (y or n)y

	If interactive is not expected, -f option makes btrfs skip it and 'yes' will be choose
		# btrfs subvolume set-default -p -f /mnt/subvol/dir

Signed-off-by: Cheng Yang <chenyang.fnst@cn.fujitsu.com>
Btrfs-progs: fix arg parsing for btrfs qgroup limit commands

We can use this command in two ways.
1. btrfs qgroup limit size qgroupid path
2. btrfs qgroup limit size path

Before applying this patch, we differentiate them by check the parsing result
of the second argument. It is not so good because it may make some mistakes,
For example:
  btrfs qgroup limit 1M 123456
 			^ It is a subvolume name.

In fact, we can differentiate them just by the number of arguments, so fix it
by this way.

Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Btrfs-progs: clean up reduplicate parse_qgroupid() and replace atoi with strtoull

1. parse_qgroupid() is implemented twice, clean up the reduplicate code.
2. atoi() can not detect errors, so use strtoull() instead of it.

Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Btrfs-progs: check the relation of two group by real level numbers

Comparing qgroupid is not good way to check the relationship of two groups,
the right way is to compare the real level numbers.

Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>