Btrfs-progs: add method to filter snapshots by parent uuid

Signed-off-by: Anand Jain <anand.jain@oracle.com>
This commit is contained in:
Anand Jain 2013-02-01 15:56:24 +08:00 committed by David Sterba
parent 2d2c9cef4b
commit d985294b02
2 changed files with 7 additions and 0 deletions

View File

@ -1156,6 +1156,11 @@ static int filter_full_path(struct root_info *ri, u64 data)
return 1;
}
static int filter_by_parent(struct root_info *ri, u64 data)
{
return !uuid_compare(ri->puuid, (u8 *)data);
}
static btrfs_list_filter_func all_filter_funcs[] = {
[BTRFS_LIST_FILTER_ROOTID] = filter_by_rootid,
[BTRFS_LIST_FILTER_SNAPSHOT_ONLY] = filter_snapshot,
@ -1168,6 +1173,7 @@ static btrfs_list_filter_func all_filter_funcs[] = {
[BTRFS_LIST_FILTER_CGEN_EQUAL] = filter_cgen_equal,
[BTRFS_LIST_FILTER_TOPID_EQUAL] = filter_topid_equal,
[BTRFS_LIST_FILTER_FULL_PATH] = filter_full_path,
[BTRFS_LIST_FILTER_BY_PARENT] = filter_by_parent,
};
struct btrfs_list_filter_set *btrfs_list_alloc_filter_set(void)

View File

@ -118,6 +118,7 @@ enum btrfs_list_filter_enum {
BTRFS_LIST_FILTER_CGEN_MORE,
BTRFS_LIST_FILTER_TOPID_EQUAL,
BTRFS_LIST_FILTER_FULL_PATH,
BTRFS_LIST_FILTER_BY_PARENT,
BTRFS_LIST_FILTER_MAX,
};