Message ID | 37ed8ecbbc23d66955faf5b944be153db38e1dd7.1665487509.git.wqu@suse.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | btrfs-progs: print-tree: follow the supported flags when printing flags | expand |
On Tue, Oct 11, 2022 at 07:25:12PM +0800, Qu Wenruo wrote: > Currently we put EXTENT_TREE_V2 incompat flag entry under EXPERIMENTAL > features, thus at compile time, incompat_flags_array[] is determined at > compile time. > > But the truth is, we have @supported_flags for __print_readable_flag(), > which is already defined based on EXPERIMENTAL flag. > > Thus for __print_readable_flag(), we can always include the entry for > EXTENT_TREE_V2, and only print the flag if it's in the @supported_flags > > By this, we can remove one EXPERIMENTAL macro usage. > > Signed-off-by: Qu Wenruo <wqu@suse.com> Added to devel, thanks. > @@ -1731,7 +1729,7 @@ static void __print_readable_flag(u64 flag, struct readable_flag_entry *array, > printf("\t\t\t( "); > for (i = 0; i < array_size; i++) { > entry = array + i; > - if (flag & entry->bit) { > + if (flag & supported_flags && flag & entry->bit) { if ((flag & supported_flags) && (flag & entry->bit)) {
diff --git a/kernel-shared/print-tree.c b/kernel-shared/print-tree.c index 6b5fd37ab2bc..4cc44885466f 100644 --- a/kernel-shared/print-tree.c +++ b/kernel-shared/print-tree.c @@ -1689,9 +1689,7 @@ static struct readable_flag_entry incompat_flags_array[] = { DEF_INCOMPAT_FLAG_ENTRY(METADATA_UUID), DEF_INCOMPAT_FLAG_ENTRY(RAID1C34), DEF_INCOMPAT_FLAG_ENTRY(ZONED), -#if EXPERIMENTAL DEF_INCOMPAT_FLAG_ENTRY(EXTENT_TREE_V2), -#endif }; static const int incompat_flags_num = sizeof(incompat_flags_array) / sizeof(struct readable_flag_entry); @@ -1731,7 +1729,7 @@ static void __print_readable_flag(u64 flag, struct readable_flag_entry *array, printf("\t\t\t( "); for (i = 0; i < array_size; i++) { entry = array + i; - if (flag & entry->bit) { + if (flag & supported_flags && flag & entry->bit) { if (first) printf("%s ", entry->output); else
Currently we put EXTENT_TREE_V2 incompat flag entry under EXPERIMENTAL features, thus at compile time, incompat_flags_array[] is determined at compile time. But the truth is, we have @supported_flags for __print_readable_flag(), which is already defined based on EXPERIMENTAL flag. Thus for __print_readable_flag(), we can always include the entry for EXTENT_TREE_V2, and only print the flag if it's in the @supported_flags By this, we can remove one EXPERIMENTAL macro usage. Signed-off-by: Qu Wenruo <wqu@suse.com> --- kernel-shared/print-tree.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)