Commit Graph

10 Commits

Author SHA1 Message Date
Wang Shilong e929e2947a Btrfs-progs: output the error reason when qgroup_show fails
The original code forgot to output the reason why the commands failed,
fix it.

Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
2013-02-27 16:13:20 +01:00
Wang Shilong 9f166a337c Btrfs-progs: let the error message outputed only once
If we fail to execute the command:
		btrfs qgroup show <mnt>
It will output the follow messages:
	ERROR: can't perform the search - Inappropriate ioctl for device
	ERROR: can't list qgroups

The error is outputed twice, this is wrong, fix it.

Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
2013-02-27 16:13:15 +01:00
Zach Brown 7b3f63be2c btrfs-progs: close fd in qgroup show
It wasn't closed in the error path.

Signed-off-by: Zach Brown <zab@redhat.com>
2013-02-05 16:09:40 -08:00
Anand Jain 46e3b8087b Btrfs-progs: move open_file_or_dir() to utils.c
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>
2013-01-30 00:40:35 +01:00
Gene Czarcinski 272c049152 Btrfs-progs: Fix trival compiler error in cmds-qgroup.c
The compiler does not realize that usage() never returns.
Initializing the variable keeps it quiet.

Signed-off-by: Gene Czarcinski <gene@czarc.net>
2013-01-28 18:06:38 +01:00
Wang Shilong 19def05127 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>
Signed-off-by: Gene Czarcinski <gene@czarc.net>
2013-01-21 18:28:01 +01:00
Wang Shilong 9886166880 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>
Signed-off-by: Gene Czarcinski <gene@czarc.net>
2013-01-21 18:28:01 +01:00
Wang Shilong f933e084ea 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>
Signed-off-by: Gene Czarcinski <gene@czarc.net>
2013-01-21 18:28:01 +01:00
Tsutomu Itoh d88f33152f Btrfs-progs: fix arguments check of qgroup limit
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>
2012-10-02 13:02:51 +02:00
Arne Jansen 89fe5b5f66 Btrfs progs: quota groups support
Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
Signed-off-by: Arne Jansen <sensille@gmx.net>
2012-09-04 11:15:49 +02:00