mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-13 18:06:01 +00:00
d118b9490b
This patch introduces '-f' option which can help you filter the qgroups by the path name, you may use it like: btrfs qgroup show -f <path> For example: qgroupid(2/0) / \ / \ qgroupid(1/0) / \ / \ / \ qgroupid(0/1) qgroupid(0/2) sub1 sub2 / \ / \ dir1 file1 If we use the command: btrfs qgroup show -f sub1/dir1 The result will output 0/1 -- -- '-f' option helps you list all qgroups impact given path. (exclude ancestral qgroups) 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>
71 lines
2.1 KiB
C
71 lines
2.1 KiB
C
/*
|
|
* 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.
|
|
*/
|
|
|
|
#ifndef _BTRFS_QGROUP_H
|
|
#define _BTRFS_QGROUP_H
|
|
|
|
#include "ioctl.h"
|
|
#include "kerncompat.h"
|
|
|
|
struct btrfs_qgroup;
|
|
|
|
typedef int (*btrfs_qgroup_filter_func)(struct btrfs_qgroup *, u64);
|
|
|
|
struct btrfs_qgroup_filter {
|
|
btrfs_qgroup_filter_func filter_func;
|
|
u64 data;
|
|
};
|
|
|
|
struct btrfs_qgroup_filter_set {
|
|
int total;
|
|
int nfilters;
|
|
struct btrfs_qgroup_filter filters[0];
|
|
};
|
|
|
|
enum btrfs_qgroup_column_enum {
|
|
BTRFS_QGROUP_QGROUPID,
|
|
BTRFS_QGROUP_RFER,
|
|
BTRFS_QGROUP_EXCL,
|
|
BTRFS_QGROUP_MAX_RFER,
|
|
BTRFS_QGROUP_MAX_EXCL,
|
|
BTRFS_QGROUP_PARENT,
|
|
BTRFS_QGROUP_CHILD,
|
|
BTRFS_QGROUP_ALL,
|
|
};
|
|
|
|
enum btrfs_qgroup_filter_enum {
|
|
BTRFS_QGROUP_FILTER_PARENT,
|
|
BTRFS_QGROUP_FILTER_ALL_PARENT,
|
|
BTRFS_QGROUP_FILTER_MAX,
|
|
};
|
|
|
|
u64 btrfs_get_path_rootid(int fd);
|
|
int btrfs_show_qgroups(int fd, struct btrfs_qgroup_filter_set *);
|
|
void btrfs_qgroup_setup_print_column(enum btrfs_qgroup_column_enum column);
|
|
struct btrfs_qgroup_filter_set *btrfs_qgroup_alloc_filter_set(void);
|
|
void btrfs_qgroup_free_filter_set(struct btrfs_qgroup_filter_set *filter_set);
|
|
int btrfs_qgroup_setup_filter(struct btrfs_qgroup_filter_set **filter_set,
|
|
enum btrfs_qgroup_filter_enum, u64 data);
|
|
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);
|
|
int qgroup_inherit_add_copy(struct btrfs_qgroup_inherit **inherit, char *arg,
|
|
int type);
|
|
|
|
#endif
|