btrfs-progs: format FREE_SPACE_TREE{,_VALID} nicely in dump-super
Signed-off-by: Omar Sandoval <osandov@fb.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
41eaae6d74
commit
9e02fbfcd3
|
@ -197,6 +197,16 @@ struct readable_flag_entry {
|
||||||
char *output;
|
char *output;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define DEF_COMPAT_RO_FLAG_ENTRY(bit_name) \
|
||||||
|
{BTRFS_FEATURE_COMPAT_RO_##bit_name, #bit_name}
|
||||||
|
|
||||||
|
static struct readable_flag_entry compat_ro_flags_array[] = {
|
||||||
|
DEF_COMPAT_RO_FLAG_ENTRY(FREE_SPACE_TREE),
|
||||||
|
DEF_COMPAT_RO_FLAG_ENTRY(FREE_SPACE_TREE_VALID),
|
||||||
|
};
|
||||||
|
static const int compat_ro_flags_num = sizeof(compat_ro_flags_array) /
|
||||||
|
sizeof(struct readable_flag_entry);
|
||||||
|
|
||||||
#define DEF_INCOMPAT_FLAG_ENTRY(bit_name) \
|
#define DEF_INCOMPAT_FLAG_ENTRY(bit_name) \
|
||||||
{BTRFS_FEATURE_INCOMPAT_##bit_name, #bit_name}
|
{BTRFS_FEATURE_INCOMPAT_##bit_name, #bit_name}
|
||||||
|
|
||||||
|
@ -268,6 +278,19 @@ static void __print_readable_flag(u64 flag, struct readable_flag_entry *array,
|
||||||
printf(")\n");
|
printf(")\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void print_readable_compat_ro_flag(u64 flag)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* We know about the FREE_SPACE_TREE{,_VALID} bits, but we don't
|
||||||
|
* actually support them yet.
|
||||||
|
*/
|
||||||
|
return __print_readable_flag(flag, compat_ro_flags_array,
|
||||||
|
compat_ro_flags_num,
|
||||||
|
BTRFS_FEATURE_COMPAT_RO_SUPP |
|
||||||
|
BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE |
|
||||||
|
BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE_VALID);
|
||||||
|
}
|
||||||
|
|
||||||
static void print_readable_incompat_flag(u64 flag)
|
static void print_readable_incompat_flag(u64 flag)
|
||||||
{
|
{
|
||||||
return __print_readable_flag(flag, incompat_flags_array,
|
return __print_readable_flag(flag, incompat_flags_array,
|
||||||
|
@ -377,6 +400,7 @@ static void dump_superblock(struct btrfs_super_block *sb, int full)
|
||||||
(unsigned long long)btrfs_super_compat_flags(sb));
|
(unsigned long long)btrfs_super_compat_flags(sb));
|
||||||
printf("compat_ro_flags\t\t0x%llx\n",
|
printf("compat_ro_flags\t\t0x%llx\n",
|
||||||
(unsigned long long)btrfs_super_compat_ro_flags(sb));
|
(unsigned long long)btrfs_super_compat_ro_flags(sb));
|
||||||
|
print_readable_compat_ro_flag(btrfs_super_compat_ro_flags(sb));
|
||||||
printf("incompat_flags\t\t0x%llx\n",
|
printf("incompat_flags\t\t0x%llx\n",
|
||||||
(unsigned long long)btrfs_super_incompat_flags(sb));
|
(unsigned long long)btrfs_super_incompat_flags(sb));
|
||||||
print_readable_incompat_flag(btrfs_super_incompat_flags(sb));
|
print_readable_incompat_flag(btrfs_super_incompat_flags(sb));
|
||||||
|
|
Loading…
Reference in New Issue