The definition of the function open_file_or_dir() is moved from common.c
to utils.c in order to be able to share some common code between scrub
and the device stats in the following step. That common code uses
open_file_or_dir(). Since open_file_or_dir() makes use of the function
dirfd(3), the required XOPEN version was raised from 6 to 7.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Original-Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
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>
Signed-off-by: Gene Czarcinski <gene@czarc.net>
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>
Signed-off-by: Gene Czarcinski <gene@czarc.net>
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>
Signed-off-by: Gene Czarcinski <gene@czarc.net>
Segmentation fault occurred in the following command.
# btrfs qgroup limit
Segmentation fault
So, we should check a minimum number of arguments.
Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>