Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: "koraynilay" <koray.fra@gmail.com>
To: "Qu Wenruo" <quwenruo.btrfs@gmx.com>,
	"koraynilay" <koray.fra@gmail.com>, <clm@fb.com>,
	<dsterba@suse.com>
Cc: <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH 0/4] btrfs: add per-inode compression levels in xattrs
Date: Sun, 09 Aug 2026 02:35:56 +0200	[thread overview]
Message-ID: <DKJZQAFIRW7H.3KE8DKWO5E3TV@gmail.com> (raw)
In-Reply-To: <52e06b50-b888-48f0-a574-91e1192eda73@gmx.com>

[-- Attachment #1: Type: text/plain, Size: 1544 bytes --]

On Sun Aug 9, 2026 at 2:17 AM CEST, Qu Wenruo wrote:
> 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.

Yes, I also think that would be best, but my main concern would be it
changing how chattr +c behaves (I'm less concerned about the btrfs prop
set file compression "zstd" case, since IMO that implies the user wants
the default level).

The options I considered were:
1) keep the "bug", like I did for now;
2) keep the "bug", but only if the compress= algo is the same
   as the btrfs.compression one, if they aren't, use the default for the
   btrfs.compression algo (e.g. compress=zstd:15 and btrfs.compression=zlib
   would compress the extent at zlib:3 instead of clamp(zlib, 15) = 9)
   (suggested by Zygo);
3) fix the "bug" entirely, which is what I actually accidentally did at
   first, by just setting compress_level = inode->prop_compress_level
   without any check prior to that (which means that by default it would
   use algo:0).

Option 2) is probably the best compromise between breaking existing
scripts and the behaviour making sense, plus it shouldn't change the
chattr +c behaviour, since btrfs takes the algorithm from compress=.

Thanks.

Best,
koraynilay

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2026-08-09  0:36 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-08  2:34 [PATCH 0/4] btrfs: add per-inode compression levels in xattrs koraynilay
2026-08-08  2:34 ` [PATCH 1/4] btrfs: export btrfs_match_compress_type(), move it to compression.h koraynilay
2026-08-08  2:34 ` [PATCH 2/4] btrfs: also validate compression levels in btrfs_compress_is_valid_type() koraynilay
2026-08-08  2:34 ` [PATCH 3/4] btrfs: add per-inode compression levels in xattrs koraynilay
2026-08-08  2:34 ` [PATCH 4/4] btrfs: support inheritance for per-inode compression levels koraynilay
2026-08-09  0:17 ` [PATCH 0/4] btrfs: add per-inode compression levels in xattrs Qu Wenruo
2026-08-09  0:35   ` koraynilay [this message]
2026-08-09  1:00     ` Qu Wenruo
2026-08-09  1:32       ` koraynilay
2026-08-09 23:17       ` Zygo Blaxell
2026-08-09 23:20         ` Qu Wenruo
2026-08-10  0:28           ` Zygo Blaxell
2026-08-10  0:51             ` Qu Wenruo
2026-08-10  0:57               ` Zygo Blaxell
2026-08-10  1:05               ` koraynilay
2026-08-10  1:54                 ` Qu Wenruo
2026-08-10  1:57                   ` koraynilay
2026-08-10  1:57                     ` Qu Wenruo
2026-08-10  2:06                       ` Zygo Blaxell
2026-08-10  2:11                         ` Qu Wenruo
2026-08-10 22:41                 ` koraynilay

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=DKJZQAFIRW7H.3KE8DKWO5E3TV@gmail.com \
    --to=koray.fra@gmail.com \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=quwenruo.btrfs@gmx.com \
    /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