From: David Sterba <dsterba@suse.cz>
To: Calvin Owens <calvin@wbinvd.org>
Cc: Qu Wenruo <quwenruo.btrfs@gmx.com>,
Sun YangKai <sunk67188@gmail.com>,
clm@fb.com, dsterba@suse.com, josef@toxicpanda.com,
linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org,
neelx@suse.com
Subject: Re: [PATCH] btrfs: Accept and ignore compression level for lzo
Date: Fri, 22 Aug 2025 20:57:09 +0200 [thread overview]
Message-ID: <20250822185709.GY22430@suse.cz> (raw)
In-Reply-To: <aKiSpTytAOXgHan5@mozart.vkv.me>
On Fri, Aug 22, 2025 at 08:54:13AM -0700, Calvin Owens wrote:
> On Friday 08/22 at 19:53 +0930, Qu Wenruo wrote:
> > 在 2025/8/22 19:50, Sun YangKai 写道:
> > > > The compression level is meaningless for lzo, but before commit
> > > > 3f093ccb95f30 ("btrfs: harden parsing of compression mount options"),
> > > > it was silently ignored if passed.
> > > >
> > > > After that commit, passing a level with lzo fails to mount:
> > > > BTRFS error: unrecognized compression value lzo:1
> > > >
> > > > Restore the old behavior, in case any users were relying on it.
> > > >
> > > > Fixes: 3f093ccb95f30 ("btrfs: harden parsing of compression mount options")
> > > > Signed-off-by: Calvin Owens <calvin@wbinvd.org>
> > > > ---
> > > >
> > > > fs/btrfs/super.c | 2 +-
> > > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > > >
> > > > diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
> > > > index a262b494a89f..7ee35038c7fb 100644
> > > > --- a/fs/btrfs/super.c
> > > > +++ b/fs/btrfs/super.c
> > > > @@ -299,7 +299,7 @@ static int btrfs_parse_compress(struct btrfs_fs_context
> > > > *ctx,>
> > > > btrfs_set_opt(ctx->mount_opt, COMPRESS);
> > > > btrfs_clear_opt(ctx->mount_opt, NODATACOW);
> > > > btrfs_clear_opt(ctx->mount_opt, NODATASUM);
> > > >
> > > > - } else if (btrfs_match_compress_type(string, "lzo", false)) {
> > > > + } else if (btrfs_match_compress_type(string, "lzo", true)) {
> > > >
> > > > ctx->compress_type = BTRFS_COMPRESS_LZO;
> > > > ctx->compress_level = 0;
> > > > btrfs_set_opt(ctx->mount_opt, COMPRESS);
> > > >
> > > > --
> > > > 2.47.2
> > >
> > > A possible improvement would be to emit a warning in
> > > btrfs_match_compress_type() when @may_have_level is false but a
> > > level is still provided. And the warning message can be something like
> > > "Providing a compression level for {compression_type} is not supported, the
> > > level is ignored."
> > >
> > > This way:
> > > 1. users receive a clearer hint about what happened,
> >
> > I'm fine with the extra warning, but I do not believe those kind of users
> > who provides incorrect mount option will really read the dmesg.
> >
> > > 2. existing setups relying on this behavior continue to work,
> >
> > Or let them fix the damn incorrect mount option.
>
> You're acting like I'm asking for "compress=lzo:iamafancyboy" to keep
> working here. I think what I proposed is a lot more reasonable than
> that, I'm *really* surprised you feel so strongly about this.
>
> In my case it was actually little ARM boards with an /etc/fstab
> generated by templating code that didn't understand lzo is special.
>
> I'm not debating that it's incorrect (I've already fixed it). But given
> that passing the level has worked forever,
Which is the reason to restore accepting the level, it's observable
behaviour and it also has impact on functionality when the mount fails.
next prev parent reply other threads:[~2025-08-22 18:57 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-22 7:45 [PATCH] btrfs: Accept and ignore compression level for lzo Calvin Owens
2025-08-22 8:27 ` Qu Wenruo
2025-08-22 9:28 ` Calvin Owens
2025-08-22 10:18 ` Qu Wenruo
2025-08-22 18:45 ` David Sterba
2025-08-22 21:42 ` Calvin Owens
2025-08-22 10:20 ` Sun YangKai
2025-08-22 10:23 ` Qu Wenruo
2025-08-22 15:54 ` Calvin Owens
2025-08-22 18:57 ` David Sterba [this message]
2025-08-22 21:44 ` Qu Wenruo
2025-08-22 23:24 ` Calvin Owens
2025-08-22 23:39 ` Qu Wenruo
2025-08-24 15:58 ` Calvin Owens
2025-08-24 21:40 ` Qu Wenruo
2025-08-25 8:51 ` Daniel Vacek
2025-08-25 9:03 ` Qu Wenruo
2025-08-25 11:37 ` Filipe Manana
2025-08-22 18:42 ` Calvin Owens
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=20250822185709.GY22430@suse.cz \
--to=dsterba@suse.cz \
--cc=calvin@wbinvd.org \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=josef@toxicpanda.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=neelx@suse.com \
--cc=quwenruo.btrfs@gmx.com \
--cc=sunk67188@gmail.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;
as well as URLs for NNTP newsgroup(s).