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

Enhancement: compress-force xattr #696

Open
Forza-tng opened this issue Oct 18, 2023 · 3 comments
Open

Enhancement: compress-force xattr #696

Forza-tng opened this issue Oct 18, 2023 · 3 comments
Labels
enhancement kernel something in kernel has to be done too

Comments

@Forza-tng
Copy link
Contributor

As a complement to btrfs property set <file> compression [algo], it could be useful to have a force option of the same.

@kdave kdave added enhancement kernel something in kernel has to be done too labels Oct 19, 2023
@kdave
Copy link
Owner

kdave commented Oct 19, 2023

We have only the plain string in the properties and enhancing tha with anything, like level or the forcing flag would be an incompatible change, though easy to handle due to the string value. Just that kernel and progs could refuse the values and either behave unexpectedly or crash.

As the NOCOMPRESS flag is set automatically, this would have to be overridden in the code according the the property, but this would complicate the compression decisions which are already hard to follow in some cases.

Can you please describe the use case, e.g. for which type of files or if it's based on some external tool that picks which files would need it. Thanks.

@Forza-tng
Copy link
Contributor Author

Forza-tng commented Oct 19, 2023

Hi
The basic idea is to allow better compression on data that is not as performance sensitive and where the heuristics isn't helpful. It's similar to the wish for being able to compression level via xattr as well.

Since we can already set level in an xattr, just that the kernel doesn't yet read the level part, could we further add a f to the level part?

Something like:

btrfs property set somefile compression zstd:15f

The f would indicate force mode. Would something like this be possible without introducing compatibility issues? Current tools do accept setting such values.

❯ btrfs property set bees.3t_backup.log  compression zstd:15f

❯ getfattr -n btrfs.compression bees.3t_backup.log
# file: bees.3t_backup.log
btrfs.compression="zstd:15f"

@kdave
Copy link
Owner

kdave commented Oct 19, 2023

Yeah something like that could work, the future-extensible syntax for the compression value would be "read from left as far as you can parse", which now would be the name, then ":number" and then the "f" eventually, but we can do the ":f" at once.

Curretnly kernel verifies the name, so this should work in a backward compatible way only ignoring the level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement kernel something in kernel has to be done too
Projects
None yet
Development

No branches or pull requests

2 participants