Re: [PATCH 0/4] btrfs: add per-inode compression levels in xattrs
Qu Wenruo <[email protected]>
| Newsgroups | org.kernel.vger.linux-btrfs |
|---|---|
| Message-ID | <[email protected]> |
在 2026/8/8 12:04, koraynilay 写道: > Add per-inode compression levels using > btrfs property set /path/to/file compression "algo:level", using the > same syntax as the compress mount option > If set on folders, all new children will inherit the setting, while > already existing children will be unaffected. > > This patch series keeps a legacy small "bug": when setting > btrfs.compression, it keeps the mount option level, even if the algo is > different (!!), so with e.g. compress=zstd:15 and btrfs.compression=zlib > the data gets compressed at zlib:9 (because it still gets clamped at the > right range). This way the behaviour of chattr +c is also unchanged. 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. Thanks, Qu > > I also wanna thank Zygo for helping me by explaining stuff and for > noticing this "bug". > > koraynilay (4): > btrfs: export btrfs_match_compress_type(), move it to compression.h > btrfs: also validate compression levels in > btrfs_compress_is_valid_type() > btrfs: add per-inode compression levels in xattrs > btrfs: support inheritance for per-inode compression levels > > fs/btrfs/btrfs_inode.h | 1 + > fs/btrfs/compression.c | 28 ++++++++++++++++++--- > fs/btrfs/compression.h | 3 ++- > fs/btrfs/inode.c | 14 +++++++++++ > fs/btrfs/props.c | 57 +++++++++++++++++++++++++++++++++--------- > fs/btrfs/super.c | 8 ------ > 6 files changed, 87 insertions(+), 24 deletions(-) > > > base-commit: a59f57e2aa127c5354168d2ec4bac920df1be4f4