]> git.hungrycats.org Git - linux/commit
btrfs: preserve btrfs.compression when setting inode flags
authorkoraynilay <koray.fra@gmail.com>
Tue, 3 Nov 2026 19:47:34 +0000 (20:47 +0100)
committerZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Tue, 3 Nov 2026 23:39:29 +0000 (18:39 -0500)
commit2e91da3ba65a1d8973f07a857c6641b8d32ec121
tree4c87d87376ca614cb1fca85c3a629372dde8c4ce
parent65af9f44ec1ecd3ad14f509a27caf469ce11bb1f
btrfs: preserve btrfs.compression when setting inode flags

Commit e8a0095c7df170 ("btrfs: preserve the compression property when
other inode flags change") fixed an issue where any call to
FS_IOC_SETFLAGS (e.g. via chattr) would overwrite the btrfs.compression
property with the mount default compression type, even when no flag bits
change and even for flags unrelated to compression.

Update the fixed code to also preserve the newly introduced level
specification by using the new btrfs_compress_typelevel2str() helper.

Also move BTRFS_COMPRESS_PROP_MAX_LEN from props.c to props.h so it can
be used by ioctl.c, since it now requires a temporary buffer to write the
property string to.

[ Commit message and code adapted from Zygo's patch for this same issue ]

Reported-by: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
Suggested-by: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
Assisted-by: Gemini:3.1-pro antigravity-cli-1.1.7
Signed-off-by: koraynilay <koray.fra@gmail.com>
Link: https://lore.kernel.org/r/20261103194734.598182-7-koray.fra@gmail.com
fs/btrfs/ioctl.c
fs/btrfs/props.c
fs/btrfs/props.h