]> git.hungrycats.org Git - linux/commit
btrfs: add per-inode compression levels in xattrs
authorkoraynilay <koray.fra@gmail.com>
Tue, 3 Nov 2026 19:47:31 +0000 (20:47 +0100)
committerZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Tue, 3 Nov 2026 23:39:28 +0000 (18:39 -0500)
commit028a26fdfebc49832d0f7401b20019df7f93962d
tree103a9467e2e5387461856ec1c83df7dc9ca582fd
parent067b8b770e2ee07a755241860e663376a2316a05
btrfs: add per-inode compression levels in xattrs

Add support for specifying algo:level using
btrfs property set /path/to/file compression "algo:level".

Add a signed 8 bit prop_compress_level property to btrfs_inode, which
can support from level -128 to 127, plenty for the currently supported
algo:level(s).

Change prop_compression_apply() to use the already present
btrfs_match_compress_type() and btrfs_compress_str2level() to parse the
xattr, using a stack-based buffer and memcpy() to convert the
user-supplied xattr value to a NUL-terminated string to be used by
btrfs_compress_str2level().

Assisted-by: Gemini:3.1-pro antigravity-cli-1.1.5
Signed-off-by: koraynilay <koray.fra@gmail.com>
Link: https://lore.kernel.org/r/20261103194734.598182-4-koray.fra@gmail.com
fs/btrfs/btrfs_inode.h
fs/btrfs/inode.c
fs/btrfs/props.c