Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Hanabishi <i.r.e.c.c.a.k.u.n+kernel.org@gmail.com>
To: linux-btrfs@vger.kernel.org
Subject: Inline data is compressed unconditinally even when results in increased size
Date: Mon, 14 Sep 2026 15:46:32 +0000	[thread overview]
Message-ID: <c97652a5-ac6b-4de6-aa23-3cdebc01d00b@gmail.com> (raw)

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.


             reply	other threads:[~2026-09-14 15:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-14 15:46 Hanabishi [this message]
2026-09-14 17:46 ` Inline data is compressed unconditinally even when results in increased size Filipe Manana
2026-09-14 18:24   ` Hanabishi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c97652a5-ac6b-4de6-aa23-3cdebc01d00b@gmail.com \
    --to=i.r.e.c.c.a.k.u.n+kernel.org@gmail.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox