* Inline data is compressed unconditinally even when results in increased size
@ 2026-09-14 15:46 Hanabishi
2026-09-14 17:46 ` Filipe Manana
0 siblings, 1 reply; 3+ messages in thread
From: Hanabishi @ 2026-09-14 15:46 UTC (permalink / raw)
To: linux-btrfs
Hello.
I noticed that a btrfs volume with compression enabled (e.g. 'compress=zstd') seems to compress inline data unconditionally, even in situations when compression is ineffective and only leads to increase in size.
It is easily reproducible on small files:
# echo 'a file with test content' > test.txt
# sync
# compsize test.txt
Processed 1 file, 0 regular extents (0 refs), 1 inline.
Type Perc Disk Usage Uncompressed Referenced
TOTAL 172% 43B 25B 25B
zstd 172% 43B 25B 25B
Same file when no compression enabled:
Processed 1 file, 0 regular extents (0 refs), 1 inline.
Type Perc Disk Usage Uncompressed Referenced
TOTAL 100% 25B 25B 25B
none 100% 25B 25B 25B
It's not a big deal on practice, but shouldn't it detect that the file is uncompressible and fall back to no compression?
Also, if I remember correctly, it wasn't the case a couple of kernel releases back.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Inline data is compressed unconditinally even when results in increased size
2026-09-14 15:46 Inline data is compressed unconditinally even when results in increased size Hanabishi
@ 2026-09-14 17:46 ` Filipe Manana
2026-09-14 18:24 ` Hanabishi
0 siblings, 1 reply; 3+ messages in thread
From: Filipe Manana @ 2026-09-14 17:46 UTC (permalink / raw)
To: Hanabishi; +Cc: linux-btrfs
On Mon, Sep 14, 2026 at 5:53 PM Hanabishi
<i.r.e.c.c.a.k.u.n+kernel.org@gmail.com> wrote:
>
> Hello.
>
> I noticed that a btrfs volume with compression enabled (e.g. 'compress=zstd') seems to compress inline data unconditionally, even in situations when compression is ineffective and only leads to increase in size.
>
> It is easily reproducible on small files:
>
> # echo 'a file with test content' > test.txt
> # sync
> # compsize test.txt
> Processed 1 file, 0 regular extents (0 refs), 1 inline.
> Type Perc Disk Usage Uncompressed Referenced
> TOTAL 172% 43B 25B 25B
> zstd 172% 43B 25B 25B
>
> Same file when no compression enabled:
>
> Processed 1 file, 0 regular extents (0 refs), 1 inline.
> Type Perc Disk Usage Uncompressed Referenced
> TOTAL 100% 25B 25B 25B
> none 100% 25B 25B 25B
>
> It's not a big deal on practice, but shouldn't it detect that the file is uncompressible and fall back to no compression?
> Also, if I remember correctly, it wasn't the case a couple of kernel releases back.
It's a recent regression, independent of the compression algorithm used.
Fix here:
https://lore.kernel.org/linux-btrfs/721d8fd2c73095d06cbdbfa714a6dfac9c488953.1789407346.git.fdmanana@suse.com/
Thanks.
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Inline data is compressed unconditinally even when results in increased size
2026-09-14 17:46 ` Filipe Manana
@ 2026-09-14 18:24 ` Hanabishi
0 siblings, 0 replies; 3+ messages in thread
From: Hanabishi @ 2026-09-14 18:24 UTC (permalink / raw)
To: Filipe Manana; +Cc: linux-btrfs
> It's a recent regression, independent of the compression algorithm used.
Good that I remember it right, I wasn't sure.
By the way, the actually worst case scenario when it's just 1 byte.
Processed 1 file, 0 regular extents (0 refs), 1 inline.
Type Perc Disk Usage Uncompressed Referenced
TOTAL 1900% 19B 1B 1B
zstd 1900% 19B 1B 1B
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-09-14 18:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-14 15:46 Inline data is compressed unconditinally even when results in increased size Hanabishi
2026-09-14 17:46 ` Filipe Manana
2026-09-14 18:24 ` Hanabishi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox