Re: [PATCH 0/4] btrfs: add per-inode compression levels in xattrs
"koraynilay" <[email protected]>
| Newsgroups | org.kernel.vger.linux-btrfs |
|---|---|
| Message-ID | <[email protected]> |
On Sun Aug 9, 2026 at 2:17 AM CEST, Qu Wenruo wrote: > I'm not sure if this is the correct behavior in the first place. > > As you already mentioned, zstd and zlib have very different compression > level range, using the incorrect level makes no sense (and it's being > clamped anyway). > > I think we should go the default level when not specified, which makes > more sense, and that would definitely be something worth fixing. Yes, I also think that would be best, but my main concern would be it changing how chattr +c behaves (I'm less concerned about the btrfs prop set file compression "zstd" case, since IMO that implies the user wants the default level). The options I considered were: 1) keep the "bug", like I did for now; 2) keep the "bug", but only if the compress= algo is the same as the btrfs.compression one, if they aren't, use the default for the btrfs.compression algo (e.g. compress=zstd:15 and btrfs.compression=zlib would compress the extent at zlib:3 instead of clamp(zlib, 15) = 9) (suggested by Zygo); 3) fix the "bug" entirely, which is what I actually accidentally did at first, by just setting compress_level = inode->prop_compress_level without any check prior to that (which means that by default it would use algo:0). Option 2) is probably the best compromise between breaking existing scripts and the behaviour making sense, plus it shouldn't change the chattr +c behaviour, since btrfs takes the algorithm from compress=. Thanks. Best, koraynilay
signature.asc
(application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQSgVimKafU5DQMcjcDmj22qf5IGXAUCanfLbgAKCRDmj22qf5IG XC1fAQCjDaoGlHK6wNF74nDwb0DXfkiQw308qUQNXltswcuqbgD9HsUbkHvHzVUu pAkrDaEFxi74Y3/Uub0GDF8381vU2gE= =d4sY -----END PGP SIGNATURE-----