2012-08-07 10:37:54 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2012 STRATO. All rights reserved.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public
|
|
|
|
* License v2 as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public
|
|
|
|
* License along with this program; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 021110-1307, USA.
|
|
|
|
*/
|
|
|
|
|
2015-01-21 16:49:26 +00:00
|
|
|
#ifndef __BTRFS_QGROUP_H__
|
|
|
|
#define __BTRFS_QGROUP_H__
|
2012-08-07 10:37:54 +00:00
|
|
|
|
2013-01-20 21:04:15 +00:00
|
|
|
#include "kerncompat.h"
|
2015-06-10 00:21:42 +00:00
|
|
|
#include "ioctl.h"
|
2012-08-07 10:37:54 +00:00
|
|
|
|
2013-10-07 07:21:42 +00:00
|
|
|
struct btrfs_qgroup;
|
|
|
|
|
|
|
|
typedef int (*btrfs_qgroup_filter_func)(struct btrfs_qgroup *, u64);
|
Btrfs-progs: enhance btrfs qgroup show to sort qgroups
You might want to list qgroups in order of some items, such as 'qgroupid', 'rfer'
and so on, you can use '--sort'. Now you can sort the qgroups by 'qgroupid',
'rfer','excl','max_rfer' and 'max_excl'.
For example:
If you want to list qgroups in order of 'qgroupid'.
You can use the option like that:
btrfs qgroup show --sort=+/-qgroupid <path>
Here, '+' means the result is sorted by ascending order. '-' is by descending
order. If you don't specify either '+' nor '-', the result is sorted by
default - ascending order.
If you want to combine sort items, you do it like that:
btrfs qgroup show --sort=-qgroupid,+rfer,max_rfer,excl <path>
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>
2013-10-07 07:21:44 +00:00
|
|
|
typedef int (*btrfs_qgroup_comp_func)(struct btrfs_qgroup *,
|
|
|
|
struct btrfs_qgroup *, int);
|
|
|
|
|
2013-10-07 07:21:42 +00:00
|
|
|
|
|
|
|
struct btrfs_qgroup_filter {
|
|
|
|
btrfs_qgroup_filter_func filter_func;
|
|
|
|
u64 data;
|
|
|
|
};
|
|
|
|
|
Btrfs-progs: enhance btrfs qgroup show to sort qgroups
You might want to list qgroups in order of some items, such as 'qgroupid', 'rfer'
and so on, you can use '--sort'. Now you can sort the qgroups by 'qgroupid',
'rfer','excl','max_rfer' and 'max_excl'.
For example:
If you want to list qgroups in order of 'qgroupid'.
You can use the option like that:
btrfs qgroup show --sort=+/-qgroupid <path>
Here, '+' means the result is sorted by ascending order. '-' is by descending
order. If you don't specify either '+' nor '-', the result is sorted by
default - ascending order.
If you want to combine sort items, you do it like that:
btrfs qgroup show --sort=-qgroupid,+rfer,max_rfer,excl <path>
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>
2013-10-07 07:21:44 +00:00
|
|
|
struct btrfs_qgroup_comparer {
|
|
|
|
btrfs_qgroup_comp_func comp_func;
|
|
|
|
int is_descending;
|
|
|
|
};
|
|
|
|
|
2013-10-07 07:21:42 +00:00
|
|
|
struct btrfs_qgroup_filter_set {
|
|
|
|
int total;
|
|
|
|
int nfilters;
|
|
|
|
struct btrfs_qgroup_filter filters[0];
|
|
|
|
};
|
|
|
|
|
Btrfs-progs: enhance btrfs qgroup show to sort qgroups
You might want to list qgroups in order of some items, such as 'qgroupid', 'rfer'
and so on, you can use '--sort'. Now you can sort the qgroups by 'qgroupid',
'rfer','excl','max_rfer' and 'max_excl'.
For example:
If you want to list qgroups in order of 'qgroupid'.
You can use the option like that:
btrfs qgroup show --sort=+/-qgroupid <path>
Here, '+' means the result is sorted by ascending order. '-' is by descending
order. If you don't specify either '+' nor '-', the result is sorted by
default - ascending order.
If you want to combine sort items, you do it like that:
btrfs qgroup show --sort=-qgroupid,+rfer,max_rfer,excl <path>
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>
2013-10-07 07:21:44 +00:00
|
|
|
struct btrfs_qgroup_comparer_set {
|
|
|
|
int total;
|
|
|
|
int ncomps;
|
|
|
|
struct btrfs_qgroup_comparer comps[0];
|
|
|
|
};
|
|
|
|
|
2013-10-07 07:21:37 +00:00
|
|
|
enum btrfs_qgroup_column_enum {
|
|
|
|
BTRFS_QGROUP_QGROUPID,
|
|
|
|
BTRFS_QGROUP_RFER,
|
|
|
|
BTRFS_QGROUP_EXCL,
|
2013-10-07 07:21:40 +00:00
|
|
|
BTRFS_QGROUP_MAX_RFER,
|
2013-10-07 07:21:41 +00:00
|
|
|
BTRFS_QGROUP_MAX_EXCL,
|
2013-10-07 07:21:38 +00:00
|
|
|
BTRFS_QGROUP_PARENT,
|
2013-10-07 07:21:39 +00:00
|
|
|
BTRFS_QGROUP_CHILD,
|
2013-10-07 07:21:37 +00:00
|
|
|
BTRFS_QGROUP_ALL,
|
|
|
|
};
|
|
|
|
|
Btrfs-progs: enhance btrfs qgroup show to sort qgroups
You might want to list qgroups in order of some items, such as 'qgroupid', 'rfer'
and so on, you can use '--sort'. Now you can sort the qgroups by 'qgroupid',
'rfer','excl','max_rfer' and 'max_excl'.
For example:
If you want to list qgroups in order of 'qgroupid'.
You can use the option like that:
btrfs qgroup show --sort=+/-qgroupid <path>
Here, '+' means the result is sorted by ascending order. '-' is by descending
order. If you don't specify either '+' nor '-', the result is sorted by
default - ascending order.
If you want to combine sort items, you do it like that:
btrfs qgroup show --sort=-qgroupid,+rfer,max_rfer,excl <path>
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>
2013-10-07 07:21:44 +00:00
|
|
|
enum btrfs_qgroup_comp_enum {
|
|
|
|
BTRFS_QGROUP_COMP_QGROUPID,
|
|
|
|
BTRFS_QGROUP_COMP_RFER,
|
|
|
|
BTRFS_QGROUP_COMP_EXCL,
|
|
|
|
BTRFS_QGROUP_COMP_MAX_RFER,
|
|
|
|
BTRFS_QGROUP_COMP_MAX_EXCL,
|
|
|
|
BTRFS_QGROUP_COMP_MAX
|
|
|
|
};
|
|
|
|
|
2013-10-07 07:21:42 +00:00
|
|
|
enum btrfs_qgroup_filter_enum {
|
2013-10-07 07:21:43 +00:00
|
|
|
BTRFS_QGROUP_FILTER_PARENT,
|
2013-10-07 07:21:42 +00:00
|
|
|
BTRFS_QGROUP_FILTER_ALL_PARENT,
|
|
|
|
BTRFS_QGROUP_FILTER_MAX,
|
|
|
|
};
|
2013-10-07 07:21:37 +00:00
|
|
|
|
2016-09-29 13:12:35 +00:00
|
|
|
int btrfs_qgroup_parse_sort_string(const char *opt_arg,
|
Btrfs-progs: enhance btrfs qgroup show to sort qgroups
You might want to list qgroups in order of some items, such as 'qgroupid', 'rfer'
and so on, you can use '--sort'. Now you can sort the qgroups by 'qgroupid',
'rfer','excl','max_rfer' and 'max_excl'.
For example:
If you want to list qgroups in order of 'qgroupid'.
You can use the option like that:
btrfs qgroup show --sort=+/-qgroupid <path>
Here, '+' means the result is sorted by ascending order. '-' is by descending
order. If you don't specify either '+' nor '-', the result is sorted by
default - ascending order.
If you want to combine sort items, you do it like that:
btrfs qgroup show --sort=-qgroupid,+rfer,max_rfer,excl <path>
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>
2013-10-07 07:21:44 +00:00
|
|
|
struct btrfs_qgroup_comparer_set **comps);
|
|
|
|
int btrfs_show_qgroups(int fd, struct btrfs_qgroup_filter_set *,
|
|
|
|
struct btrfs_qgroup_comparer_set *);
|
2013-10-07 07:21:42 +00:00
|
|
|
void btrfs_qgroup_setup_print_column(enum btrfs_qgroup_column_enum column);
|
2015-01-19 07:18:18 +00:00
|
|
|
void btrfs_qgroup_setup_units(unsigned unit_mode);
|
2013-10-07 07:21:42 +00:00
|
|
|
struct btrfs_qgroup_filter_set *btrfs_qgroup_alloc_filter_set(void);
|
|
|
|
int btrfs_qgroup_setup_filter(struct btrfs_qgroup_filter_set **filter_set,
|
|
|
|
enum btrfs_qgroup_filter_enum, u64 data);
|
Btrfs-progs: enhance btrfs qgroup show to sort qgroups
You might want to list qgroups in order of some items, such as 'qgroupid', 'rfer'
and so on, you can use '--sort'. Now you can sort the qgroups by 'qgroupid',
'rfer','excl','max_rfer' and 'max_excl'.
For example:
If you want to list qgroups in order of 'qgroupid'.
You can use the option like that:
btrfs qgroup show --sort=+/-qgroupid <path>
Here, '+' means the result is sorted by ascending order. '-' is by descending
order. If you don't specify either '+' nor '-', the result is sorted by
default - ascending order.
If you want to combine sort items, you do it like that:
btrfs qgroup show --sort=-qgroupid,+rfer,max_rfer,excl <path>
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>
2013-10-07 07:21:44 +00:00
|
|
|
struct btrfs_qgroup_comparer_set *btrfs_qgroup_alloc_comparer_set(void);
|
|
|
|
int btrfs_qgroup_setup_comparer(struct btrfs_qgroup_comparer_set **comp_set,
|
|
|
|
enum btrfs_qgroup_comp_enum comparer,
|
|
|
|
int is_descending);
|
2012-08-07 10:37:54 +00:00
|
|
|
int qgroup_inherit_size(struct btrfs_qgroup_inherit *p);
|
|
|
|
int qgroup_inherit_add_group(struct btrfs_qgroup_inherit **inherit, char *arg);
|
|
|
|
int qgroup_inherit_add_copy(struct btrfs_qgroup_inherit **inherit, char *arg,
|
|
|
|
int type);
|
|
|
|
|
|
|
|
#endif
|