btrfs-progs: docs: update btrfs-property docs to include compression level - #1152
btrfs-progs: docs: update btrfs-property docs to include compression level#1152koraynilay wants to merge 6 commits into
Conversation
…fs-property Based on change described as option 2 in https://lore.kernel.org/linux-btrfs/DKJZQAFIRW7H.3KE8DKWO5E3TV@gmail.com/ Signed-off-by: Calvin Walton <calvin.walton@kepstin.ca>
Based on commit 4c8e88e ("btrfs-progs: docs: Draft update for setting compression level via btrfs-property") Signed-off-by: koraynilay <koray.fra@gmail.com>
|
Again, I'm not a huge fan of option 2, as the doc updates also touched the kernel part, which shows a very different behavior than XATTR. If kernel mount option has no level specified, it goes the default level. Meanwhile for XATTR it goes the mount option level if that algo matches. I think it would be much simpler, just stating that, before 7.x, the compression level of XATTR is not fully determined, behavior may vary on different kernels. I'd prefer to have the option 3 fix backported to all older kernels, and call it a day other than maintain a complex matrix. |
Yeah, what I thought was that it could be useful to have the semantics of level 0 be: "check the compression level specified upper in the hierarchy, if at the top with nothing more specific found, use default, otherwise use the specified level (only if algo matches)" although, this would mean that it has to check back on all the parent folders, which wouldn't be the best solution probably, so it could be thought like: "if 0, check the mount option, if that is not specified use default, otherwise (only if the algo matches) use the mount option level".
Ah, I'm sorry but why? Isn't it just a string compare on the algorithm?
Ah yes, that could be added, and maybe even explain how the "bug" worked (or this may be better left to community wikis).
You mentioned this because someone with a < 7.x kernel may have the bugfix patch, while others may not, so it won't be determined? Thanks. |
Signed-off-by: koraynilay <koray.fra@gmail.com>
No, I mean for older kernels like the current upstream, they do not follow this at all. They just unconditionally follow the level no matter if the algo matches. So it would be something like: "Before v7.x, the kernel follows the mount option level even it's not applicable, at and after v7.x the kernel follows the mount option level if the algo matches, otherwise uses default level".
Yes. |
Ah ok, error on my part, I didn't think of adding a disclaimer about that.
Ah ok, makes sense, I would also add it as a |
|
And if you're sending the final version, please keep the doc update in one commit, and remove the WIP tag, so that I can properly review the whole changes and merge PR in the end. Of course, that will be after we have settled down the final solution (option 2 or 3) and merged the kernel fix. |
…version support Signed-off-by: koraynilay <koray.fra@gmail.com>
There are 3 ways extents get compressed: * by -o compress: btrfs will use heuristics, if that succeeds it will try to compress, if that fails it will mark the file as NOCOMPRESS and new extents won't even be tested for compression and will be written to disk uncompressed; * by -o compress-force: btrfs will try to compress it directly, if there is no benefit it will keep it uncompressed. In any case it will limit the max extent size to 128K instead of 128M, increasing metadata usage; * by btrfs.compression: btrfs will behave like -o compress, using the heuristics -> compress flow, but will not set the NOCOMPRESS flag, so it will do the same flow for every new extent of that file. It also won't limit the max extent size. Explanation by Zygo (thanks!). Signed-off-by: koraynilay <koray.fra@gmail.com>
TODO: re-read and fix, way too tired now Signed-off-by: koraynilay <koray.fra@gmail.com>
This is a documentation update to clear up how the
btrfs.compressionxattr behaves, there is a corresponding patch series12 that is still WIP.Discussion about it happened on the mailing list and on #btrfs on irc.
Thanks.
Footnotes
https://lore.kernel.org/linux-btrfs/e476f197-dc26-4f41-a9e5-0e23623496af@gmx.com/T/#t ↩
https://lore.kernel.org/linux-btrfs/20260809185303.600071-1-koray.fra@gmail.com/T/#t ↩