From: Daniel Vacek <neelx@suse.com>
To: Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>,
David Sterba <dsterba@suse.com>, Nick Terrell <terrelln@fb.com>
Cc: Daniel Vacek <neelx@suse.com>,
linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] btrfs: zstd: add `zstd-fast` alias mount option for fast modes
Date: Mon, 31 Mar 2025 10:23:46 +0200 [thread overview]
Message-ID: <20250331082347.1407151-1-neelx@suse.com> (raw)
Now that zstd fast compression levels are allowed with `compress=zstd:-N`
mount option, allow also specifying the same using the `compress=zstd-fast:N`
alias.
Upstream zstd deprecated the negative levels in favor of the `zstd-fast`
label anyways so this is actually the preferred way now. And indeed it also
looks more human friendly.
Signed-off-by: Daniel Vacek <neelx@suse.com>
---
fs/btrfs/super.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 40709e2a44fce..c1bc8d4db440a 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -368,6 +368,16 @@ static int btrfs_parse_param(struct fs_context *fc, struct fs_parameter *param)
btrfs_set_opt(ctx->mount_opt, COMPRESS);
btrfs_clear_opt(ctx->mount_opt, NODATACOW);
btrfs_clear_opt(ctx->mount_opt, NODATASUM);
+ } else if (strncmp(param->string, "zstd-fast", 9) == 0) {
+ ctx->compress_type = BTRFS_COMPRESS_ZSTD;
+ ctx->compress_level =
+ -btrfs_compress_str2level(BTRFS_COMPRESS_ZSTD,
+ param->string + 9);
+ if (ctx->compress_level > 0)
+ ctx->compress_level = -ctx->compress_level;
+ btrfs_set_opt(ctx->mount_opt, COMPRESS);
+ btrfs_clear_opt(ctx->mount_opt, NODATACOW);
+ btrfs_clear_opt(ctx->mount_opt, NODATASUM);
} else if (strncmp(param->string, "zstd", 4) == 0) {
ctx->compress_type = BTRFS_COMPRESS_ZSTD;
ctx->compress_level =
--
2.47.2
next reply other threads:[~2025-03-31 8:24 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-31 8:23 Daniel Vacek [this message]
2025-03-31 8:49 ` Qu Wenruo
2025-03-31 10:06 ` Daniel Vacek
2025-03-31 21:14 ` Qu Wenruo
2025-03-31 22:57 ` David Sterba
2025-04-02 8:37 ` Daniel Vacek
2025-04-02 9:08 ` Qu Wenruo
2025-04-02 10:29 ` Daniel Vacek
2025-04-02 14:31 ` Daniel Vacek
2025-04-14 6:53 ` Daniel Vacek
2025-04-15 3:50 ` Qu Wenruo
2025-04-15 14:58 ` Nick Terrell
2025-04-15 16:56 ` David Sterba
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=20250331082347.1407151-1-neelx@suse.com \
--to=neelx@suse.com \
--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=terrelln@fb.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
all inboxes | Powered by JetHome®