summaryrefslogtreecommitdiff
path: root/qgroup.h
diff options
context:
space:
mode:
authorWang Shilong <wangsl-fnst@cn.fujitsu.com>2013-10-07 15:21:37 +0800
committerChris Mason <chris.mason@fusionio.com>2013-10-16 08:23:12 -0400
commit1e174d2621fd1e329f5cb581d786efe5105ba1fe (patch)
tree245ac6b75c76e4b725c5907db23e387b5fd6a19f /qgroup.h
parent6659f446d4b57018ba7b04a7b9c7cdd553ad9f7a (diff)
Btrfs-progs: restructure show_qgroups
The current show_qgroups() just shows a little information, and it is hard to add some functions which the users need in the future, so i restructure it, make it easy to add new functions. In order to improve the scalability of show_qgroups(), i add some important structures: struct qgroup_lookup { struct rb_root root; } /* *store qgroup's information */ struct btrfs_qgroup { struct rb_node rb_node; u64 qgroupid; u64 generation; u64 rfer; u64 rfer_cmpr; u64 excl_cmpr; u64 flags; u64 max_rfer; u64 max_excl; u64 rsv_rfer; u64 rsv_excl; struct list_head qgroups; struct list_head members; } /* *glue structure to represent the relations *between qgroups */ struct btrfs_qgroup_list { struct list_head next_qgroups; struct list_head next_member; struct btrfs_qgroup *qgroup; struct btrfs_qgroup *member; } The above 3 structures are used to manage all the information of qgroups. struct { char *name; char *column_name; int need_print; } btrfs_qgroup_columns[] We define a arrary to manage all the columns that can be outputed, and use a member variant(->need_print) to control the output of the relative column. Some columns are outputed by default. But we can change it according to the requirement of the users. For example: if outputing max referenced size of qgroup is needed,the function 'btrfs_qgroup_setup_column()' will be called, and the parameter 'BTRFS_QGROUP_MAX_RFER' (extend in the future) will be passsed to the function. After the function is done, when showing qgroups, max referenced size of qgroup will be output. Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com> Signed-off-by: Miao Xie <miaox@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'qgroup.h')
-rw-r--r--qgroup.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/qgroup.h b/qgroup.h
index da6d113a..8b34cd7c 100644
--- a/qgroup.h
+++ b/qgroup.h
@@ -22,6 +22,16 @@
#include "ioctl.h"
#include "kerncompat.h"
+enum btrfs_qgroup_column_enum {
+ BTRFS_QGROUP_QGROUPID,
+ BTRFS_QGROUP_RFER,
+ BTRFS_QGROUP_EXCL,
+ BTRFS_QGROUP_ALL,
+};
+
+int btrfs_show_qgroups(int fd);
+void btrfs_qgroup_setup_print_column(enum btrfs_qgroup_column_enum column);
+
u64 parse_qgroupid(char *p);
int qgroup_inherit_size(struct btrfs_qgroup_inherit *p);
int qgroup_inherit_add_group(struct btrfs_qgroup_inherit **inherit, char *arg);