Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

btrfs-progs: print-tree: cleanup for regular bitmap based flags print #903

Open
wants to merge 3 commits into
base: devel
Choose a base branch
from

Conversation

adam900710
Copy link
Collaborator

The first 2 are small cleanups for __print_readable_flag().

The last one introduces an sprint version, sprint_readable_flag(),
allowing the same bitmap handling of print_readable_flag() to be output
into a string buffer.

And use that sprint_readable_flag() to handle inode flags, inspired by a
recent report that Synology's out-of-tree btrfs can not be handled by
upstream kernel (unsupported inode flag).

This allows print-tree to handle the unknown flags of inode flags.

Unfortunately I didn't find any other location can benefit the
sprint_readable_flag() yet.

It's either bg flags which needs special handling for SINGLE profile, or
not bitmap in the first place (e.g. compress flags).

For compat_ro_flags_num and incompat_flags_num, just use ARRAY_SIZE().

Signed-off-by: Qu Wenruo <wqu@suse.com>
This includes:

- Remove the "__" prefix
  Now the "__" is no longer recommended, and there is no function taking
  the "print_readable_flag" in the first place.

- Move the supported flags calculation into print_readable_flag()
  Since all callers are doing the same work before calling the function.

Signed-off-by: Qu Wenruo <wqu@suse.com>
The current print-tree can not handle unsupported inode flags, e.g.
created by Synology's out-of-tree btrfs implementation.

The existing one just checks all the supported flags, and if no flag
hits, it will output "none" no matter if there is any unsupported one.

Fix this by implementing sprint_readable_flag(), and use the same
handling of print_readable_flag().
Although for inode flag, adds one extra handling to output "none" if no
flag hit at all.

Signed-off-by: Qu Wenruo <wqu@suse.com>
@adam900710 adam900710 modified the milestones: v6.11.1, v6.12 Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant